nvs_flash: Version compatibility check for nvs storage

This change adds a check for compatibility between the nvs version
found on nvs flash and the one assumed by running code during nvs
initialization. Any mismatch is reported to the user using new error
code ESP_ERR_NVS_NEW_VERSION_FOUND.
This commit is contained in:
Sagar Bijwe
2018-07-25 20:41:09 +05:30
committed by bot
parent 8ef7a49cc3
commit 1df85e0039
45 changed files with 86 additions and 47 deletions

View File

@@ -83,8 +83,8 @@ TEST_CASE("wifi stop and deinit","[wifi]")
//init nvs
ESP_LOGI(TAG, EMPH_STR("nvs_flash_init"));
esp_err_t r = nvs_flash_init();
if (r == ESP_ERR_NVS_NO_FREE_PAGES) {
ESP_LOGI(TAG, EMPH_STR("no free pages, erase.."));
if (r == ESP_ERR_NVS_NO_FREE_PAGES || r == ESP_ERR_NVS_NEW_VERSION_FOUND) {
ESP_LOGI(TAG, EMPH_STR("no free pages or nvs version mismatch, erase.."));
TEST_ESP_OK(nvs_flash_erase());
r = nvs_flash_init();
}