File tree Expand file tree Collapse file tree 2 files changed +15
-12
lines changed
Firmware/Test Sketches/SD_UART_Tasks Expand file tree Collapse file tree 2 files changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,8 @@ int pin_microSD_CS = 25;
6262File ubxFile;
6363
6464char fileName[] = " /myTest.txt" ;
65+ long fileSize = 0 ;
66+ unsigned long lastFileReport = 0 ;
6567
6668unsigned long lastUBXLogSyncTime = 0 ;
6769
@@ -167,5 +169,12 @@ void loop()
167169 }
168170 }
169171
172+ // Report file sizes to show recording is working
173+ if ((millis () - lastFileReport) > 5000 )
174+ {
175+ lastFileReport = millis ();
176+ Serial.printf (" UBX file size: %ld\n\r " , fileSize);
177+ }
178+
170179 delay (1 ); // Yield to other tasks
171180}
Original file line number Diff line number Diff line change @@ -114,8 +114,9 @@ void SDWriteTask(void *e)
114114 int recordedBytes = ubxFile.write (&rBuffer[sdTail], sdBytesToRecord);
115115 long endTime = millis ();
116116
117- // if (endTime - startTime > 100) log_d("Long Write! Delta time: %d / Recorded %d bytes", endTime - startTime, recordedBytes);
118- if (endTime - startTime > 20 ) log_d (" Long Write! Delta time: %d / Recorded %d bytes" , endTime - startTime, recordedBytes);
117+ if (endTime - startTime > 150 ) log_d (" Long Write! Delta time: %d / Recorded %d bytes" , endTime - startTime, recordedBytes);
118+
119+ fileSize = ubxFile.fileSize (); // Get updated filed size
119120
120121 // Account for the sent data or dropped
121122 if (recordedBytes > 0 )
@@ -125,20 +126,13 @@ void SDWriteTask(void *e)
125126 sdTail -= gnssHandlerBufferSize;
126127 }
127128
128- // Force file sync every 5000ms
129- if (millis () - lastUBXLogSyncTime > 5000 )
129+ // Force file sync every 60s
130+ if (millis () - lastUBXLogSyncTime > 60000 )
130131 {
131- ubxFile.flush ();
132- // #ifdef USE_SDFAT
133- // log_d("fileSize: %ld", ubxFile.fileSize());
134- // #else
135- // log_d("fileSize: %d", ubxFile.size());
136- // #endif
137-
132+ ubxFile.sync ();
138133 lastUBXLogSyncTime = millis ();
139134 } // End sdCardSemaphore
140135
141-
142136 } // End logging
143137 }
144138
You can’t perform that action at this time.
0 commit comments