First Ethernet activation
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user