cpu/esp32: fix wake-up sources for sleep modes

When entering a sleep mode, all wake-up sources should first be disabled before the wake-up sources required for the sleep mode are then stepwise enabled again. Otherwise, an wake-up configuration of one sleep mode may affect the wake-up within another sleep mode.
This commit is contained in:
Gunar Schorcht 2020-03-29 12:44:32 +02:00
parent be8e1170bc
commit 85b18a1c10

View File

@ -131,6 +131,9 @@ void pm_set(unsigned mode)
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_ON);
}
/* first disable all wake-up sources */
esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL);
/* Prepare the RTC timer if an RTC alarm is set to wake up. */
rtc_pm_sleep_enter(mode);