Description
Basic Infos
Hardware
Hardware: ?ESP-07?
Core Version: ?2.3.0?
Description
When using ESP8266WiFiMulti's run() method to connect to a WiFi network, it is possible for the connection to neither succeed nor fail, leading to the run() method never returning. A good example of this would be connecting to a WiFi network where the DHCP server is inoperative.
A mechanism to specify a timeout should exist.
The relevant code in run() looks like this:
// wait for connection or fail
while(status != WL_CONNECTED && status != WL_NO_SSID_AVAIL && status != WL_CONNECT_FAILED) {
delay(10);
status = WiFi.status();
}
I think that simply exiting the loop after a timeout hits would be sufficient - taking the latest status should be harmless and should allow the rest of the code to operate with the most recent information available.
An optional argument specifying a timeout would probably be a good way to implement this. Alternatively, a timeout could be set as member variable by the constructor.