diff -r 64886971967b -r 31f9d3e4a85f main/brewboard.c --- a/main/brewboard.c Mon Feb 19 15:07:28 2024 +0100 +++ b/main/brewboard.c Mon Jun 24 17:05:20 2024 +0200 @@ -19,6 +19,9 @@ extern SemaphoreHandle_t xSemaphoreWiFi; extern WIFI_State *wifi_state; +extern my_config_t config; + + int Main_Screen = MAIN_MODE_UNKNOWN; ///< Screen number int Old_Screen = MAIN_MODE_UNKNOWN; ///< Previous screen number int Sub_Screen = 0; ///< Subscreen during mash @@ -30,6 +33,7 @@ { int tempy; char temp[64]; + esp_err_t ret; ESP_LOGI(TAG, "Starting"); init_tft_display(); @@ -37,10 +41,20 @@ TFT_setFont(DEJAVU24_FONT, NULL); _fg = TFT_YELLOW; tempy = TFT_getfontheight() + 4; - app_desc = esp_ota_get_app_description(); + app_desc = esp_app_get_description(); sprintf(temp, "BrewBoard %s", app_desc->version); TFT_print(temp, CENTER, 4); + /* + * Initialize NVS + */ + 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); + TFT_setFont(DEJAVU18_FONT, NULL); _fg = TFT_CYAN; TFT_print((char *)"Mount /spiffs ", 0, LASTY+tempy); @@ -52,10 +66,12 @@ .max_files = 5, .format_if_mount_failed = true }; - - // Use settings defined above to initialize and mount SPIFFS filesystem. - // Note: esp_vfs_spiffs_register is an all-in-one convenience function. - esp_err_t ret = esp_vfs_spiffs_register(&conf); + + /* + * Use settings defined above to initialize and mount SPIFFS filesystem. + * Note: esp_vfs_spiffs_register is an all-in-one convenience function. + */ + ret = esp_vfs_spiffs_register(&conf); if (ret != ESP_OK) { if (ret == ESP_FAIL) {