fix wifi reconnection issue by using enable:

onStationModeDisconnected is invoked every second and restartDelayed keeps getting postponed
This commit is contained in:
Nicu Hodos 2024-06-29 15:43:10 +02:00
parent e9415894ec
commit 57c2f3183b
2 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "Wifi",
"version": "1.0.1",
"version": "1.0.2",
"description": "Helper classes for handling wifi connectiviy and OTA",
"repository":
{

View File

@ -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();
});