11 switch (lt_get_reboot_reason()) {
12 case REBOOT_REASON_SLEEP_GPIO:
14 case REBOOT_REASON_SLEEP_RTC:
16 case REBOOT_REASON_SLEEP_USB:
27 LOG_PIN(
" Wakeup Pin: ", item.wakeup_pin);
43 ESP_LOGV(TAG,
"Waiting for pin to switch state to enter deep sleep...");
57 item.wakeup_level = !item.wakeup_level;
60 ESP_LOGI(TAG,
"Wake-up on P%u %s (%" PRId32
")", item.wakeup_pin->get_pin(), item.wakeup_level ?
"HIGH" :
"LOW",
61 static_cast<int32_t
>(item.wakeup_pin_mode));
65 lt_deep_sleep_config_timer((*this->
sleep_duration_ / 1000) & 0xFFFFFFFF);
68 lt_deep_sleep_config_gpio(1 << item.wakeup_pin->get_pin(), item.wakeup_level);
69 lt_deep_sleep_keep_floating_gpio(1 << item.wakeup_pin->get_pin(),
true);
72 lt_deep_sleep_enter();
void status_set_warning()
bool pin_prevents_sleep_(WakeUpPinItem &pin_item) const
optional< uint64_t > sleep_duration_
FixedVector< WakeUpPinItem > wakeup_pins_
optional< uint32_t > get_run_duration_() const
bool get_real_pin_state_(InternalGPIOPin &pin) const
bool next_enter_deep_sleep_
optional< uint32_t > run_duration_
void dump_config_platform_()
@ WAKEUP_PIN_MODE_KEEP_AWAKE
As long as the wakeup pin is still in the wakeup state, keep awake.
@ WAKEUP_PIN_MODE_INVERT_WAKEUP
Automatically invert the wakeup level.
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_GPIO
The device was woken by a GPIO pin (wakeup_pin or esp32_ext1_wakeup).
@ WAKEUP_CAUSE_TIMER
The device was woken by the sleep timer.
@ WAKEUP_CAUSE_UNKNOWN
The device woke from deep sleep, but the source could not be identified.
@ WAKEUP_CAUSE_NONE
The device did not wake from deep sleep (for example a cold boot, reset or OTA restart).
WakeupPinMode wakeup_pin_mode
InternalGPIOPin * wakeup_pin