Commit c17b212c authored by boarchuz's avatar boarchuz Committed by Me No Dev

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

* Config fix test

* Also force config even if equal
parent 7dbda498
......@@ -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!");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment