Backport the nvs_api fix to release/v1.0.

This commit is contained in:
Shripad Deshpande
2023-10-30 00:49:04 +08:00
committed by Hrishikesh Dhayagude
parent dbaabc82e0
commit d2ad891d00
@@ -417,6 +417,8 @@ static esp_err_t erase_persistent_data(endpoint_t *endpoint)
if (err != ESP_OK) {
ESP_LOGE(TAG, "Error erasing partition: %s, %d", nvs_namespace, err);
}
nvs_commit(handle);
nvs_close(handle);
return err;
}
@@ -993,6 +995,9 @@ esp_err_t factory_reset()
nvs_erase_all(node_handle);
}
nvs_close(node_handle);
nvs_commit(node_handle);
endpoint_t *endpoint = endpoint::get_first(node);
while (endpoint) {
err = endpoint::erase_persistent_data(endpoint);