From 638f6b59394710dc8e8c940e5b8cf76c19539597 Mon Sep 17 00:00:00 2001 From: Nicu Hodos Date: Sat, 27 Apr 2024 16:06:59 +0200 Subject: [PATCH] cleanup wifi: - remove disconnected - not used - remove tConnected - duplicate of stationConnectedHandler --- gateway/include/wifi.h | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/gateway/include/wifi.h b/gateway/include/wifi.h index 0b9219e..cb48543 100644 --- a/gateway/include/wifi.h +++ b/gateway/include/wifi.h @@ -22,17 +22,13 @@ namespace Wifi { Serial.println("Reconnecting to WiFi netowrk..."); } }, &ts); - Task tConnected(TASK_IMMEDIATE, TASK_ONCE, [](){ - Serial.println("Wifi connected event"); - printStatus(); - Ota::tLoop.enable(); - }, &ts); void setup() { stationConnectedHandler = WiFi.onStationModeGotIP([](const WiFiEventStationModeGotIP& e) { - Serial.println("Reconnected to network."); - tConnected.restart(); + Serial.println("Connected to network."); + printStatus(); tReconnect.cancel(); + Ota::tLoop.enable(); }); stationDisconnectedHandler = WiFi.onStationModeDisconnected([](const WiFiEventStationModeDisconnected& e) { @@ -54,12 +50,6 @@ namespace Wifi { currentPsk = WiFi.psk(); } - void disconnect() { - Serial.println("Disconnecting WiFi"); - WiFi.disconnect(); - WiFi.forceSleepBegin(); - } - void printStatus() { // print the SSID of the network you're attached to: Serial.print("SSID: ");