Skip to content

Commit

Permalink
Merge branch 'fix/disable_timer_wakeup_source_with_auto_sleep_off_v5.…
Browse files Browse the repository at this point in the history
…3' into 'release/v5.3'

fix(esp_pm): disable timer wakeup source with auto light-sleep off (v5.3)

See merge request espressif/esp-idf!32618
  • Loading branch information
jack0c committed Sep 4, 2024
2 parents 212973c + f7040d3 commit 3afe962
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions components/esp_pm/pm_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,16 @@ esp_err_t esp_pm_configure(const void* vconfig)
res = rtc_clk_cpu_freq_mhz_to_config(min_freq_mhz, &s_cpu_freq_by_mode[PM_MODE_APB_MIN]);
assert(res);
s_cpu_freq_by_mode[PM_MODE_LIGHT_SLEEP] = s_cpu_freq_by_mode[PM_MODE_APB_MIN];

if (config->light_sleep_enable) {
// Enable the wakeup source here because the `esp_sleep_disable_wakeup_source` in the `else`
// branch must be called if corresponding wakeup source is already enabled.
esp_sleep_enable_timer_wakeup(0);
} else if (s_light_sleep_en) {
// Since auto light-sleep will enable the timer wakeup source, to avoid affecting subsequent possible
// deepsleep requests, disable the timer wakeup source here.
esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_TIMER);
}
s_light_sleep_en = config->light_sleep_enable;
s_config_changed = true;
portEXIT_CRITICAL(&s_switch_lock);
Expand Down

0 comments on commit 3afe962

Please sign in to comment.