Fix ESP32 safeboot propagating upload

This commit is contained in:
Theo Arends 2023-01-13 11:30:30 +01:00
parent 9ba3c26a8a
commit 1a9e86a6b3
2 changed files with 9 additions and 4 deletions

View File

@ -1290,7 +1290,8 @@ void Every250mSeconds(void)
if (TasmotaGlobal.ota_state_flag && CommandsReady()) { if (TasmotaGlobal.ota_state_flag && CommandsReady()) {
TasmotaGlobal.ota_state_flag--; TasmotaGlobal.ota_state_flag--;
if (2 == TasmotaGlobal.ota_state_flag) { if (2 == TasmotaGlobal.ota_state_flag) {
#ifdef CONFIG_IDF_TARGET_ESP32C3 //#ifdef CONFIG_IDF_TARGET_ESP32C3
#ifdef ESP32
OtaFactoryWrite(false); OtaFactoryWrite(false);
#endif #endif
RtcSettings.ota_loader = 0; // Try requested image first RtcSettings.ota_loader = 0; // Try requested image first
@ -1372,7 +1373,8 @@ void Every250mSeconds(void)
} else } else
#endif // USE_WEBCLIENT_HTTPS #endif // USE_WEBCLIENT_HTTPS
if (EspSingleOtaPartition()) { if (EspSingleOtaPartition()) {
#ifdef CONFIG_IDF_TARGET_ESP32C3 //#ifdef CONFIG_IDF_TARGET_ESP32C3
#ifdef ESP32
OtaFactoryWrite(true); OtaFactoryWrite(true);
#endif #endif
RtcSettings.ota_loader = 1; // Try safeboot image next RtcSettings.ota_loader = 1; // Try safeboot image next
@ -1542,10 +1544,12 @@ void Every250mSeconds(void)
{ {
if (!TasmotaGlobal.global_state.network_down) { if (!TasmotaGlobal.global_state.network_down) {
#ifdef FIRMWARE_MINIMAL #ifdef FIRMWARE_MINIMAL
#ifdef CONFIG_IDF_TARGET_ESP32C3 //#ifdef CONFIG_IDF_TARGET_ESP32C3
#ifdef ESP32
if (OtaFactoryRead()) { if (OtaFactoryRead()) {
OtaFactoryWrite(false); OtaFactoryWrite(false);
TasmotaGlobal.ota_state_flag = 3; TasmotaGlobal.ota_state_flag = 3;
AddLog(LOG_LEVEL_DEBUG, PSTR("OTA: Propagating upload"));
} }
#endif #endif
if (1 == RtcSettings.ota_loader) { if (1 == RtcSettings.ota_loader) {

View File

@ -157,7 +157,8 @@ extern "C" {
esp_partition_erase_range(otadata_partition, 0, SPI_FLASH_SEC_SIZE * 2); esp_partition_erase_range(otadata_partition, 0, SPI_FLASH_SEC_SIZE * 2);
} }
if (force_ota) { if (force_ota) {
#ifdef CONFIG_IDF_TARGET_ESP32C3 //#ifdef CONFIG_IDF_TARGET_ESP32C3
#ifdef ESP32
OtaFactoryWrite(true); OtaFactoryWrite(true);
#endif #endif
RtcSettings.ota_loader = 1; // force OTA at next reboot RtcSettings.ota_loader = 1; // force OTA at next reboot