@@ -302,6 +302,22 @@ void handleGNSSDataTask(void *e)
302
302
303
303
fileSize = ubxFile->fileSize (); // Get updated filed size
304
304
305
+ // Force file sync every 60s
306
+ if (millis () - lastUBXLogSyncTime > 60000 )
307
+ {
308
+ if (productVariant == RTK_SURVEYOR)
309
+ digitalWrite (pin_baseStatusLED, !digitalRead (pin_baseStatusLED)); // Blink LED to indicate logging activity
310
+
311
+ ubxFile->sync ();
312
+ updateDataFileAccess (ubxFile); // Update the file access time & date
313
+ if (productVariant == RTK_SURVEYOR)
314
+ digitalWrite (pin_baseStatusLED, !digitalRead (pin_baseStatusLED)); // Return LED to previous state
315
+
316
+ lastUBXLogSyncTime = millis ();
317
+ }
318
+
319
+ long endTime = millis ();
320
+
305
321
if (settings.enablePrintBufferOverrun )
306
322
{
307
323
if (endTime - startTime > 150 )
@@ -311,9 +327,12 @@ void handleGNSSDataTask(void *e)
311
327
xSemaphoreGive (sdCardSemaphore);
312
328
313
329
// Account for the sent data or dropped
314
- sdTail += sdBytesToRecord;
315
- if (sdTail >= settings.gnssHandlerBufferSize )
316
- sdTail -= settings.gnssHandlerBufferSize ;
330
+ if (sdBytesToRecord > 0 )
331
+ {
332
+ sdTail += sdBytesToRecord;
333
+ if (sdTail >= settings.gnssHandlerBufferSize )
334
+ sdTail -= settings.gnssHandlerBufferSize ;
335
+ }
317
336
} // End sdCardSemaphore
318
337
else
319
338
{
0 commit comments