19 lines
400 B
C
19 lines
400 B
C
|
#pragma once
|
||
|
|
||
|
#include <stdio.h>
|
||
|
|
||
|
#include "esp_system.h"
|
||
|
#include "freertos/FreeRTOS.h"
|
||
|
#include "freertos/task.h"
|
||
|
#include "nvs.h"
|
||
|
#include "nvs_flash.h"
|
||
|
|
||
|
void app_nvs_init() {
|
||
|
esp_err_t err = nvs_flash_init();
|
||
|
if (err == ESP_ERR_NVS_NO_FREE_PAGES ||
|
||
|
err == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
||
|
ESP_ERROR_CHECK(nvs_flash_erase());
|
||
|
err = nvs_flash_init();
|
||
|
}
|
||
|
ESP_ERROR_CHECK(err);
|
||
|
}
|