From 54b06ecb62176b590bb1302ad8a72bb45a5ca8be Mon Sep 17 00:00:00 2001 From: KonstantinKondrashov Date: Wed, 16 Nov 2022 23:44:31 +0800 Subject: [PATCH] esp_timer: Fix the stop alarm triggering when the timer list is empty Related to ESP32-C6 chip only because this chip can power down the digital domain during the light sleep. And after wakes up, systimer gets resumed, and the alarm value < count value, so it leads the alarm fired immediately. We get one unnecessary interrupt at light sleep exit time. Other chips do not power down the digital domain related to systimer. --- components/esp_timer/src/esp_timer_impl_systimer.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/components/esp_timer/src/esp_timer_impl_systimer.c b/components/esp_timer/src/esp_timer_impl_systimer.c index 30abe9bf757..c3ae050df9f 100644 --- a/components/esp_timer/src/esp_timer_impl_systimer.c +++ b/components/esp_timer/src/esp_timer_impl_systimer.c @@ -80,9 +80,7 @@ void IRAM_ATTR esp_timer_impl_set_alarm_id(uint64_t timestamp, unsigned alarm_id portENTER_CRITICAL_SAFE(&s_time_update_lock); timestamp_id[alarm_id] = timestamp; timestamp = MIN(timestamp_id[0], timestamp_id[1]); - if (timestamp != UINT64_MAX) { - systimer_hal_set_alarm_target(&systimer_hal, SYSTIMER_LL_ALARM_CLOCK, timestamp); - } + systimer_hal_set_alarm_target(&systimer_hal, SYSTIMER_LL_ALARM_CLOCK, timestamp); portEXIT_CRITICAL_SAFE(&s_time_update_lock); }