From b9e28476b9b861d3e87994e537dc08b52b14f030 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 21 Jan 2026 11:33:59 +1100 Subject: [PATCH] fix(esp_system): Allow esp_task_wdt_reconfigure() if timer is stopped If Task WDT is initialised but not start, the call to esp_timer_stop() in the reconfigure path returns ESP_ERR_INVALID_STATE and reconfiguring the Task WDT fails. This isn't the case when the Timer Group is used for Task WDT. (This failure cascades into the failure due to disabled interrupts, fixed in the parent commit.) Signed-off-by: Angus Gratton --- components/esp_system/task_wdt/task_wdt_impl_esp_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp_system/task_wdt/task_wdt_impl_esp_timer.c b/components/esp_system/task_wdt/task_wdt_impl_esp_timer.c index d5219dcfab8..3ecf627bb9e 100644 --- a/components/esp_system/task_wdt/task_wdt_impl_esp_timer.c +++ b/components/esp_system/task_wdt/task_wdt_impl_esp_timer.c @@ -120,7 +120,7 @@ esp_err_t esp_task_wdt_impl_timer_stop(twdt_ctx_t obj) ret = ESP_ERR_INVALID_STATE; } - if (ret == ESP_OK) { + if (ret == ESP_OK && esp_timer_is_active(ctx->sw_timer)) { ret = esp_timer_stop(ctx->sw_timer); }