mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
Fix issue when WiFi.begin(ssid, pass) is called right after WiFi.mode(WIFI_OFF)
If ssid and pass matched the values in flash, wifi_station_connect was not called and no connection was attempted
This commit is contained in:
parent
a14ac2cbdd
commit
b4490cd76d
@ -134,26 +134,28 @@ wl_status_t ESP8266WiFiSTAClass::begin(const char* ssid, const char *passphrase,
|
|||||||
wifi_station_get_config(¤t_conf);
|
wifi_station_get_config(¤t_conf);
|
||||||
if(sta_config_equal(current_conf, conf)) {
|
if(sta_config_equal(current_conf, conf)) {
|
||||||
DEBUGV("sta config unchanged");
|
DEBUGV("sta config unchanged");
|
||||||
return status();
|
}
|
||||||
|
else {
|
||||||
|
ETS_UART_INTR_DISABLE();
|
||||||
|
|
||||||
|
if(WiFi._persistent) {
|
||||||
|
// workaround for #1997: make sure the value of ap_number is updated and written to flash
|
||||||
|
// to be removed after SDK update
|
||||||
|
wifi_station_ap_number_set(2);
|
||||||
|
wifi_station_ap_number_set(1);
|
||||||
|
|
||||||
|
wifi_station_set_config(&conf);
|
||||||
|
} else {
|
||||||
|
wifi_station_set_config_current(&conf);
|
||||||
|
}
|
||||||
|
|
||||||
|
ETS_UART_INTR_ENABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
ETS_UART_INTR_DISABLE();
|
ETS_UART_INTR_DISABLE();
|
||||||
|
|
||||||
if(WiFi._persistent) {
|
|
||||||
// workaround for #1997: make sure the value of ap_number is updated and written to flash
|
|
||||||
// to be removed after SDK update
|
|
||||||
wifi_station_ap_number_set(2);
|
|
||||||
wifi_station_ap_number_set(1);
|
|
||||||
|
|
||||||
wifi_station_set_config(&conf);
|
|
||||||
} else {
|
|
||||||
wifi_station_set_config_current(&conf);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(connect) {
|
if(connect) {
|
||||||
wifi_station_connect();
|
wifi_station_connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
ETS_UART_INTR_ENABLE();
|
ETS_UART_INTR_ENABLE();
|
||||||
|
|
||||||
if(channel > 0 && channel <= 13) {
|
if(channel > 0 && channel <= 13) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user