@@ -46,7 +46,7 @@ const int FIRMWARE_VERSION_MINOR = 8;
4646
4747#define COMPILE_WIFI // Comment out to remove all WiFi functionality
4848#define COMPILE_BT // Comment out to disable all Bluetooth
49- // #define ENABLE_DEVELOPER //Uncomment this line to enable special developer modes (don't check power button at startup)
49+ #define ENABLE_DEVELOPER // Uncomment this line to enable special developer modes (don't check power button at startup)
5050
5151// Define the RTK board identifier:
5252// This is an int which is unique to this variant of the RTK Surveyor hardware which allows us
@@ -215,13 +215,15 @@ HardwareSerial serialGNSS(2);
215215#define RXD2 16
216216#define TXD2 17
217217
218- #define SERIAL_SIZE_RX (1024 * 2 ) // Should match buffer size in BluetoothSerial.cpp. Reduced from 16384 to make room for WiFi/NTRIP server capabilities
218+ #define SERIAL_SIZE_RX (1024 * 4 ) // Should match buffer size in BluetoothSerial.cpp. Reduced from 16384 to make room for WiFi/NTRIP server capabilities
219219uint8_t rBuffer[SERIAL_SIZE_RX]; // Buffer for reading from F9P to SPP
220- uint8_t wBuffer[SERIAL_SIZE_RX]; // Buffer for writing from incoming SPP to F9P
221220TaskHandle_t F9PSerialReadTaskHandle = NULL ; // Store handles so that we can kill them if user goes into WiFi NTRIP Server mode
221+ const uint8_t F9PSerialReadTaskPriority = 1 ; // 3 being the highest, and 0 being the lowest
222+
223+ #define SERIAL_SIZE_TX (1024 * 2 )
224+ uint8_t wBuffer[SERIAL_SIZE_TX]; // Buffer for writing from incoming SPP to F9P
222225TaskHandle_t F9PSerialWriteTaskHandle = NULL ; // Store handles so that we can kill them if user goes into WiFi NTRIP Server mode
223226const uint8_t F9PSerialWriteTaskPriority = 1 ; // 3 being the highest, and 0 being the lowest
224- const uint8_t F9PSerialReadTaskPriority = 1 ;
225227
226228TaskHandle_t pinUART2TaskHandle = NULL ; // Dummy task to start UART2 on core 0.
227229volatile bool uart2pinned = false ; // This variable is touched by core 0 but checked by core 1. Must be volatile.
@@ -438,9 +440,36 @@ void updateLogs()
438440 }
439441 }
440442
441- // Report file sizes to show recording is working
442443 if (online.logging == true )
443444 {
445+ // Force file sync every 5000ms
446+ if (millis () - lastUBXLogSyncTime > 5000 )
447+ {
448+ if (xSemaphoreTake (xFATSemaphore, fatSemaphore_shortWait_ms) == pdPASS)
449+ {
450+ if (productVariant == RTK_SURVEYOR)
451+ digitalWrite (pin_baseStatusLED, !digitalRead (pin_baseStatusLED)); // Blink LED to indicate logging activity
452+
453+ long startWriteTime = micros ();
454+ ubxFile.sync ();
455+ long stopWriteTime = micros ();
456+ totalWriteTime += stopWriteTime - startWriteTime; // Used to calculate overall write speed
457+
458+ if (productVariant == RTK_SURVEYOR)
459+ digitalWrite (pin_baseStatusLED, !digitalRead (pin_baseStatusLED)); // Return LED to previous state
460+
461+ updateDataFileAccess (&ubxFile); // Update the file access time & date
462+
463+ lastUBXLogSyncTime = millis ();
464+ xSemaphoreGive (xFATSemaphore);
465+ } // End xFATSemaphore
466+ else
467+ {
468+ log_d (" Semaphore failed to yield" );
469+ }
470+ }
471+
472+ // Report file sizes to show recording is working
444473 if (millis () - lastFileReport > 5000 )
445474 {
446475 long fileSize = 0 ;
0 commit comments