mirror of https://github.com/arendst/Tasmota.git
Merge pull request #9048 from stefanbode/patch-19
Ported DeepSleep to ESP32
This commit is contained in:
commit
e85b2753e4
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue