From ad68d5b0272d619c82556d312e2ac5a313c3a66d Mon Sep 17 00:00:00 2001 From: Huelsenfrucht Date: Fri, 10 Feb 2023 12:44:33 -0500 Subject: [PATCH] touch_pad_filter_delete() now checks if the timer is active before stopping it. --- components/driver/touch_sensor/esp32/touch_sensor.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/driver/touch_sensor/esp32/touch_sensor.c b/components/driver/touch_sensor/esp32/touch_sensor.c index 3e65a7fcf2..a3453ed4ea 100644 --- a/components/driver/touch_sensor/esp32/touch_sensor.c +++ b/components/driver/touch_sensor/esp32/touch_sensor.c @@ -512,7 +512,9 @@ esp_err_t touch_pad_filter_delete(void) esp_err_t ret = ESP_OK; xSemaphoreTake(rtc_touch_mux, portMAX_DELAY); if (s_touch_pad_filter->timer) { - ESP_GOTO_ON_ERROR(esp_timer_stop(s_touch_pad_filter->timer), err, TOUCH_TAG, "failed to stop the timer"); + if (esp_timer_is_active(s_touch_pad_filter->timer)) { + ESP_GOTO_ON_ERROR(esp_timer_stop(s_touch_pad_filter->timer), err, TOUCH_TAG, "failed to stop the timer"); + } ESP_GOTO_ON_ERROR(esp_timer_delete(s_touch_pad_filter->timer), err, TOUCH_TAG, "failed to delete the timer"); s_touch_pad_filter->timer = NULL; }