-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Redesign ESP8266WiFiMulti.[cpp|h] #7619
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
Conversation
Regression test 1: #include <ESP8266WiFiMulti.h>
ESP8266WiFiMulti wifiMulti;
void setup()
{
Serial.begin(115200);
WiFi.mode(WIFI_STA);
// Set incorrect WiFi password of best RSSI WiFi (close to the ESP8266)
wifiMulti.addAP("MySSID1", "wrong_password");
// Set correct WiFi password second WiFi (further away weaker signal)
wifiMulti.addAP("MySSID2", "correct_password");
Serial.println("Connecting Wifi...");
if (wifiMulti.run() == WL_CONNECTED) {
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
}
void loop()
{
if (wifiMulti.run() != WL_CONNECTED) {
Serial.println("WiFi not connected!");
delay(1000);
}
} Before fix: After fix: Regression test 2: A scan completed may not be returned from Before fix: After fix: Regression test 3: Connect to a WiFi network with the example. After a successful connection, press the reset button. Before fix: After fix: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall good work, but requires some smoothing.
@devyte I've resolved most of your requests and squashed it. The build passed and looks like ready to merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor change, then I'm good.
Fixed critical issues WiFiMulti library: - WiFi scan timeout implemented to prevent endless connect loop - Fallback implemented on WiFi connect failure to prevent endless loop - Fast WiFi connection at startup - Improved debug prints - Doxygen added - Code maturing - Example update Make functions not related to ESP8266WiFiMulti class static Revert static functions startScan and printWiFiScan() Use PolledTimeout.h to protect while loops Move static functions beginning of the file Add connect timeout to example
@devyte Completed and build passed. After 24 hours burn-in with random connects/disconnects to several WiFi access points everything works stable, including I noticed that the default 5000ms WiFi connect timeout may be too short when the distance between ESP8266 is far away from the AP, or the AP is busy. So I've included the variable Do you want me to include documentation in |
Yes please, (real) doc additions/updates are welcome! |
Ok, I see multiple items to be fixed in the documentation. I'll create a new pull request for it in a few days. Stay tuned and thanks for your review. |
In that case, I'm merging this as-is. |
@Erriez You did good work here. There are additional things pending for Multi, would you be interested in taking it further? |
Thanks! Well, I've 100% code understand now. Can you point me to some issues to look at? |
Great! Let's discuss in our gitter channel, so that we don't go offtopic here. Just @ devyte in there and I'll see it. |
Fixed critical issues WiFiMulti library:
The API is identical.