fix(esp_hw_support): fix min sleep time calculation missmatch in powerdown flash decision

This commit is contained in:
wuzhenghui
2025-03-19 19:27:09 +08:00
parent 6cb14d5b2f
commit fc823576ac

View File

@ -138,9 +138,6 @@
extern void periph_inform_out_light_sleep_overhead(uint32_t out_light_sleep_time); extern void periph_inform_out_light_sleep_overhead(uint32_t out_light_sleep_time);
// Minimal amount of time we can sleep for
#define LIGHT_SLEEP_MIN_TIME_US 200
#define RTC_MODULE_SLEEP_PREPARE_CYCLES (6) #define RTC_MODULE_SLEEP_PREPARE_CYCLES (6)
#define CHECK_SOURCE(source, value, mask) ((s_config.wakeup_triggers & mask) && \ #define CHECK_SOURCE(source, value, mask) ((s_config.wakeup_triggers & mask) && \
@ -885,8 +882,8 @@ esp_err_t esp_light_sleep_start(void)
* 4. All the adjustment time which is s_config.sleep_time_adjustment below. * 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, 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 flash_enable_time_us + s_config.sleep_time_adjustment
+ rtc_time_slowclk_to_us(RTC_MODULE_SLEEP_PREPARE_CYCLES, s_config.rtc_clk_cal_period)); + 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(vddsdio_pd_sleep_duration)) { if (can_power_down_vddsdio(vddsdio_pd_sleep_duration)) {
if (s_config.sleep_time_overhead_out < flash_enable_time_us) { if (s_config.sleep_time_overhead_out < flash_enable_time_us) {