1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

BREAKING: Add Wrong Password wifi status case (#7652)

* Add Wrong Password wifi status case
* Add wrong password case for status return
* Add wrong password case for debug
* Add Wrong password case to interactive example
* Add case for wrong password to station doc
* Add case for wrong password to resumeFromShutdown
* Add wrong password case to wifi readme
* Update ESP8266WiFiGeneric.cpp
This commit is contained in:
Develo 2020-10-15 13:52:17 -03:00 committed by GitHub
parent 79ea883fb3
commit 1c624dd76a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 23 additions and 9 deletions

View File

@ -260,8 +260,9 @@ This function returns following codes to describe what is going on with Wi-Fi co
* 0 : ``WL_IDLE_STATUS`` when Wi-Fi is in process of changing between statuses
* 1 : ``WL_NO_SSID_AVAIL``\ in case configured SSID cannot be reached
* 3 : ``WL_CONNECTED`` after successful connection is established
* 4 : ``WL_CONNECT_FAILED`` if password is incorrect
* 6 : ``WL_DISCONNECTED`` if module is not configured in station mode
* 4 : ``WL_CONNECT_FAILED`` if connection failed
* 6 : ``WL_CONNECT_WRONG_PASSWORD`` if password is incorrect
* 7 : ``WL_DISCONNECTED`` if module is not configured in station mode
It is a good practice to display and check information returned by functions. Application development and troubleshooting will be easier with that.

View File

@ -250,8 +250,9 @@ Wait until module connects to the access point. This function is intended for mo
Function returns one of the following connection statuses:
- ``WL_CONNECTED`` after successful connection is established
- ``WL_NO_SSID_AVAIL`` in case configured SSID cannot be reached
- ``WL_CONNECT_FAILED`` if password is incorrect
- ``WL_NO_SSID_AVAIL`` in case configured SSID cannot be reached
- ``WL_CONNECT_FAILED`` if connection failed
- ``WL_CONNECT_WRONG_PASSWORD`` if password is incorrect
- ``WL_IDLE_STATUS`` when Wi-Fi is in process of changing between statuses
- ``WL_DISCONNECTED`` if module is not configured in station mode
- ``-1`` on timeout

View File

@ -827,15 +827,21 @@ bool ESP8266WiFiGenericClass::resumeFromShutdown (WiFiState* state)
}
}
// state->state.fwconfig.bssid is not real bssid (it's what user may have provided when bssid_set==1)
if (WiFi.begin((const char*)state->state.fwconfig.ssid,
auto beginResult = WiFi.begin((const char*)state->state.fwconfig.ssid,
(const char*)state->state.fwconfig.password,
state->state.channel,
nullptr/*(const uint8_t*)state->state.fwconfig.bssid*/, // <- try with gw's mac address?
true) == WL_CONNECT_FAILED)
true);
if (beginResult == WL_CONNECT_FAILED)
{
DEBUG_WIFI("core: resume: WiFi.begin failed\n");
return false;
}
if (beginResult == WL_WRONG_PASSWORD)
{
DEBUG_WIFI("core: resume: WiFi.begin wrong password\n");
return false;
}
}
if (state->state.mode & WIFI_AP)

View File

@ -60,6 +60,9 @@ static void printWiFiStatus(wl_status_t status)
case WL_CONNECT_FAILED:
DEBUG_WIFI_MULTI("[WIFIM] Connecting failed.\n");
break;
case WL_WRONG_PASSWORD:
DEBUG_WIFI_MULTI("[WIFIM] Wrong password.\n");
break;
default:
DEBUG_WIFI_MULTI("[WIFIM] Connecting failed (%d).\n", status);
break;

View File

@ -624,8 +624,9 @@ wl_status_t ESP8266WiFiSTAClass::status() {
case STATION_NO_AP_FOUND:
return WL_NO_SSID_AVAIL;
case STATION_CONNECT_FAIL:
case STATION_WRONG_PASSWORD:
return WL_CONNECT_FAILED;
case STATION_WRONG_PASSWORD:
return WL_WRONG_PASSWORD;
case STATION_IDLE:
return WL_IDLE_STATUS;
default:

View File

@ -55,7 +55,8 @@ typedef enum {
WL_CONNECTED = 3,
WL_CONNECT_FAILED = 4,
WL_CONNECTION_LOST = 5,
WL_DISCONNECTED = 6
WL_WRONG_PASSWORD = 6,
WL_DISCONNECTED = 7
} wl_status_t;
/* Encryption modes */

View File

@ -42,7 +42,8 @@ void setup() {
"WL_CONNECTED = 3\n"
"WL_CONNECT_FAILED = 4\n"
"WL_CONNECTION_LOST = 5\n"
"WL_DISCONNECTED = 6\n"
"WL_WRONG_PASSWORD = 6\n"
"WL_DISCONNECTED = 7\n"
);
}