cleanup wifi:
- remove disconnected - not used - remove tConnected - duplicate of stationConnectedHandler
This commit is contained in:
parent
cb53ad131a
commit
638f6b5939
@ -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: ");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user