From 57c2f3183b6cad140cce571ed11748182b9fec9d Mon Sep 17 00:00:00 2001 From: Nicu Hodos Date: Sat, 29 Jun 2024 15:43:10 +0200 Subject: [PATCH] fix wifi reconnection issue by using enable: onStationModeDisconnected is invoked every second and restartDelayed keeps getting postponed --- library.json | 2 +- src/wifi.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/library.json b/library.json index 0162e48..cc7b8cd 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "Wifi", - "version": "1.0.1", + "version": "1.0.2", "description": "Helper classes for handling wifi connectiviy and OTA", "repository": { diff --git a/src/wifi.h b/src/wifi.h index 1b54e3c..c15e6fe 100644 --- a/src/wifi.h +++ b/src/wifi.h @@ -33,7 +33,7 @@ namespace Wifi { currentPsk = WiFi.psk(); tReconnect.enable(); } - ); + ); void setup(Scheduler& ts, void(*onConnected)() = nullptr) { stationConnectedHandler = WiFi.onStationModeGotIP( @@ -47,7 +47,7 @@ namespace Wifi { stationDisconnectedHandler = WiFi.onStationModeDisconnected( [](const WiFiEventStationModeDisconnected& e) { Serial.println("Disconnected from network."); - tReconnect.restartDelayed(); + tReconnect.enableIfNot(); });