From 6aa3d7a13d252a990445b4664fbcef9fc425fb1d Mon Sep 17 00:00:00 2001 From: Pascal Brunot Date: Sun, 26 May 2024 21:21:03 +0200 Subject: [PATCH] Updated watchdog to IDF v5.1 API --- test/test_mqtt/test_mqtt.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/test_mqtt/test_mqtt.cpp b/test/test_mqtt/test_mqtt.cpp index f423417e..3b27115e 100644 --- a/test/test_mqtt/test_mqtt.cpp +++ b/test/test_mqtt/test_mqtt.cpp @@ -277,9 +277,10 @@ namespace fabomatic::tests { if (!initialized) { - auto secs = std::chrono::duration_cast(conf::tasks::WATCHDOG_TIMEOUT).count(); - TEST_ASSERT_EQUAL_MESSAGE(ESP_OK, esp_task_wdt_init(secs, true), "taskEspWatchdog - esp_task_wdt_init failed"); - ESP_LOGI(TAG3, "taskEspWatchdog - initialized %d seconds", secs); + constexpr auto msecs = std::chrono::duration_cast(conf::tasks::WATCHDOG_TIMEOUT).count(); + constexpr esp_task_wdt_config_t conf{.timeout_ms = msecs, .idle_core_mask = 0, .trigger_panic = true}; + TEST_ASSERT_EQUAL_MESSAGE(ESP_OK, esp_task_wdt_init(&conf), "taskEspWatchdog - esp_task_wdt_init failed"); + ESP_LOGI(TAG3, "taskEspWatchdog - initialized %lld seconds", msecs); TEST_ASSERT_EQUAL_MESSAGE(ESP_OK, esp_task_wdt_add(NULL), "taskEspWatchdog - esp_task_wdt_add failed"); initialized = true; }