WiFi Provisioning Manager bug

kaspernyhus
Posts: 22
Joined: Tue Mar 01, 2022 7:38 am

WiFi Provisioning Manager bug

Postby kaspernyhus » Thu Apr 27, 2023 1:36 pm

Hi,

I'm using the WiFi Provisioning Manager <wifi_provisioning/manager.h> using BLE and the esp prov app. The credentials are stored in nvs to be used for connecting to the same network later of course.

I have found the following regarding the credentials in nvs which might be a bug, but I'm not sure that I'm not doing anything wrong:

Some credentials already are in the nvs, but I want to start the provision manager to enable the user to connect to a different network if they so chooses. If the user doesn't enter any new credentials there is a timer that times out. I stop and deinit provisioning and I then want to try to connect to the network stored in the nvs BUT the credentials are now (temporarily) gone/unavailable until the device has been rebooted (meaning that they are indeed in flash).

The code I'm using to determining if there are credentials in nvs are taken from within the provisioning manager:

Code: Select all

/* Get Wi-Fi Station configuration */
    wifi_config_t wifi_cfg;
    if (esp_wifi_get_config(WIFI_IF_STA, &wifi_cfg) != ESP_OK) {
        return ESP_FAIL;
    }

    if (strlen((const char *) wifi_cfg.sta.ssid)) {
        *provisioned = true;
        debug_print_wifi_credentials(wifi_cfg.sta, "Found");
    }
I can see that the manager moves credentials from flash to ram, could this be the reason they are not available after provisioning has been stopped (without providing new) - and is this desired behavior?

Thanks a lot,
Kasper Nyhus

ESP_harshal
Posts: 24
Joined: Wed Jul 06, 2022 8:36 am

Re: WiFi Provisioning Manager bug

Postby ESP_harshal » Wed May 03, 2023 5:26 am

Hello @kaspernyhus,

Thank you for reporting the issue. This surely looks like a bug and we have started investigating it.
In the meantime, I would suggest you to reinitialize WiFi (esp_wifi_deinit() and esp_wifi_init()) after you stop and deinit provisioning. This will switch the storage back to NVS and the next esp_wifi_get_config() will return the credentials which were stored in the NVS.

Thank you!!

Who is online

Users browsing this forum: No registered users and 98 guests