Merge branch 'v1.0.2'
This commit is contained in:
commit
443b7c29d8
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Wifi",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"description": "Helper classes for handling wifi connectiviy and OTA",
|
||||
"repository":
|
||||
{
|
||||
|
||||
@ -33,9 +33,9 @@ namespace Wifi {
|
||||
currentPsk = WiFi.psk();
|
||||
tReconnect.enable();
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
void setup(Scheduler& ts, void(*onConnected)() = nullptr) {
|
||||
void setup(Scheduler& ts, void(*onConnected)() = nullptr, void(*onDisconnected)() = nullptr) {
|
||||
stationConnectedHandler = WiFi.onStationModeGotIP(
|
||||
[onConnected](const WiFiEventStationModeGotIP& e) {
|
||||
Serial.println("Connected to network.");
|
||||
@ -45,9 +45,10 @@ namespace Wifi {
|
||||
});
|
||||
|
||||
stationDisconnectedHandler = WiFi.onStationModeDisconnected(
|
||||
[](const WiFiEventStationModeDisconnected& e) {
|
||||
[onDisconnected](const WiFiEventStationModeDisconnected& e) {
|
||||
Serial.println("Disconnected from network.");
|
||||
tReconnect.restartDelayed();
|
||||
tReconnect.enableIfNot();
|
||||
if (onDisconnected) onDisconnected();
|
||||
});
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user