From 20a04b888f451e8059c846cab808a67dadaf61b8 Mon Sep 17 00:00:00 2001 From: Francesco Carnielli Date: Sun, 22 Sep 2024 21:50:38 +0200 Subject: [PATCH] add a Delay between the WiFi reconnections (#3068) * add a Delay between the WiFi reconnections * log the delay between the WiFi reconnections move the delay after the log --- code/components/jomjol_wlan/connect_wlan.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/components/jomjol_wlan/connect_wlan.cpp b/code/components/jomjol_wlan/connect_wlan.cpp index 60375126..03a4cd75 100644 --- a/code/components/jomjol_wlan/connect_wlan.cpp +++ b/code/components/jomjol_wlan/connect_wlan.cpp @@ -480,7 +480,8 @@ static void event_handler(void* arg, esp_event_base_t event_base, int32_t event_ if (WIFIReconnectCnt >= 10) { WIFIReconnectCnt = 0; LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Disconnected, multiple reconnect attempts failed (" + - std::to_string(disconn->reason) + "), still retrying..."); + std::to_string(disconn->reason) + "), retrying after 5s"); + vTaskDelay(5000 / portTICK_PERIOD_MS); // Delay between the reconnections } } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_CONNECTED)