1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +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:
Ivan Grokhotkov 2016-06-14 13:07:08 +08:00
parent a14ac2cbdd
commit b4490cd76d

View File

@ -134,26 +134,28 @@ wl_status_t ESP8266WiFiSTAClass::begin(const char* ssid, const char *passphrase,
wifi_station_get_config(&current_conf);
if(sta_config_equal(current_conf, conf)) {
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();
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) {
wifi_station_connect();
}
ETS_UART_INTR_ENABLE();
if(channel > 0 && channel <= 13) {