From a7e91d59d1840fd579fe8aa8dac34e88dc7fa8db Mon Sep 17 00:00:00 2001 From: wuzhenghui Date: Fri, 21 Mar 2025 20:51:09 +0800 Subject: [PATCH] feat(esp_hw_support): count pau backup time into sleep rejection judgment --- components/esp_hw_support/sleep_modes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/esp_hw_support/sleep_modes.c b/components/esp_hw_support/sleep_modes.c index 6c09b6cbe8..4eb0bb5566 100644 --- a/components/esp_hw_support/sleep_modes.c +++ b/components/esp_hw_support/sleep_modes.c @@ -1529,9 +1529,10 @@ static esp_err_t timer_wakeup_prepare(int64_t sleep_duration) #if SOC_LP_TIMER_SUPPORTED #if CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP + int64_t backup_cost_ticks = rtc_time_us_to_slowclk(((pmu_sleep_machine_constant_t *)PMU_instance()->mc)->hp.regdma_a2s_work_time_us, s_config.rtc_clk_cal_period); // Last timer wake-up validity check if ((sleep_duration == 0) || \ - (target_wakeup_tick < rtc_time_get() + SLEEP_TIMER_ALARM_TO_SLEEP_TICKS)) { + (target_wakeup_tick < rtc_time_get() + SLEEP_TIMER_ALARM_TO_SLEEP_TICKS + backup_cost_ticks)) { // Treat too short sleep duration setting as timer reject return ESP_ERR_SLEEP_REJECT; }