From d2ad891d0057665e59d3e098b0749fbef66fd3d4 Mon Sep 17 00:00:00 2001 From: Shripad Deshpande Date: Mon, 30 Oct 2023 00:49:04 +0800 Subject: [PATCH] Backport the nvs_api fix to release/v1.0. --- components/esp_matter/esp_matter_core.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/esp_matter/esp_matter_core.cpp b/components/esp_matter/esp_matter_core.cpp index 4b0c3df17..139241ce4 100644 --- a/components/esp_matter/esp_matter_core.cpp +++ b/components/esp_matter/esp_matter_core.cpp @@ -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);