WPA2 connection fix (significant improvement to connection time) (#2989)
* Config fix test * Also force config even if equal
This commit is contained in:
parent
7dbda4988b
commit
c17b212cd0
@ -162,6 +162,8 @@ wl_status_t WiFiSTAClass::begin(const char* ssid, const char *passphrase, int32_
|
|||||||
esp_wifi_set_config(WIFI_IF_STA, &conf);
|
esp_wifi_set_config(WIFI_IF_STA, &conf);
|
||||||
} else if(status() == WL_CONNECTED){
|
} else if(status() == WL_CONNECTED){
|
||||||
return WL_CONNECTED;
|
return WL_CONNECTED;
|
||||||
|
} else {
|
||||||
|
esp_wifi_set_config(WIFI_IF_STA, &conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!_useStaticIp) {
|
if(!_useStaticIp) {
|
||||||
@ -198,6 +200,12 @@ wl_status_t WiFiSTAClass::begin()
|
|||||||
return WL_CONNECT_FAILED;
|
return WL_CONNECT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wifi_config_t current_conf;
|
||||||
|
if(esp_wifi_get_config(WIFI_IF_STA, ¤t_conf) != ESP_OK || esp_wifi_set_config(WIFI_IF_STA, ¤t_conf) != ESP_OK) {
|
||||||
|
log_e("config failed");
|
||||||
|
return WL_CONNECT_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
if(!_useStaticIp) {
|
if(!_useStaticIp) {
|
||||||
if(tcpip_adapter_dhcpc_start(TCPIP_ADAPTER_IF_STA) == ESP_ERR_TCPIP_ADAPTER_DHCPC_START_FAILED){
|
if(tcpip_adapter_dhcpc_start(TCPIP_ADAPTER_IF_STA) == ESP_ERR_TCPIP_ADAPTER_DHCPC_START_FAILED){
|
||||||
log_e("dhcp client start failed!");
|
log_e("dhcp client start failed!");
|
||||||
|
Loading…
Reference in New Issue
Block a user