From 5949a9032491b1e9fe5fb87f07a9413aaba0edac Mon Sep 17 00:00:00 2001 From: Nicu Hodos Date: Thu, 9 Dec 2021 12:29:21 +0100 Subject: [PATCH] fix wifi reconnection event --- src/wifi.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/wifi.h b/src/wifi.h index c889117..686c5e5 100644 --- a/src/wifi.h +++ b/src/wifi.h @@ -10,9 +10,9 @@ namespace Wifi { String currentPsk; void setup() { - stationConnectedHandler = WiFi.onStationModeConnected([](const WiFiEventStationModeConnected& e) { + stationConnectedHandler = WiFi.onStationModeGotIP([](const WiFiEventStationModeGotIP& e) { Serial.println("Reconnected to network."); - wifiConnected.signal(); + tWifiConnected.restart(); }); WiFi.hostname("esp-clock"); @@ -25,7 +25,6 @@ namespace Wifi { while (wifiMulti.run() != WL_CONNECTED) { delay(500); } - Serial.println("Connected to network."); currentSSID = WiFi.SSID(); currentPsk = WiFi.psk(); }