From 9fd3822cc6cb0a1f5dff5da0d8e36319c5dfc905 Mon Sep 17 00:00:00 2001 From: shripad621git Date: Fri, 15 Sep 2023 06:15:24 +0530 Subject: [PATCH] Add the nvs commit and close calls in factory_reset and erase_persistent_data. --- 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 44055c237..43e6ced45 100644 --- a/components/esp_matter/esp_matter_core.cpp +++ b/components/esp_matter/esp_matter_core.cpp @@ -430,6 +430,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; } @@ -1041,6 +1043,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);