Skip to content

Commit c95047d

Browse files
committed
Fix SD card file handling for Pico target, overall fix
1 parent 8506c17 commit c95047d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/provisioning/sdcard/ws_sdcard.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ bool ws_sdcard::CreateNewLogFile() {
623623
sizeof(log_filename_buffer) - 1);
624624
log_filename_buffer[sizeof(log_filename_buffer) - 1] = '\0';
625625
_log_filename = log_filename_buffer;
626+
_sz_cur_log_file = 0; // Reset the current log file size
626627

627628
// Attempt to create the new log file
628629
if (!file.open(_log_filename, O_RDWR | O_CREAT | O_AT_END))
@@ -1048,7 +1049,7 @@ bool ws_sdcard::LogJSONDoc(JsonDocument &doc) {
10481049
bufferedFile.flush(); // Send the remaining bytes
10491050
file.close();
10501051
// Update log file's size
1051-
_sz_cur_log_file = szJson + 2; // +2 bytes for "\n"
1052+
_sz_cur_log_file += (szJson + 2); // +2 for newline
10521053
// print the doc to the serial
10531054
serializeJson(doc, Serial);
10541055
Serial.print("\n");

0 commit comments

Comments
 (0)