diff --git a/tasmota/settings.ino b/tasmota/settings.ino index 137f49a1a..205cc92c0 100644 --- a/tasmota/settings.ino +++ b/tasmota/settings.ino @@ -625,7 +625,7 @@ void SettingsDefaultSet2(void) // Settings.flag.stop_flash_rotate = 0; Settings.save_data = SAVE_DATA; Settings.param[P_BACKLOG_DELAY] = MIN_BACKLOG_DELAY; - Settings.param[P_BOOT_LOOP_OFFSET] = BOOT_LOOP_OFFSET; + Settings.param[P_BOOT_LOOP_OFFSET] = BOOT_LOOP_OFFSET; // SetOption36 Settings.param[P_RGB_REMAP] = RGB_REMAP_RGBW; Settings.sleep = APP_SLEEP; if (Settings.sleep < 50) { @@ -1007,7 +1007,7 @@ void SettingsDelta(void) for (uint32_t i = 1; i < MAX_INTERLOCKS; i++) { Settings.interlock[i] = 0; } } if (Settings.version < 0x0604010D) { - Settings.param[P_BOOT_LOOP_OFFSET] = BOOT_LOOP_OFFSET; + Settings.param[P_BOOT_LOOP_OFFSET] = BOOT_LOOP_OFFSET; // SetOption36 } if (Settings.version < 0x06040110) { ModuleDefault(WEMOS); diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index 8ac67d918..f933df049 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -1538,7 +1538,7 @@ void setup(void) #endif #endif // USE_EMULATION - if (Settings.param[P_BOOT_LOOP_OFFSET]) { + if (Settings.param[P_BOOT_LOOP_OFFSET]) { // SetOption36 // Disable functionality as possible cause of fast restart within BOOT_LOOP_TIME seconds (Exception, WDT or restarts) if (RtcReboot.fast_reboot_count > Settings.param[P_BOOT_LOOP_OFFSET]) { // Restart twice Settings.flag3.user_esp8285_enable = 0; // SetOption51 - Enable ESP8285 user GPIO's - Disable ESP8285 Generic GPIOs interfering with flash SPI diff --git a/tasmota/xdrv_29_deepsleep.ino b/tasmota/xdrv_29_deepsleep.ino index 2cbfc0d91..08f0755ef 100644 --- a/tasmota/xdrv_29_deepsleep.ino +++ b/tasmota/xdrv_29_deepsleep.ino @@ -58,16 +58,18 @@ bool DeepSleepEnabled(void) void DeepSleepInit(void) { - // Go back to sleep after 60 minutes if requested deepsleep has not been reached - if (DeepSleepEnabled() && (RtcSettings.ultradeepsleep > MAX_DEEPSLEEP_CYCLE) && (RtcSettings.ultradeepsleep < 1700000000)) { - RtcSettings.ultradeepsleep = RtcSettings.ultradeepsleep - MAX_DEEPSLEEP_CYCLE; - RtcReboot.fast_reboot_count = 0; - RtcRebootSave(); - AddLog_P2(LOG_LEVEL_ERROR, PSTR("DSL: Remain DeepSleep %d"), RtcSettings.ultradeepsleep); - RtcSettingsSave(); - ESP.deepSleep(100 * RtcSettings.deepsleep_slip * (MAX_DEEPSLEEP_CYCLE < RtcSettings.ultradeepsleep ? MAX_DEEPSLEEP_CYCLE : RtcSettings.ultradeepsleep), WAKE_RF_DEFAULT); - yield(); - // Sleeping + if (DeepSleepEnabled()) { + RtcReboot.fast_reboot_count = 0; + RtcRebootSave(); + if ((RtcSettings.ultradeepsleep > MAX_DEEPSLEEP_CYCLE) && (RtcSettings.ultradeepsleep < 1700000000)) { + // Go back to sleep after 60 minutes if requested deepsleep has not been reached + RtcSettings.ultradeepsleep = RtcSettings.ultradeepsleep - MAX_DEEPSLEEP_CYCLE; + AddLog_P2(LOG_LEVEL_ERROR, PSTR("DSL: Remain DeepSleep %d"), RtcSettings.ultradeepsleep); + RtcSettingsSave(); + ESP.deepSleep(100 * RtcSettings.deepsleep_slip * (MAX_DEEPSLEEP_CYCLE < RtcSettings.ultradeepsleep ? MAX_DEEPSLEEP_CYCLE : RtcSettings.ultradeepsleep), WAKE_RF_DEFAULT); + yield(); + // Sleeping + } } // Stay awake RtcSettings.ultradeepsleep = 0; @@ -137,8 +139,8 @@ void DeepSleepCheck(void) void CmndDeepsleepTime(void) { -// if ((XdrvMailbox.payload == 0) || ((XdrvMailbox.payload > 10) && (XdrvMailbox.payload < 4294967295))) { - if ((XdrvMailbox.payload == 0) || ((XdrvMailbox.payload > 10) && (XdrvMailbox.payload < (24 * 60 * 60)))) { // Allow max 24 hours sleep + if ((XdrvMailbox.payload == 0) || + ((XdrvMailbox.payload > 10) && (XdrvMailbox.payload < (10 * 366 * 24 * 60 * 60)))) { // Allow max 10 years sleep Settings.deepsleep = XdrvMailbox.payload; RtcSettings.nextwakeup = 0; tele_period = Settings.tele_period -1; // Initiate start DeepSleep on next finish of forced TelePeriod