Closed
Description
I am using latest Git version.
Lately the usage of Wifi.onEvent() was changed, see WiFi event handling refactoring #2119
The function that I am using to connect Wifi is working at boot time of ESP8266.
Then when I make Wifi disconnect by calling WiFi.disconnect(), I can see that the connectWifi() is triggered. Till so far that is as expected.
But what I notice is that Wifi is not picking the connection again.
Am I doing something wrong in the connectWifi() function?
I have registered a disconnection handler.
mDisconnectHandler = WiFi.onStationModeDisconnected(&onDisconnected);
void onDisconnected(const WiFiEventStationModeDisconnected& event)
{
connectWifi();
}
I have the following connectWifi function.
void connectWifi() {
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(100);
ESP.wdtFeed();
}
Serial.print(String("[WIFI] IP: "));
Serial.println(WiFi.localIP());
}