From 835c0ca32c1bafeaac42305b270ae4c3f6765289 Mon Sep 17 00:00:00 2001 From: Chen Yi Qun Date: Mon, 22 Feb 2021 12:23:19 +0800 Subject: [PATCH] fix esp32s2 fall into sleep forever when deep-sleep time is set to 0 --- components/esp_hw_support/include/esp_sleep.h | 2 ++ components/esp_hw_support/sleep_modes.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/components/esp_hw_support/include/esp_sleep.h b/components/esp_hw_support/include/esp_sleep.h index 000d020aeb..c739787539 100644 --- a/components/esp_hw_support/include/esp_sleep.h +++ b/components/esp_hw_support/include/esp_sleep.h @@ -380,6 +380,8 @@ esp_err_t esp_light_sleep_start(void); * * This function does not return. * + * @note The device will wake up immediately if the deep-sleep time is set to 0 + * * @param time_in_us deep-sleep time, unit: microsecond */ void esp_deep_sleep(uint64_t time_in_us) __attribute__((noreturn)); diff --git a/components/esp_hw_support/sleep_modes.c b/components/esp_hw_support/sleep_modes.c index bf2fb66db0..1452c60b97 100644 --- a/components/esp_hw_support/sleep_modes.c +++ b/components/esp_hw_support/sleep_modes.c @@ -547,8 +547,7 @@ static uint32_t IRAM_ATTR esp_sleep_start(uint32_t pd_flags) } // Configure timer wakeup - if ((s_config.wakeup_triggers & RTC_TIMER_TRIG_EN) && - s_config.sleep_duration > 0) { + if (s_config.wakeup_triggers & RTC_TIMER_TRIG_EN) { timer_wakeup_prepare(); }