diff --git a/main/main.c b/main/main.c --- a/main/main.c +++ b/main/main.c @@ -9,7 +9,7 @@ #include "esp_system.h" #include "esp_event.h" #include "esp_log.h" -#include "nvs_flash.h" +#include "flash.h" #include "sdkconfig.h" #include "osc_control.h" #include "wifi.h" @@ -24,7 +24,6 @@ // Private variables static const char *TAG = "main"; - // Application entry point void app_main(void) { @@ -32,12 +31,18 @@ void app_main(void) // usb_cdc_init(); // Initialize NVS - esp_err_t ret = nvs_flash_init(); - if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { - ESP_ERROR_CHECK(nvs_flash_erase()); - ret = nvs_flash_init(); - } - ESP_ERROR_CHECK(ret); + // esp_err_t ret = nvs_flash_init(); + // if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { + // ESP_ERROR_CHECK(nvs_flash_erase()); + // ret = nvs_flash_init(); + // } + // ESP_ERROR_CHECK(ret); + + flash_init(); + int32_t cnt = flash_read("count"); + cnt += 1; + flash_write("count", cnt); + // Initialize display display_init(); @@ -64,6 +69,8 @@ void app_main(void) while(1) { + // ESP_LOGI(TAG, "cnt=%ld\n", cnt); + vTaskDelay(pdMS_TO_TICKS(100)); }