File tree Expand file tree Collapse file tree 2 files changed +15
-12
lines changed
Firmware/Test Sketches/SD_UART_Tasks Expand file tree Collapse file tree 2 files changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,8 @@ int pin_microSD_CS = 25;
62
62
File ubxFile;
63
63
64
64
char fileName[] = " /myTest.txt" ;
65
+ long fileSize = 0 ;
66
+ unsigned long lastFileReport = 0 ;
65
67
66
68
unsigned long lastUBXLogSyncTime = 0 ;
67
69
@@ -167,5 +169,12 @@ void loop()
167
169
}
168
170
}
169
171
172
+ // Report file sizes to show recording is working
173
+ if ((millis () - lastFileReport) > 5000 )
174
+ {
175
+ lastFileReport = millis ();
176
+ Serial.printf (" UBX file size: %ld\n\r " , fileSize);
177
+ }
178
+
170
179
delay (1 ); // Yield to other tasks
171
180
}
Original file line number Diff line number Diff line change @@ -114,8 +114,9 @@ void SDWriteTask(void *e)
114
114
int recordedBytes = ubxFile.write (&rBuffer[sdTail], sdBytesToRecord);
115
115
long endTime = millis ();
116
116
117
- // if (endTime - startTime > 100) log_d("Long Write! Delta time: %d / Recorded %d bytes", endTime - startTime, recordedBytes);
118
- if (endTime - startTime > 20 ) log_d (" Long Write! Delta time: %d / Recorded %d bytes" , endTime - startTime, recordedBytes);
117
+ if (endTime - startTime > 150 ) log_d (" Long Write! Delta time: %d / Recorded %d bytes" , endTime - startTime, recordedBytes);
118
+
119
+ fileSize = ubxFile.fileSize (); // Get updated filed size
119
120
120
121
// Account for the sent data or dropped
121
122
if (recordedBytes > 0 )
@@ -125,20 +126,13 @@ void SDWriteTask(void *e)
125
126
sdTail -= gnssHandlerBufferSize;
126
127
}
127
128
128
- // Force file sync every 5000ms
129
- if (millis () - lastUBXLogSyncTime > 5000 )
129
+ // Force file sync every 60s
130
+ if (millis () - lastUBXLogSyncTime > 60000 )
130
131
{
131
- ubxFile.flush ();
132
- // #ifdef USE_SDFAT
133
- // log_d("fileSize: %ld", ubxFile.fileSize());
134
- // #else
135
- // log_d("fileSize: %d", ubxFile.size());
136
- // #endif
137
-
132
+ ubxFile.sync ();
138
133
lastUBXLogSyncTime = millis ();
139
134
} // End sdCardSemaphore
140
135
141
-
142
136
} // End logging
143
137
}
144
138
You can’t perform that action at this time.
0 commit comments