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...");
|
Serial.println("Reconnecting to WiFi netowrk...");
|
||||||
}
|
}
|
||||||
}, &ts);
|
}, &ts);
|
||||||
Task tConnected(TASK_IMMEDIATE, TASK_ONCE, [](){
|
|
||||||
Serial.println("Wifi connected event");
|
|
||||||
printStatus();
|
|
||||||
Ota::tLoop.enable();
|
|
||||||
}, &ts);
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
stationConnectedHandler = WiFi.onStationModeGotIP([](const WiFiEventStationModeGotIP& e) {
|
stationConnectedHandler = WiFi.onStationModeGotIP([](const WiFiEventStationModeGotIP& e) {
|
||||||
Serial.println("Reconnected to network.");
|
Serial.println("Connected to network.");
|
||||||
tConnected.restart();
|
printStatus();
|
||||||
tReconnect.cancel();
|
tReconnect.cancel();
|
||||||
|
Ota::tLoop.enable();
|
||||||
});
|
});
|
||||||
|
|
||||||
stationDisconnectedHandler = WiFi.onStationModeDisconnected([](const WiFiEventStationModeDisconnected& e) {
|
stationDisconnectedHandler = WiFi.onStationModeDisconnected([](const WiFiEventStationModeDisconnected& e) {
|
||||||
@ -54,12 +50,6 @@ namespace Wifi {
|
|||||||
currentPsk = WiFi.psk();
|
currentPsk = WiFi.psk();
|
||||||
}
|
}
|
||||||
|
|
||||||
void disconnect() {
|
|
||||||
Serial.println("Disconnecting WiFi");
|
|
||||||
WiFi.disconnect();
|
|
||||||
WiFi.forceSleepBegin();
|
|
||||||
}
|
|
||||||
|
|
||||||
void printStatus() {
|
void printStatus() {
|
||||||
// print the SSID of the network you're attached to:
|
// print the SSID of the network you're attached to:
|
||||||
Serial.print("SSID: ");
|
Serial.print("SSID: ");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user