Skip to content

Commit 3174cb7

Browse files
committed
SD_MMC: flush every 250ms, not every write
1 parent 619ff4a commit 3174cb7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Firmware/RTK_Surveyor/Tasks.ino

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,15 @@ void handleGNSSDataTask(void *e)
408408
long startTime = millis();
409409

410410
sdBytesToRecord = ubxFile->write(&ringBuffer[sdTail], sliceToRecord);
411+
static unsigned long lastFlush = 0;
411412
if (USE_MMC_MICROSD)
412-
ubxFile->flush();
413+
{
414+
if (millis() > (lastFlush + 250)) // Flush every 250ms, not every write
415+
{
416+
ubxFile->flush();
417+
lastFlush += 250;
418+
}
419+
}
413420
fileSize = ubxFile->fileSize(); //Update file size
414421

415422
sdFreeSpace -= sliceToRecord; //Update remaining space on SD

0 commit comments

Comments
 (0)