Add FUNC_ABOUT_TO_RESTART (#21460)

This commit is contained in:
Theo Arends 2024-05-21 17:28:02 +02:00
parent 73350da88c
commit 3b4035b3e2
3 changed files with 4 additions and 1 deletions

View File

@ -416,7 +416,7 @@ enum LightSubtypes { LST_NONE, LST_SINGLE, LST_COLDWARM, LST_RGB, LST_RGBW, LS
enum LightTypes { LT_BASIC, LT_PWM1, LT_PWM2, LT_PWM3, LT_PWM4, LT_PWM5, LT_PWM6, LT_PWM7,
LT_NU8, LT_SERIAL1, LT_SERIAL2, LT_RGB, LT_RGBW, LT_RGBWC, LT_NU14, LT_NU15 }; // Do not insert new fields
enum XsnsFunctions { FUNC_SETTINGS_OVERRIDE, FUNC_SETUP_RING1, FUNC_SETUP_RING2, FUNC_PRE_INIT, FUNC_INIT, FUNC_ACTIVE,
enum XsnsFunctions { FUNC_SETTINGS_OVERRIDE, FUNC_SETUP_RING1, FUNC_SETUP_RING2, FUNC_PRE_INIT, FUNC_INIT, FUNC_ACTIVE, FUNC_ABOUT_TO_RESTART,
FUNC_LOOP, FUNC_SLEEP_LOOP, FUNC_EVERY_50_MSECOND, FUNC_EVERY_100_MSECOND, FUNC_EVERY_200_MSECOND, FUNC_EVERY_250_MSECOND, FUNC_EVERY_SECOND,
FUNC_RESET_SETTINGS, FUNC_RESTORE_SETTINGS, FUNC_SAVE_SETTINGS, FUNC_SAVE_AT_MIDNIGHT, FUNC_SAVE_BEFORE_RESTART, FUNC_INTERRUPT_STOP, FUNC_INTERRUPT_START,
FUNC_AFTER_TELEPERIOD, FUNC_JSON_APPEND, FUNC_WEB_SENSOR, FUNC_WEB_COL_SENSOR,

View File

@ -1436,6 +1436,7 @@ void Every250mSeconds(void)
OtaFactoryWrite(true);
#endif
RtcSettings.ota_loader = 1; // Try safeboot image next
XsnsXdrvCall(FUNC_ABOUT_TO_RESTART);
SettingsSaveAll();
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_RESTARTING));
EspPrepRestartToSafeBoot();
@ -1583,6 +1584,7 @@ void Every250mSeconds(void)
}
if (2 == TasmotaGlobal.restart_flag) { // Restart 1
XsnsXdrvCall(FUNC_ABOUT_TO_RESTART);
SettingsSaveAll();
}

View File

@ -3112,6 +3112,7 @@ void HandleSwitchBootPartition(void)
// apply the change in flash and return result
if (switch_factory || switch_ota) {
XsnsXdrvCall(FUNC_ABOUT_TO_RESTART);
SettingsSaveAll();
if (switch_factory) {
EspPrepRestartToSafeBoot();