Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nvs_flash_init Retry #11

Open
jorgeespinoza0x20 opened this issue Feb 14, 2019 · 0 comments
Open

Add nvs_flash_init Retry #11

jorgeespinoza0x20 opened this issue Feb 14, 2019 · 0 comments

Comments

@jorgeespinoza0x20
Copy link

In example esp-idf/examples/wifi/wps/main/wps.c, there is a retry if nvs_flash_init returns specific failure codes.

esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
    ESP_ERROR_CHECK(nvs_flash_erase());
    ret = nvs_flash_init();
}
ESP_ERROR_CHECK(ret);

I was really lucky to read a specific example that had the retry. Many of the other examples do not have the retry.

I asked about this retry as a best practice on the ESP32 forum. @igrr responded that the retry as above is the correct thing to do for a production code.

The source code for this template does not have the retry. If the template is a common starting point for writing production code then it would help if the retry was present in the template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant