From 40204941aa481034c37429dad4961c222ccd5d7f Mon Sep 17 00:00:00 2001 From: cziter15 Date: Sat, 15 Jun 2024 20:22:14 +0200 Subject: [PATCH] Fix support idf 5 --- src/ksf/ksConstants.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/ksf/ksConstants.cpp b/src/ksf/ksConstants.cpp index 99ae45a..2a1d458 100644 --- a/src/ksf/ksConstants.cpp +++ b/src/ksf/ksConstants.cpp @@ -12,6 +12,7 @@ #include #include #include + #include "sdkconfig.h" #elif ESP8266 #include #else @@ -39,9 +40,19 @@ namespace ksf void initializeFramework() { #ifdef ESP32 +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0) + /* Setup watchdog. */ + esp_task_wdt_config_t twdt_config = { + .timeout_ms = KSF_WATCHDOG_TIMEOUT_SECS * 1000, + .idle_core_mask = (1 << CONFIG_SOC_CPU_CORES_NUM) - 1, // Bitmask of all cores + .trigger_panic = false, + }; + + esp_task_wdt_init(&twdt_config); +#else /* Setup watchdog. */ esp_task_wdt_init(KSF_WATCHDOG_TIMEOUT_SECS, true); - +#endif /* Initialize filesystem. */ LittleFS.begin(true); #endif @@ -57,7 +68,6 @@ namespace ksf /* Initialize WiFi defaults. */ WiFi.persistent(false); WiFi.mode(WIFI_OFF); - WiFi.setAutoConnect(false); WiFi.setAutoReconnect(false); /* Create NVS directory. */