fix wifi reconnection issue by using enable:
onStationModeDisconnected is invoked every second and restartDelayed keeps getting postponed
This commit is contained in:
parent
e9415894ec
commit
57c2f3183b
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "Wifi",
|
"name": "Wifi",
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"description": "Helper classes for handling wifi connectiviy and OTA",
|
"description": "Helper classes for handling wifi connectiviy and OTA",
|
||||||
"repository":
|
"repository":
|
||||||
{
|
{
|
||||||
|
|||||||
@ -33,7 +33,7 @@ namespace Wifi {
|
|||||||
currentPsk = WiFi.psk();
|
currentPsk = WiFi.psk();
|
||||||
tReconnect.enable();
|
tReconnect.enable();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
void setup(Scheduler& ts, void(*onConnected)() = nullptr) {
|
void setup(Scheduler& ts, void(*onConnected)() = nullptr) {
|
||||||
stationConnectedHandler = WiFi.onStationModeGotIP(
|
stationConnectedHandler = WiFi.onStationModeGotIP(
|
||||||
@ -47,7 +47,7 @@ namespace Wifi {
|
|||||||
stationDisconnectedHandler = WiFi.onStationModeDisconnected(
|
stationDisconnectedHandler = WiFi.onStationModeDisconnected(
|
||||||
[](const WiFiEventStationModeDisconnected& e) {
|
[](const WiFiEventStationModeDisconnected& e) {
|
||||||
Serial.println("Disconnected from network.");
|
Serial.println("Disconnected from network.");
|
||||||
tReconnect.restartDelayed();
|
tReconnect.enableIfNot();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user