First Ethernet activation

This commit is contained in:
2024-08-17 17:19:47 +02:00
parent 0d90973842
commit d5dc6dae46
10 changed files with 216 additions and 35 deletions

View File

@ -2,6 +2,7 @@
#include "storage.h"
#include "nvs_flash.h"
#include "nvs.h"
#include "esp_log.h"
#include <string.h>
#define STORAGE_NAMESPACE "storage"
@ -9,12 +10,14 @@
#define DEV_NAME_KEY "dev_name"
#define PRIVATE_KEY "prikey"
static const char *TAG = "storage";
bool storage_init()
{
esp_err_t err = nvs_flash_init();
if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND)
{
printf("Need to reset storage\n");
ESP_LOGI(TAG, "Need to reset storage\n");
// NVS partition was truncated and needs to be erased
// Retry nvs_flash_init