Create system_utils component
Somewhat of a 'misc' component; handles early initialization, checking for first boot and rebooting.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user