WPA2 connection fix (significant improvement to connection time) (#2989)

* Config fix test

* Also force config even if equal
This commit is contained in:
boarchuz 2019-07-17 00:12:20 +10:00 committed by Me No Dev
parent 7dbda4988b
commit c17b212cd0

View File

@ -162,6 +162,8 @@ wl_status_t WiFiSTAClass::begin(const char* ssid, const char *passphrase, int32_
esp_wifi_set_config(WIFI_IF_STA, &conf);
} else if(status() == WL_CONNECTED){
return WL_CONNECTED;
} else {
esp_wifi_set_config(WIFI_IF_STA, &conf);
}
if(!_useStaticIp) {
@ -198,6 +200,12 @@ wl_status_t WiFiSTAClass::begin()
return WL_CONNECT_FAILED;
}
wifi_config_t current_conf;
if(esp_wifi_get_config(WIFI_IF_STA, &current_conf) != ESP_OK || esp_wifi_set_config(WIFI_IF_STA, &current_conf) != ESP_OK) {
log_e("config failed");
return WL_CONNECT_FAILED;
}
if(!_useStaticIp) {
if(tcpip_adapter_dhcpc_start(TCPIP_ADAPTER_IF_STA) == ESP_ERR_TCPIP_ADAPTER_DHCPC_START_FAILED){
log_e("dhcp client start failed!");