Hand in place of the asterisk
Work on SD-card logs. No more f_open and f_close in flight (could take up to 400ms!) SD-card logs now closed on shutdown
This commit is contained in:
+17
-2
@@ -546,17 +546,22 @@ const pm_char * eeBackupModel(uint8_t i_fileSrc)
|
||||
}
|
||||
#endif
|
||||
|
||||
wdt_reset();
|
||||
|
||||
// check and create folder here
|
||||
strcpy_P(buf, STR_MODELS_PATH);
|
||||
#ifndef SIMU
|
||||
result = f_opendir(&archiveFolder, buf);
|
||||
if (result != FR_OK) {
|
||||
result = f_mkdir(buf);
|
||||
if (result == FR_NO_PATH)
|
||||
result = f_mkdir(buf);
|
||||
if (result != FR_OK)
|
||||
return SDCARD_ERROR(result);
|
||||
}
|
||||
#endif
|
||||
|
||||
wdt_reset();
|
||||
|
||||
buf[sizeof(MODELS_PATH)-1] = '/';
|
||||
eeLoadModelName(i_fileSrc, &buf[sizeof(MODELS_PATH)]);
|
||||
buf[sizeof(MODELS_PATH)+FILENAME_MAXLEN] = '\0';
|
||||
@@ -595,6 +600,8 @@ const pm_char * eeBackupModel(uint8_t i_fileSrc)
|
||||
return SDCARD_ERROR(result);
|
||||
}
|
||||
|
||||
wdt_reset();
|
||||
|
||||
result = f_write(&archiveFile, &g_eeGeneral.myVers, 1, &written);
|
||||
if (result != FR_OK) {
|
||||
return SDCARD_ERROR(result);
|
||||
@@ -608,6 +615,7 @@ const pm_char * eeBackupModel(uint8_t i_fileSrc)
|
||||
if (result != FR_OK) {
|
||||
return SDCARD_ERROR(result);
|
||||
}
|
||||
wdt_reset();
|
||||
}
|
||||
|
||||
f_close(&archiveFile);
|
||||
@@ -625,6 +633,8 @@ const pm_char * eeRestoreModel(uint8_t i_fileDst, char *model_name)
|
||||
return SDCARD_ERROR(result);
|
||||
}
|
||||
|
||||
wdt_reset();
|
||||
|
||||
strcpy_P(buf, STR_MODELS_PATH);
|
||||
buf[sizeof(MODELS_PATH)-1] = '/';
|
||||
strcpy(&buf[sizeof(MODELS_PATH)], model_name);
|
||||
@@ -662,6 +672,7 @@ const pm_char * eeRestoreModel(uint8_t i_fileDst, char *model_name)
|
||||
s_sync_write = false;
|
||||
return STR_EEPROMOVERFLOW;
|
||||
}
|
||||
wdt_reset();
|
||||
}
|
||||
} while (read == 15);
|
||||
|
||||
@@ -853,6 +864,10 @@ void eeLoadModel(uint8_t id)
|
||||
{
|
||||
if (id<MAX_MODELS) {
|
||||
|
||||
#ifdef SDCARD
|
||||
closeLogs();
|
||||
#endif
|
||||
|
||||
if (pulsesStarted()) {
|
||||
pausePulses();
|
||||
}
|
||||
@@ -882,7 +897,7 @@ void eeLoadModel(uint8_t id)
|
||||
resetAll();
|
||||
|
||||
#ifdef SDCARD
|
||||
initLogs();
|
||||
openLogs();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user