6#include <zephyr/sys/poweroff.h>
17static const uint32_t WDT_FEED_INTERVAL_MS = 1000;
19static bool wakeable_delay_feed_wdt(
uint32_t ms) {
21 const uint32_t step = std::min(ms, WDT_FEED_INTERVAL_MS);
24 if (esphome::wake_request_take()) {
27 if (ms != UINT32_MAX) {
59 woke = wakeable_delay_feed_wdt(UINT32_MAX);
63 ESP_LOGD(TAG,
"Woken up by another thread");
65 ESP_LOGD(TAG,
"Timeout expired (normal sleep)");
optional< uint64_t > sleep_duration_
optional< uint32_t > get_run_duration_() const
optional< uint32_t > run_duration_
void dump_config_platform_()
ESPHOME_LOG_TAG(TAG, "deep_sleep")
WakeupCause get_wakeup_cause()
Return why the device woke from deep sleep. Implemented per platform.
WakeupCause
Why the device woke from deep sleep. Passed to on_wake automations.
@ WAKEUP_CAUSE_NONE
The device did not wake from deep sleep (for example a cold boot, reset or OTA restart).
void ESPHOME_ALWAYS_INLINE wakeable_delay(uint32_t ms)
Host wakeable_delay uses select() over the registered fds — defined in wake_host.cpp.
Platform-specific main loop wake primitives.