From 28882e9b291481155979ea3133d8e74357d77b7b Mon Sep 17 00:00:00 2001 From: wuzhenghui Date: Wed, 19 Mar 2025 19:27:09 +0800 Subject: [PATCH] fix(esp_hw_support): fix min sleep time calculation missmatch in powerdown flash decision --- components/esp_hw_support/sleep_modes.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/components/esp_hw_support/sleep_modes.c b/components/esp_hw_support/sleep_modes.c index ddda33325b..a23c39f651 100644 --- a/components/esp_hw_support/sleep_modes.c +++ b/components/esp_hw_support/sleep_modes.c @@ -187,9 +187,6 @@ #define DEEP_SLEEP_TIME_OVERHEAD_US (250 + 100 * 240 / CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ) #endif -// Minimal amount of time we can sleep for -#define LIGHT_SLEEP_MIN_TIME_US 200 - #define RTC_MODULE_SLEEP_PREPARE_CYCLES (6) #define CHECK_SOURCE(source, value, mask) ((s_config.wakeup_triggers & mask) && \ @@ -1410,8 +1407,8 @@ esp_err_t esp_light_sleep_start(void) * 4. All the adjustment time which is s_config.sleep_time_adjustment below. */ const uint32_t vddsdio_pd_sleep_duration = MAX(FLASH_PD_MIN_SLEEP_TIME_US, - flash_enable_time_us + LIGHT_SLEEP_MIN_TIME_US + s_config.sleep_time_adjustment - + rtc_time_slowclk_to_us(RTC_MODULE_SLEEP_PREPARE_CYCLES, s_config.rtc_clk_cal_period)); + flash_enable_time_us + s_config.sleep_time_adjustment + + rtc_time_slowclk_to_us(RTC_MODULE_SLEEP_PREPARE_CYCLES + RTC_CNTL_MIN_SLP_VAL_MIN, s_config.rtc_clk_cal_period)); if (can_power_down_vddsdio(pd_flags, vddsdio_pd_sleep_duration)) { if (s_config.sleep_time_overhead_out < flash_enable_time_us) {