Skip to content

Commit dcec73e

Browse files
committed
Fix WiFi.SSID() returning an empty string.
espressif/arduino-esp32#1743
1 parent ceced9f commit dcec73e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

libraries/WiFi/src/WiFiSTA.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,11 @@ String WiFiSTAClass::SSID() const
453453
wifi_ap_record_t info;
454454
if(!esp_wifi_sta_get_ap_info(&info)) {
455455
return String(reinterpret_cast<char*>(info.ssid));
456+
} else{
457+
wifi_config_t conf;
458+
if (!esp_wifi_get_config(WIFI_IF_STA, &conf)) {
459+
return String(reinterpret_cast<char*>(conf.sta.ssid));
460+
}
456461
}
457462
return String();
458463
}

0 commit comments

Comments
 (0)