-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Closed
Description
Basic Infos
- This issue complies with the issue POLICY doc.
- I have read the documentation at readthedocs and the issue is not addressed there.
- I have tested that the issue is present in current master branch (aka latest git).
- I have searched the issue tracker for a similar issue.
- If there is a stack dump, I have decoded it.
- I have filled out all fields below.
Platform
- Hardware: [ESP8266]
- Core Version: [master]
- Development Env: [N.A.]
- Operating System: [N.A.]
Settings in IDE
N.A.
Problem Description
-
A missing WiFi scan completed results in endless connect loops
-
The
WiFiMulti
example does not connect to other registered networks on WiFi connection failure such as incorrect password.
Sketch
#include <ESP8266WiFiMulti.h>
ESP8266WiFiMulti wifiMulti;
void setup()
{
Serial.begin(115200);
WiFi.mode(WIFI_STA);
wifiMulti.addAP("MySSID1", "wrong_password");
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);
}
}
Debug Messages
[WIFI] Connecting BSSID: XX:XX:XX:XX:XX:XX SSID: MySSID1 Channel: 11 (-72)
[WIFI] Connecting Failed (6).
WiFi not connected!
[WIFI] delete old wifi config...
[WIFI] start scan
WiFi not connected!
WiFi not connected!
WiFi not connected!
[WIFI] scan done
[WIFI] 8 networks found
---> 0: [1][XX:XX:XX:XX:XX:XX] MySSID2 (-80) *
1: [1][XX:XX:XX:XX:XX:XX] XXXXXXXXXXX (-90) *
2: [1][XX:XX:XX:XX:XX:XX] XXXXXXXXX (-89) *
3: [1][XX:XX:XX:XX:XX:XX] XXXXXXXXXXX (-90) *
---> 4: [11][XX:XX:XX:XX:XX:XX] MySSID1 (-70) *
5: [3][XX:XX:XX:XX:XX:XX] XXXXXXXXXXX (-85) *
6: [11][XX:XX:XX:XX:XX:XX] XXXXXX (-70) *
7: [11][XX:XX:XX:XX:XX:XX] XXXXXXXXX (-94) *
[WIFI] Connecting BSSID: XX:XX:XX:XX:XX:XX SSID: MySSID1 Channel: 11 (-70)
[WIFI] Connecting Failed (6).
WiFi not connected!
[WIFI] delete old wifi config...
[WIFI] start scan
I've redesigned the complete library and created a pull request:
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
The API is identical.
Metadata
Metadata
Assignees
Labels
No labels