Skip to content

ESP8266WiFiMulti needs a timeout mechanism #3014

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gavanfantom opened this issue Mar 2, 2017 · 1 comment
Closed

ESP8266WiFiMulti needs a timeout mechanism #3014

gavanfantom opened this issue Mar 2, 2017 · 1 comment

Comments

@gavanfantom
Copy link

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.

@devyte
Copy link
Collaborator

devyte commented Jan 12, 2018

Closing as duplicate of #3993 .

@devyte devyte closed this as completed Jan 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants