File tree 7 files changed +23
-9
lines changed
esp8266/examples/interactive
7 files changed +23
-9
lines changed Original file line number Diff line number Diff line change @@ -260,8 +260,9 @@ This function returns following codes to describe what is going on with Wi-Fi co
260
260
* 0 : ``WL_IDLE_STATUS `` when Wi-Fi is in process of changing between statuses
261
261
* 1 : ``WL_NO_SSID_AVAIL ``\ in case configured SSID cannot be reached
262
262
* 3 : ``WL_CONNECTED `` after successful connection is established
263
- * 4 : ``WL_CONNECT_FAILED `` if password is incorrect
264
- * 6 : ``WL_DISCONNECTED `` if module is not configured in station mode
263
+ * 4 : ``WL_CONNECT_FAILED `` if connection failed
264
+ * 6 : ``WL_CONNECT_WRONG_PASSWORD `` if password is incorrect
265
+ * 7 : ``WL_DISCONNECTED `` if module is not configured in station mode
265
266
266
267
It is a good practice to display and check information returned by functions. Application development and troubleshooting will be easier with that.
267
268
Original file line number Diff line number Diff line change @@ -250,8 +250,9 @@ Wait until module connects to the access point. This function is intended for mo
250
250
Function returns one of the following connection statuses:
251
251
252
252
- ``WL_CONNECTED `` after successful connection is established
253
- - ``WL_NO_SSID_AVAIL `` in case configured SSID cannot be reached
254
- - ``WL_CONNECT_FAILED `` if password is incorrect
253
+ - ``WL_NO_SSID_AVAIL `` in case configured SSID cannot be reached
254
+ - ``WL_CONNECT_FAILED `` if connection failed
255
+ - ``WL_CONNECT_WRONG_PASSWORD `` if password is incorrect
255
256
- ``WL_IDLE_STATUS `` when Wi-Fi is in process of changing between statuses
256
257
- ``WL_DISCONNECTED `` if module is not configured in station mode
257
258
- ``-1 `` on timeout
Original file line number Diff line number Diff line change @@ -827,15 +827,21 @@ bool ESP8266WiFiGenericClass::resumeFromShutdown (WiFiState* state)
827
827
}
828
828
}
829
829
// state->state.fwconfig.bssid is not real bssid (it's what user may have provided when bssid_set==1)
830
- if ( WiFi.begin ((const char *)state->state .fwconfig .ssid ,
830
+ auto beginResult = WiFi.begin ((const char *)state->state .fwconfig .ssid ,
831
831
(const char *)state->state .fwconfig .password ,
832
832
state->state .channel ,
833
833
nullptr /* (const uint8_t*)state->state.fwconfig.bssid*/ , // <- try with gw's mac address?
834
- true ) == WL_CONNECT_FAILED)
834
+ true );
835
+ if (beginResult == WL_CONNECT_FAILED)
835
836
{
836
837
DEBUG_WIFI (" core: resume: WiFi.begin failed\n " );
837
838
return false ;
838
839
}
840
+ if (beginResult == WL_WRONG_PASSWORD)
841
+ {
842
+ DEBUG_WIFI (" core: resume: WiFi.begin wrong password\n " );
843
+ return false ;
844
+ }
839
845
}
840
846
841
847
if (state->state .mode & WIFI_AP)
Original file line number Diff line number Diff line change @@ -60,6 +60,9 @@ static void printWiFiStatus(wl_status_t status)
60
60
case WL_CONNECT_FAILED:
61
61
DEBUG_WIFI_MULTI (" [WIFIM] Connecting failed.\n " );
62
62
break ;
63
+ case WL_WRONG_PASSWORD:
64
+ DEBUG_WIFI_MULTI (" [WIFIM] Wrong password.\n " );
65
+ break ;
63
66
default :
64
67
DEBUG_WIFI_MULTI (" [WIFIM] Connecting failed (%d).\n " , status);
65
68
break ;
Original file line number Diff line number Diff line change @@ -624,8 +624,9 @@ wl_status_t ESP8266WiFiSTAClass::status() {
624
624
case STATION_NO_AP_FOUND:
625
625
return WL_NO_SSID_AVAIL;
626
626
case STATION_CONNECT_FAIL:
627
- case STATION_WRONG_PASSWORD:
628
627
return WL_CONNECT_FAILED;
628
+ case STATION_WRONG_PASSWORD:
629
+ return WL_WRONG_PASSWORD;
629
630
case STATION_IDLE:
630
631
return WL_IDLE_STATUS;
631
632
default :
Original file line number Diff line number Diff line change @@ -55,7 +55,8 @@ typedef enum {
55
55
WL_CONNECTED = 3 ,
56
56
WL_CONNECT_FAILED = 4 ,
57
57
WL_CONNECTION_LOST = 5 ,
58
- WL_DISCONNECTED = 6
58
+ WL_WRONG_PASSWORD = 6 ,
59
+ WL_DISCONNECTED = 7
59
60
} wl_status_t ;
60
61
61
62
/* Encryption modes */
Original file line number Diff line number Diff line change @@ -42,7 +42,8 @@ void setup() {
42
42
" WL_CONNECTED = 3\n "
43
43
" WL_CONNECT_FAILED = 4\n "
44
44
" WL_CONNECTION_LOST = 5\n "
45
- " WL_DISCONNECTED = 6\n "
45
+ " WL_WRONG_PASSWORD = 6\n "
46
+ " WL_DISCONNECTED = 7\n "
46
47
);
47
48
}
48
49
You can’t perform that action at this time.
0 commit comments