mirror of https://github.com/arendst/Tasmota.git
Fix ESP32 boot to safemode
This commit is contained in:
parent
6e59d44b68
commit
804230da54
|
@ -299,8 +299,12 @@ bool EspSingleOtaPartition(void) {
|
||||||
return (1 == esp_ota_get_app_partition_count());
|
return (1 == esp_ota_get_app_partition_count());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EspRestartToSaveMode(void) {
|
void EspPrepRestartToSafeMode(void) {
|
||||||
esp_ota_mark_app_invalid_rollback_and_reboot();
|
// esp_ota_mark_app_invalid_rollback_and_reboot(); // Doesn't work 20220501
|
||||||
|
const esp_partition_t *otadata_partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_OTA, NULL);
|
||||||
|
if (otadata_partition) {
|
||||||
|
esp_partition_erase_range(otadata_partition, 0, SPI_FLASH_SEC_SIZE * 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t EspFlashBaseAddress(void) {
|
uint32_t EspFlashBaseAddress(void) {
|
||||||
|
|
|
@ -1249,9 +1249,8 @@ void Every250mSeconds(void)
|
||||||
RtcSettings.ota_loader = 1; // Try safemode image next
|
RtcSettings.ota_loader = 1; // Try safemode image next
|
||||||
SettingsSaveAll();
|
SettingsSaveAll();
|
||||||
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_RESTARTING));
|
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_RESTARTING));
|
||||||
ResetPwm();
|
EspPrepRestartToSafeMode();
|
||||||
WifiShutdown(true);
|
EspRestart();
|
||||||
EspRestartToSaveMode();
|
|
||||||
}
|
}
|
||||||
#endif // FIRMWARE_MINIMAL
|
#endif // FIRMWARE_MINIMAL
|
||||||
#endif // ESP32
|
#endif // ESP32
|
||||||
|
|
Loading…
Reference in New Issue