From 3b4035b3e2e3e4af7ab7913721d5e953956b4c18 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Tue, 21 May 2024 17:28:02 +0200 Subject: [PATCH] Add FUNC_ABOUT_TO_RESTART (#21460) --- tasmota/include/tasmota.h | 2 +- tasmota/tasmota_support/support_tasmota.ino | 2 ++ tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tasmota/include/tasmota.h b/tasmota/include/tasmota.h index 16696bf3f..98d6982e1 100644 --- a/tasmota/include/tasmota.h +++ b/tasmota/include/tasmota.h @@ -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, diff --git a/tasmota/tasmota_support/support_tasmota.ino b/tasmota/tasmota_support/support_tasmota.ino index 8f1df5b95..71421ea9c 100644 --- a/tasmota/tasmota_support/support_tasmota.ino +++ b/tasmota/tasmota_support/support_tasmota.ino @@ -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(); } diff --git a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino index 7d7a5d94d..0dcf52a14 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino @@ -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();