mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-08 12:36:52 +03:00
Remove html directory on update (#3584)
* delete HTML directory on an update * delete HTML directory on an update * rename html folder * swap HTML folders after extracting * . * . * . * . * . * . * move SD card check, SD card directories setup and update to before the PSRAM init. The update should be as early as possible to allow updates even if the PSRAM or cam fails. * . * . * Update Helper.cpp * Update Helper.h * . --------- Co-authored-by: CaCO3 <caco@ruinelli.ch> Co-authored-by: SybexX <Heinrich-Tuning@web.de>
This commit is contained in:
@@ -254,6 +254,35 @@ extern "C" void app_main(void)
|
||||
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "==================== Start ======================");
|
||||
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "=================================================");
|
||||
|
||||
// SD card: basic R/W check
|
||||
// ********************************************
|
||||
int iSDCardStatus = SDCardCheckRW();
|
||||
if (iSDCardStatus < 0) {
|
||||
if (iSDCardStatus <= -1 && iSDCardStatus >= -2) { // write error
|
||||
StatusLED(SDCARD_CHECK, 1, true);
|
||||
}
|
||||
else if (iSDCardStatus <= -3 && iSDCardStatus >= -5) { // read error
|
||||
StatusLED(SDCARD_CHECK, 2, true);
|
||||
}
|
||||
else if (iSDCardStatus == -6) { // delete error
|
||||
StatusLED(SDCARD_CHECK, 3, true);
|
||||
}
|
||||
setSystemStatusFlag(SYSTEM_STATUS_SDCARD_CHECK_BAD); // reduced web interface going to be loaded
|
||||
}
|
||||
|
||||
// SD card: Create further mandatory directories (if not already existing)
|
||||
// Correct creation of these folders will be checked with function "SDCardCheckFolderFilePresence"
|
||||
// ********************************************
|
||||
MakeDir("/sdcard/firmware"); // mandatory for OTA firmware update
|
||||
MakeDir("/sdcard/img_tmp"); // mandatory for setting up alignment marks
|
||||
MakeDir("/sdcard/demo"); // mandatory for demo mode
|
||||
MakeDir("/sdcard/config/certs"); // mandatory for mqtt certificates
|
||||
|
||||
// Check for updates
|
||||
// ********************************************
|
||||
CheckOTAUpdate();
|
||||
CheckUpdate();
|
||||
|
||||
// Init external PSRAM
|
||||
// ********************************************
|
||||
esp_err_t PSRAMStatus = esp_psram_init();
|
||||
@@ -352,22 +381,6 @@ extern "C" void app_main(void)
|
||||
}
|
||||
}
|
||||
|
||||
// SD card: basic R/W check
|
||||
// ********************************************
|
||||
int iSDCardStatus = SDCardCheckRW();
|
||||
if (iSDCardStatus < 0) {
|
||||
if (iSDCardStatus <= -1 && iSDCardStatus >= -2) { // write error
|
||||
StatusLED(SDCARD_CHECK, 1, true);
|
||||
}
|
||||
else if (iSDCardStatus <= -3 && iSDCardStatus >= -5) { // read error
|
||||
StatusLED(SDCARD_CHECK, 2, true);
|
||||
}
|
||||
else if (iSDCardStatus == -6) { // delete error
|
||||
StatusLED(SDCARD_CHECK, 3, true);
|
||||
}
|
||||
setSystemStatusFlag(SYSTEM_STATUS_SDCARD_CHECK_BAD); // reduced web interface going to be loaded
|
||||
}
|
||||
|
||||
// Migrate parameter in config.ini to new naming (firmware 15.0 and newer)
|
||||
// ********************************************
|
||||
migrateConfiguration();
|
||||
@@ -380,19 +393,6 @@ extern "C" void app_main(void)
|
||||
// ********************************************
|
||||
setCpuFrequency();
|
||||
|
||||
// SD card: Create further mandatory directories (if not already existing)
|
||||
// Correct creation of these folders will be checked with function "SDCardCheckFolderFilePresence"
|
||||
// ********************************************
|
||||
MakeDir("/sdcard/firmware"); // mandatory for OTA firmware update
|
||||
MakeDir("/sdcard/img_tmp"); // mandatory for setting up alignment marks
|
||||
MakeDir("/sdcard/demo"); // mandatory for demo mode
|
||||
MakeDir("/sdcard/config/certs"); // mandatory for mqtt certificates
|
||||
|
||||
// Check for updates
|
||||
// ********************************************
|
||||
CheckOTAUpdate();
|
||||
CheckUpdate();
|
||||
|
||||
// Start SoftAP for initial remote setup
|
||||
// Note: Start AP if no wlan.ini and/or config.ini available, e.g. SD card empty; function does not exit anymore until reboot
|
||||
// ********************************************
|
||||
|
||||
Reference in New Issue
Block a user