Skip to content

Commit

Permalink
add a Delay between the WiFi reconnections (#3068)
Browse files Browse the repository at this point in the history
* add a Delay between the WiFi reconnections

* log the delay between the WiFi reconnections

move the delay after the log
  • Loading branch information
hex7c0 authored Sep 22, 2024
1 parent 098b1bd commit 20a04b8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion code/components/jomjol_wlan/connect_wlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 20a04b8

Please sign in to comment.