Skip to content

Commit 0271c3d

Browse files
committed
Change fileSize to logFileSize. Use uint64_t throughout
1 parent 0d60027 commit 0271c3d

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

Firmware/RTK_Everywhere/RTK_Everywhere.ino

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ TaskHandle_t pinBluetoothTaskHandle; // Dummy task to start hardware on an assig
492492
volatile bool bluetoothPinned; // This variable is touched by core 0 but checked by core 1. Must be volatile.
493493

494494
volatile static int combinedSpaceRemaining; // Overrun indicator
495-
volatile static long fileSize; // Updated with each write
495+
volatile static uint64_t logFileSize; // Updated with each write
496496
int bufferOverruns; // Running count of possible data losses since power-on
497497

498498
bool zedUartPassed; // Goes true during testing if ESP can communicate with ZED over UART
@@ -721,7 +721,7 @@ bool forceSystemStateUpdate; // Set true to avoid update wait
721721
uint32_t lastPrintRoverAccuracy;
722722
uint32_t lastBaseLEDupdate; // Controls the blinking of the Base LED
723723

724-
uint32_t lastFileReport; // When logging, print file record stats every few seconds
724+
uint32_t lastFileReport = 0; // When logging, print file record stats every few seconds
725725
long lastStackReport; // Controls the report rate of stack highwater mark within a task
726726
uint32_t lastHeapReport; // Report heap every 1s if option enabled
727727
uint32_t lastTaskHeapReport; // Report task heap every 1s if option enabled
@@ -731,7 +731,7 @@ uint32_t lastRTCSync; // Time in millis when the RTC was last sync'd
731731
bool rtcSyncd; // Set to true when the RTC has been sync'd via TP pulse
732732
uint32_t lastPrintPosition; // For periodic display of the position
733733

734-
uint64_t lastLogSize;
734+
uint64_t lastLogSize = 0;
735735
bool logIncreasing; // Goes true when log file is greater than lastLogSize or logPosition changes
736736
bool reuseLastLog; // Goes true if we have a reset due to software (rather than POR)
737737

@@ -1398,18 +1398,19 @@ void logUpdate()
13981398
// Report file sizes to show recording is working
13991399
if ((millis() - lastFileReport) > 5000)
14001400
{
1401-
if (fileSize > 0)
1401+
if (logFileSize > 0)
14021402
{
14031403
lastFileReport = millis();
1404+
14041405
if (settings.enablePrintLogFileStatus)
14051406
{
1406-
systemPrintf("Log file size: %ld", fileSize);
1407+
systemPrintf("Log file size: %lld", logFileSize);
14071408

14081409
if ((systemTime_minutes - startLogTime_minutes) < settings.maxLogTime_minutes)
14091410
{
14101411
// Calculate generation and write speeds every 5 seconds
1411-
uint32_t fileSizeDelta = fileSize - lastLogSize;
1412-
systemPrintf(" - Generation rate: %0.1fkB/s", fileSizeDelta / 5.0 / 1000.0);
1412+
uint64_t fileSizeDelta = logFileSize - lastLogSize;
1413+
systemPrintf(" - Generation rate: %0.1fkB/s", ((float)fileSizeDelta) / 5.0 / 1000.0);
14131414
}
14141415
else
14151416
{
@@ -1419,9 +1420,9 @@ void logUpdate()
14191420
systemPrintln();
14201421
}
14211422

1422-
if (fileSize > lastLogSize)
1423+
if (logFileSize > lastLogSize)
14231424
{
1424-
lastLogSize = fileSize;
1425+
lastLogSize = logFileSize;
14251426
logIncreasing = true;
14261427
}
14271428
else

Firmware/RTK_Everywhere/Tasks.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,7 +1282,7 @@ void handleGnssDataTask(void *e)
12821282
systemPrintf("SD %d bytes written to log file\r\n", bytesToSend);
12831283
}
12841284

1285-
fileSize = logFile->fileSize(); // Update file size
1285+
logFileSize = logFile->fileSize(); // Update file size
12861286

12871287
sdFreeSpace -= bytesToSend; // Update remaining space on SD
12881288

@@ -1310,7 +1310,7 @@ void handleGnssDataTask(void *e)
13101310
if (endTime - startTime > 150)
13111311
systemPrintf("Long Write! Time: %ld ms / Location: %ld / Recorded %d bytes / "
13121312
"spaceRemaining %d bytes\r\n",
1313-
endTime - startTime, fileSize, bytesToSend, combinedSpaceRemaining);
1313+
endTime - startTime, logFileSize, bytesToSend, combinedSpaceRemaining);
13141314
}
13151315

13161316
xSemaphoreGive(sdCardSemaphore);

0 commit comments

Comments
 (0)