mirror of https://github.com/arendst/Tasmota.git
Add ESP32 Command ``Restart 3`` to switch between SafeBoot and Production
This commit is contained in:
parent
b26e74960e
commit
91f42fc8b8
|
@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
|
|||
|
||||
## [11.1.0.2]
|
||||
### Added
|
||||
|
||||
- ESP32 Command ``Restart 3`` to switch between SafeBoot and Production
|
||||
|
||||
### Changed
|
||||
- ESP32 Tasmota SafeBoot with changed partition scheme allowing larger binaries
|
||||
|
|
|
@ -114,6 +114,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
|
|||
- Support for daisy chaining MAX7219 displays [#15345](https://github.com/arendst/Tasmota/issues/15345)
|
||||
- Sonoff SPM delayed SetPowerOnState [#13447](https://github.com/arendst/Tasmota/issues/13447)
|
||||
- Support for flowrate meters like YF-DN50 and similary [#15474](https://github.com/arendst/Tasmota/issues/15474)
|
||||
- ESP32 Command ``Restart 3`` to switch between SafeBoot and Production
|
||||
|
||||
### Breaking Changed
|
||||
|
||||
|
|
|
@ -875,6 +875,14 @@ void CmndRestart(void)
|
|||
TasmotaGlobal.restart_halt = true;
|
||||
ResponseCmndChar(PSTR(D_JSON_HALTING));
|
||||
break;
|
||||
#ifdef ESP32
|
||||
case 3:
|
||||
if (EspPrepSwitchToOtherPartition()) {
|
||||
TasmotaGlobal.restart_flag = 2;
|
||||
ResponseCmndChar(PSTR("Switching"));
|
||||
}
|
||||
break;
|
||||
#endif // ESP32
|
||||
case -1:
|
||||
CmndCrash(); // force a crash
|
||||
break;
|
||||
|
|
|
@ -312,6 +312,20 @@ void EspPrepRestartToSafeBoot(void) {
|
|||
}
|
||||
}
|
||||
|
||||
bool EspPrepSwitchToOtherPartition(void) {
|
||||
bool valid = EspSingleOtaPartition();
|
||||
if (valid) {
|
||||
bool running_factory = EspRunningFactoryPartition();
|
||||
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;
|
||||
}
|
||||
|
||||
uint32_t EspFlashBaseAddress(void) {
|
||||
if (EspSingleOtaPartition()) { // Only one partition so start at end of sketch
|
||||
const esp_partition_t *running = esp_ota_get_running_partition();
|
||||
|
|
Loading…
Reference in New Issue