diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino index 0f1bbc082..62f305d8f 100644 --- a/tasmota/support_command.ino +++ b/tasmota/support_command.ino @@ -891,7 +891,7 @@ void CmndRestart(void) break; #ifdef ESP32 case 3: - if (EspPrepSwitchPartition(2)) { // Toggle partition between safeboot and production + if (EspPrepSwitchToOtherPartition()) { TasmotaGlobal.restart_flag = 2; ResponseCmndChar(PSTR("Switching")); } diff --git a/tasmota/support_esp.ino b/tasmota/support_esp.ino index 902b6a17d..eedcb125b 100644 --- a/tasmota/support_esp.ino +++ b/tasmota/support_esp.ino @@ -354,33 +354,15 @@ void EspPrepRestartToSafeBoot(void) { } } -bool EspPrepSwitchPartition(uint32_t state) { +bool EspPrepSwitchToOtherPartition(void) { bool valid = EspSingleOtaPartition(); if (valid) { bool running_factory = EspRunningFactoryPartition(); - switch (state) { - case 0: // Off = safeboot - if (!running_factory) { - EspPrepRestartToSafeBoot(); - } else { - valid = false; - } - break; - case 1: // On = ota0 - if (running_factory) { - const esp_partition_t* partition = esp_ota_get_next_update_partition(nullptr); - esp_ota_set_boot_partition(partition); - } else { - valid = false; - } - break; - case 2: // Toggle - if (!running_factory) { - EspPrepRestartToSafeBoot(); - } else { - const esp_partition_t* partition = esp_ota_get_next_update_partition(nullptr); - esp_ota_set_boot_partition(partition); - } + if (!running_factory) { + EspPrepRestartToSafeBoot(); + } else { + const esp_partition_t* partition = esp_ota_get_next_update_partition(nullptr); + esp_ota_set_boot_partition(partition); } } return valid; diff --git a/tasmota/xdrv_01_webserver.ino b/tasmota/xdrv_01_webserver.ino index 963e002fc..bd8dbef4f 100644 --- a/tasmota/xdrv_01_webserver.ino +++ b/tasmota/xdrv_01_webserver.ino @@ -1053,9 +1053,6 @@ void WebRestart(uint32_t type) if (!(2 == type)) { AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_RESTART)); ShowWebSource(SRC_WEBGUI); -#ifdef ESP32 - if (0 == type) { EspPrepSwitchPartition(1); } // Switch to production partition if on safeboot -#endif // ESP32 TasmotaGlobal.restart_flag = 2; } } @@ -2498,14 +2495,14 @@ void HandleInformation(void) if (ESP_PARTITION_TYPE_APP == part->type) { uint32_t prog_size = 0; // No active ota partition if (part->subtype == ESP_PARTITION_SUBTYPE_APP_FACTORY) { - prog_size = EspProgramSize(part->label); // safeboot partition (slow response) + prog_size = EspProgramSize(part->label); // safeboot partition } else if ((part->subtype >= ESP_PARTITION_SUBTYPE_APP_OTA_MIN) && (part->subtype <= ESP_PARTITION_SUBTYPE_APP_OTA_MAX)) { if (cur_part == part->subtype) { - prog_size = ESP_getSketchSize(); // Active running ota partition (fast response) + prog_size = ESP_getSketchSize(); // Active running ota partition } else if (cur_part == ESP_PARTITION_SUBTYPE_APP_FACTORY) { - prog_size = EspProgramSize(part->label); // One app partition when safeboot partitions (slow response) + prog_size = EspProgramSize(part->label); // Only app partition when safeboot partitions } } char running[2] = { 0 };