Does anyone have an example of how to use the wifi persistence to nvs?

cmorgan
Posts: 89
Joined: Thu Aug 24, 2017 12:52 am

Does anyone have an example of how to use the wifi persistence to nvs?

Postby cmorgan » Wed Oct 18, 2017 3:40 pm

Hello.

I have an esp-idf project that makes use of wifi, ap+sta mode. I'm looking to go from a hardcoded approach to making use of nvs.

Looking at the api, http://esp-idf.readthedocs.io/en/v2.1/a ... _wifi.html, I don't see a way to determine if a configuration was loaded from nvs. I'm also not sure how one determines if the nvs isn't valid in order to either set default values or otherwise provide some indication to the end user that the settings need to be set.

It would be helpful to see an example in esp-idf. I've looked but didn't see one.

Can anyone else help provide some guidance or info on how to best use wifi configurations with nvs?

Thanks,
Chris

cmorgan
Posts: 89
Joined: Thu Aug 24, 2017 12:52 am

Re: Does anyone have an example of how to use the wifi persistence to nvs?

Postby cmorgan » Thu Oct 19, 2017 1:22 am

Some results from testing:

- Calling esp_wifi_set_config() appears to result in the nvs (non-volatile storage) being updated with the new settings
- There is no requirement to set the wifi configuration before calling esp_wifi_start()
- The wifi code appears to handle an erased nvs well. After calling 'make erase_flash' the STA settings were empty but the AP ssid was ESP_03AD31 (03AD31 is the last portion of the AP mac address). The AP password is empty.

Hope this can help the next person with similar questions.

Who is online

Users browsing this forum: No registered users and 108 guests