6#include <zephyr/sys/poweroff.h>
11static const char *
const TAG =
"deep_sleep";
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) {
56 woke = wakeable_delay_feed_wdt(UINT32_MAX);
60 ESP_LOGD(TAG,
"Woken up by another thread");
62 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_()
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.