diff --git a/tasmota/tasmota_template_ESP32.h b/tasmota/tasmota_template_ESP32.h index ac422cfc6..644826923 100644 --- a/tasmota/tasmota_template_ESP32.h +++ b/tasmota/tasmota_template_ESP32.h @@ -36,7 +36,6 @@ // Not ported (yet) #undef USE_DISCOVERY -#undef USE_DEEPSLEEP #undef USE_MY92X1 #undef USE_TUYA_MCU #undef USE_PS_16_DZ diff --git a/tasmota/xdrv_29_deepsleep.ino b/tasmota/xdrv_29_deepsleep.ino index 4ac0531db..84b30f740 100644 --- a/tasmota/xdrv_29_deepsleep.ino +++ b/tasmota/xdrv_29_deepsleep.ino @@ -71,7 +71,12 @@ void DeepSleepReInit(void) AddLog_P2(LOG_LEVEL_ERROR, PSTR("DSL: Remain DeepSleep %d"), RtcSettings.ultradeepsleep); RtcSettingsSave(); RtcRebootReset(); +#ifdef ESP8266 ESP.deepSleep(100 * RtcSettings.deepsleep_slip * (DEEPSLEEP_MAX_CYCLE < RtcSettings.ultradeepsleep ? DEEPSLEEP_MAX_CYCLE : RtcSettings.ultradeepsleep), WAKE_RF_DEFAULT); +#else // ESP32 + esp_sleep_enable_timer_wakeup(100 * RtcSettings.deepsleep_slip * (DEEPSLEEP_MAX_CYCLE < RtcSettings.ultradeepsleep ? DEEPSLEEP_MAX_CYCLE : RtcSettings.ultradeepsleep)); + esp_deep_sleep_start(); +#endif // ESP8266 or ESP32 yield(); // Sleeping } @@ -136,8 +141,12 @@ void DeepSleepStart(void) WifiShutdown(); RtcSettings.ultradeepsleep = RtcSettings.nextwakeup - UtcTime(); RtcSettingsSave(); - +#ifdef ESP8266 ESP.deepSleep(100 * RtcSettings.deepsleep_slip * deepsleep_sleeptime); +#else // ESP32 + esp_sleep_enable_timer_wakeup(100 * RtcSettings.deepsleep_slip * deepsleep_sleeptime); + esp_deep_sleep_start(); +#endif // ESP8266 or ESP32 yield(); }