@@ -273,6 +273,7 @@ float battChangeRate = 0.0;
273273
274274char platformPrefix[55 ] = " Surveyor" ; // Sets the prefix for broadcast names
275275
276+ #include < driver/uart.h> // Required for uart_set_rx_full_threshold() on cores <v2.0.5
276277HardwareSerial serialGNSS (2 ); // TX on 17, RX on 16
277278
278279#define SERIAL_SIZE_TX 512
@@ -295,6 +296,7 @@ volatile bool uart2pinned = false; //This variable is touched by core 0 but chec
295296
296297volatile static int combinedSpaceRemaining = 0 ; // Overrun indicator
297298volatile static long fileSize = 0 ; // Updated with each write
299+ int bufferOverruns = 0 ; // Running count of possible data losses since power-on
298300
299301bool zedUartPassed = false ; // Goes true during testing if ESP can communicate with ZED over UART
300302// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -437,7 +439,6 @@ uint32_t rtcmLastReceived = 0;
437439
438440uint32_t maxSurveyInWait_s = 60L * 15L ; // Re-start survey-in after X seconds
439441
440- uint32_t totalWriteTime = 0 ; // Used to calculate overall write speed using SdFat library
441442
442443uint16_t svinObservationTime = 0 ; // Use globals so we don't have to request these values multiple times (slow response)
443444float svinMeanAccuracy = 0 ;
@@ -675,37 +676,6 @@ void updateLogs()
675676
676677 if (online.logging == true )
677678 {
678- // Force file sync every 60s
679- if (millis () - lastUBXLogSyncTime > 60000 )
680- {
681- if (xSemaphoreTake (sdCardSemaphore, fatSemaphore_shortWait_ms) == pdPASS)
682- {
683- markSemaphore (FUNCTION_SYNC);
684-
685- if (productVariant == RTK_SURVEYOR)
686- digitalWrite (pin_baseStatusLED, !digitalRead (pin_baseStatusLED)); // Blink LED to indicate logging activity
687-
688- ubxFile->sync ();
689-
690- if (productVariant == RTK_SURVEYOR)
691- digitalWrite (pin_baseStatusLED, !digitalRead (pin_baseStatusLED)); // Return LED to previous state
692-
693- updateDataFileAccess (ubxFile); // Update the file access time & date
694-
695- lastUBXLogSyncTime = millis ();
696- xSemaphoreGive (sdCardSemaphore);
697- } // End sdCardSemaphore
698- else
699- {
700- char semaphoreHolder[50 ];
701- getSemaphoreFunction (semaphoreHolder);
702-
703- // This is OK because in the interim more data will be written to the log
704- // and the log file will eventually be synced by the next call in loop
705- log_d (" sdCardSemaphore failed to yield for sync, held by %s, RTK_Surveyor.ino line %d" , semaphoreHolder, __LINE__);
706- }
707- }
708-
709679 // Record any pending trigger events
710680 if (newEventToRecord == true )
711681 {
@@ -763,8 +733,6 @@ void updateLogs()
763733 Serial.println ();
764734 }
765735
766- totalWriteTime = 0 ; // Reset write time every 5s
767-
768736 if (fileSize > lastLogSize)
769737 {
770738 lastLogSize = fileSize;
0 commit comments