From b9cbbf9bfec8a3fc6e60b0cca60e94e0b3e98940 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 e88e077a45..dc21eb9394 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 @@ -126,7 +126,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); }