@@ -273,6 +273,7 @@ float battChangeRate = 0.0;
273
273
274
274
char platformPrefix[55 ] = " Surveyor" ; // Sets the prefix for broadcast names
275
275
276
+ #include < driver/uart.h> // Required for uart_set_rx_full_threshold() on cores <v2.0.5
276
277
HardwareSerial serialGNSS (2 ); // TX on 17, RX on 16
277
278
278
279
#define SERIAL_SIZE_TX 512
@@ -295,6 +296,7 @@ volatile bool uart2pinned = false; //This variable is touched by core 0 but chec
295
296
296
297
volatile static int combinedSpaceRemaining = 0 ; // Overrun indicator
297
298
volatile static long fileSize = 0 ; // Updated with each write
299
+ int bufferOverruns = 0 ; // Running count of possible data losses since power-on
298
300
299
301
bool zedUartPassed = false ; // Goes true during testing if ESP can communicate with ZED over UART
300
302
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -437,7 +439,6 @@ uint32_t rtcmLastReceived = 0;
437
439
438
440
uint32_t maxSurveyInWait_s = 60L * 15L ; // Re-start survey-in after X seconds
439
441
440
- uint32_t totalWriteTime = 0 ; // Used to calculate overall write speed using SdFat library
441
442
442
443
uint16_t svinObservationTime = 0 ; // Use globals so we don't have to request these values multiple times (slow response)
443
444
float svinMeanAccuracy = 0 ;
@@ -675,37 +676,6 @@ void updateLogs()
675
676
676
677
if (online.logging == true )
677
678
{
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
-
709
679
// Record any pending trigger events
710
680
if (newEventToRecord == true )
711
681
{
@@ -763,8 +733,6 @@ void updateLogs()
763
733
Serial.println ();
764
734
}
765
735
766
- totalWriteTime = 0 ; // Reset write time every 5s
767
-
768
736
if (fileSize > lastLogSize)
769
737
{
770
738
lastLogSize = fileSize;
0 commit comments