How do I determine whether WIFI SSID and others config has been configured

LanFly
Posts: 2
Joined: Mon Jul 22, 2019 2:50 pm

How do I determine whether WIFI SSID and others config has been configured

Postby LanFly » Sun Aug 07, 2022 2:50 pm

I use the esp_wifi_get_config() function to read the configuration, but how do I determine whether the SSID has been configured ?

If not configured, I need to jump to the settings page.

cruvus
Posts: 59
Joined: Fri Jul 08, 2022 5:08 pm
Location: Planet Earth

Re: How do I determine whether WIFI SSID and others config has been configured

Postby cruvus » Mon Aug 08, 2022 4:55 pm

I use

if (config.sta.ssid[0]) [...]

to check if the string is empty. I don't know if there is a better or official way. On the ESP8266 there was wifi_station_get_ap_info() which returned the number of stored credentials. BTW, compared to the ESP8266 there are more APIs missing, for example wifi_station_get_connect_status() which is really bad. It's the function I miss the most.
ESP32 / ESP-IDF 5.1.4


Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 203 guests