mirror of https://github.com/arendst/Tasmota.git
Revert "Change safeboot GUI restart to production partition"
This reverts commit b3f3e29b0c
.
This commit is contained in:
parent
b3f3e29b0c
commit
ba324b270e
|
@ -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"));
|
||||
}
|
||||
|
|
|
@ -354,27 +354,10 @@ 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 {
|
||||
|
@ -382,7 +365,6 @@ bool EspPrepSwitchPartition(uint32_t state) {
|
|||
esp_ota_set_boot_partition(partition);
|
||||
}
|
||||
}
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 };
|
||||
|
|
Loading…
Reference in New Issue