|
|
@@ -259,15 +259,21 @@ void ioinit (void)
|
|
|
void close_files(unsigned char flush_logs) {
|
|
|
UINT bw;
|
|
|
if (FLAGS & F_FILEOPEN) {
|
|
|
- if (f_close(&gps_log))
|
|
|
+ if (f_close(&gps_log)) {
|
|
|
System.status = STATUS_FILE_CLOSE_ERROR;
|
|
|
- if (gpx_close(&gpx_file))
|
|
|
+ System.global_error |= ERROR_FILE_CLOSE;
|
|
|
+ }
|
|
|
+ if (gpx_close(&gpx_file)) {
|
|
|
System.status = STATUS_FILE_CLOSE_ERROR;
|
|
|
+ System.global_error |= ERROR_FILE_CLOSE;
|
|
|
+ }
|
|
|
if (flush_logs && logbuf.len && !f_write(&system_log, logbuf.buf, logbuf.len, &bw)) {
|
|
|
logbuf.len = 0;
|
|
|
}
|
|
|
- if (f_close(&system_log))
|
|
|
+ if (f_close(&system_log)) {
|
|
|
System.status = STATUS_FILE_CLOSE_ERROR;
|
|
|
+ System.global_error |= ERROR_FILE_CLOSE;
|
|
|
+ }
|
|
|
xputs_P(PSTR("File closed\r\n"));
|
|
|
display_event(DISPLAY_EVENT_FILE_CLOSED);
|
|
|
}
|
|
|
@@ -400,6 +406,7 @@ int main (void)
|
|
|
if (res != FR_OK) {
|
|
|
xprintf(PSTR("FS error %u\r\n"), res);
|
|
|
System.status = STATUS_DISK_ERROR;
|
|
|
+ System.global_error |= ERROR_DISK;
|
|
|
continue;
|
|
|
}
|
|
|
System.status = STATUS_NO_GPS;
|
|
|
@@ -422,7 +429,14 @@ int main (void)
|
|
|
for (;;) { /* main loop */
|
|
|
wdt_reset();
|
|
|
gettemp();
|
|
|
+
|
|
|
+ /* Check temperature sensor after initialization */
|
|
|
+ if ((FLAGS & F_GPSOK) && !System.temperature_ok) {
|
|
|
+ System.global_error |= ERROR_TEMPERATURE;
|
|
|
+ }
|
|
|
+
|
|
|
menu();
|
|
|
+ check_error_and_jump();
|
|
|
display_refresh(0);
|
|
|
if (no_menu())
|
|
|
menu_push(default_menu); /* returned from top-level */
|
|
|
@@ -470,6 +484,7 @@ int main (void)
|
|
|
f_write(&gps_log, Line, len-1, &bw);
|
|
|
if (bw != len-1) {
|
|
|
System.status = STATUS_FILE_WRITE_ERROR;
|
|
|
+ System.global_error |= ERROR_FILE_WRITE;
|
|
|
break;
|
|
|
}
|
|
|
if (System.location_valid == LOC_VALID_NEW) { /* a new point */
|
|
|
@@ -480,6 +495,7 @@ int main (void)
|
|
|
if (FLAGS & F_SYNC) {
|
|
|
if (f_sync(&gps_log)) {
|
|
|
System.status = STATUS_FILE_SYNC_ERROR;
|
|
|
+ System.global_error |= ERROR_FILE_SYNC;
|
|
|
break;
|
|
|
}
|
|
|
FLAGS &= ~F_SYNC;
|
|
|
@@ -510,6 +526,7 @@ int main (void)
|
|
|
|| f_write(&gps_log, "\r\n", 2, &bw)) /* Put a blank line as start marker */
|
|
|
{
|
|
|
System.status = STATUS_FILE_OPEN_ERROR;
|
|
|
+ System.global_error |= ERROR_FILE_OPEN;
|
|
|
break; /* Failed to start logging */
|
|
|
}
|
|
|
|
|
|
@@ -521,6 +538,7 @@ int main (void)
|
|
|
{
|
|
|
f_close(&gpx_file);
|
|
|
System.status = STATUS_FILE_OPEN_ERROR;
|
|
|
+ System.global_error |= ERROR_FILE_OPEN;
|
|
|
break; /* Failed to start logging */
|
|
|
}
|
|
|
|
|
|
@@ -533,6 +551,7 @@ int main (void)
|
|
|
f_close(&gpx_file);
|
|
|
f_close(&gps_log);
|
|
|
System.status = STATUS_FILE_OPEN_ERROR;
|
|
|
+ System.global_error |= ERROR_FILE_OPEN;
|
|
|
break; /* Failed to start logging */
|
|
|
}
|
|
|
wdt_enable(WDTO_4S);
|