Skip to content

Commit e6fb661

Browse files
robot-controllerL-KAYA
authored andcommitted
fix(touch): checks if the timer is active before stopping it
Merges #10745
1 parent 2ec93b3 commit e6fb661

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

components/driver/touch_sensor/esp32/touch_sensor.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,9 @@ esp_err_t touch_pad_filter_delete(void)
512512
esp_err_t ret = ESP_OK;
513513
xSemaphoreTake(rtc_touch_mux, portMAX_DELAY);
514514
if (s_touch_pad_filter->timer) {
515-
ESP_GOTO_ON_ERROR(esp_timer_stop(s_touch_pad_filter->timer), err, TOUCH_TAG, "failed to stop the timer");
515+
if (esp_timer_is_active(s_touch_pad_filter->timer)) {
516+
ESP_GOTO_ON_ERROR(esp_timer_stop(s_touch_pad_filter->timer), err, TOUCH_TAG, "failed to stop the timer");
517+
}
516518
ESP_GOTO_ON_ERROR(esp_timer_delete(s_touch_pad_filter->timer), err, TOUCH_TAG, "failed to delete the timer");
517519
s_touch_pad_filter->timer = NULL;
518520
}

0 commit comments

Comments
 (0)