Add config factory reset

Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
This commit is contained in:
2025-09-24 10:33:22 +09:00
parent 557646916d
commit 0c2b4ac07e
2 changed files with 14 additions and 0 deletions

View File

@@ -45,6 +45,11 @@ enum nconfig_type
NCONFIG_TYPE_MAX, ///< Sentinel for the maximum number of configuration types.
};
/**
* @brief Erase all of nvs data and restart system
*/
void reset_nconfig();
/**
* @brief Checks if a specific configuration value has been set.
*

View File

@@ -4,6 +4,8 @@
#include "nconfig.h"
#include "indicator.h"
#include "system.h"
#include "esp_err.h"
#include "nvs_flash.h"
@@ -70,6 +72,13 @@ esp_err_t init_nconfig()
return ESP_OK;
}
void reset_nconfig()
{
nvs_erase_all(handle);
led_set(LED_RED, BLINK_FAST);
start_reboot_timer(1);
}
bool nconfig_value_is_not_set(enum nconfig_type type)
{
size_t len = 0;