ESP32 Arduino WiFi: misc bug fixes (#6470)

This commit is contained in:
Faidon Liambotis 2024-04-04 02:55:24 +03:00 committed by GitHub
parent 5cc3d60fee
commit f09bfa7311
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -582,14 +582,14 @@ void WiFiComponent::wifi_pre_setup_() {
} }
WiFiSTAConnectStatus WiFiComponent::wifi_sta_connect_status_() { WiFiSTAConnectStatus WiFiComponent::wifi_sta_connect_status_() {
auto status = WiFiClass::status(); auto status = WiFiClass::status();
if (status == WL_CONNECTED) { if (status == WL_CONNECT_FAILED || status == WL_CONNECTION_LOST) {
return WiFiSTAConnectStatus::CONNECTED;
} else if (status == WL_CONNECT_FAILED || status == WL_CONNECTION_LOST) {
return WiFiSTAConnectStatus::ERROR_CONNECT_FAILED; return WiFiSTAConnectStatus::ERROR_CONNECT_FAILED;
} else if (status == WL_NO_SSID_AVAIL) { } else if (status == WL_NO_SSID_AVAIL) {
return WiFiSTAConnectStatus::ERROR_NETWORK_NOT_FOUND; return WiFiSTAConnectStatus::ERROR_NETWORK_NOT_FOUND;
} else if (s_sta_connecting) { } else if (s_sta_connecting) {
return WiFiSTAConnectStatus::CONNECTING; return WiFiSTAConnectStatus::CONNECTING;
} else if (status == WL_CONNECTED) {
return WiFiSTAConnectStatus::CONNECTED;
} }
return WiFiSTAConnectStatus::IDLE; return WiFiSTAConnectStatus::IDLE;
} }
@ -707,7 +707,7 @@ bool WiFiComponent::wifi_start_ap_(const WiFiAP &ap) {
*conf.ap.password = 0; *conf.ap.password = 0;
} else { } else {
conf.ap.authmode = WIFI_AUTH_WPA2_PSK; conf.ap.authmode = WIFI_AUTH_WPA2_PSK;
strncpy(reinterpret_cast<char *>(conf.ap.password), ap.get_password().c_str(), sizeof(conf.ap.ssid)); strncpy(reinterpret_cast<char *>(conf.ap.password), ap.get_password().c_str(), sizeof(conf.ap.password));
} }
conf.ap.pairwise_cipher = WIFI_CIPHER_TYPE_CCMP; conf.ap.pairwise_cipher = WIFI_CIPHER_TYPE_CCMP;