Create system_utils component

Somewhat of a 'misc' component; handles early initialization, checking
for first boot and rebooting.
This commit is contained in:
2023-05-19 16:05:27 +01:00
parent 9c9f027bb8
commit 685e0950bf
8 changed files with 120 additions and 18 deletions

View File

@@ -201,20 +201,6 @@ static int command_func(int argc, char **argv)
void settings_init()
{
esp_err_t error;
error = nvs_flash_init();
if (error == ESP_ERR_NVS_NO_FREE_PAGES
|| error == ESP_ERR_NVS_NEW_VERSION_FOUND) {
ESP_LOGI(TAG, "NVS partition full or outdated; erasing");
(void)nvs_flash_erase();
error = nvs_flash_init();
}
if (error != ESP_OK) {
ESP_LOGE(TAG, "Error initializing NVS store: %04x", error);
FATAL();
}
for (ItemIndex item = (ItemIndex)0; item < ITEM_COUNT; ++item) {
if (!load(item)) {
set(item, state[item].default_value);