#include "esp_log.h" #include "nvs_flash.h" #include "board_config.h" #include "display.h" #include "lvgl_port.h" #include "touch.h" #include "ui.h" #include "ui_handlers.h" #include "ble_manager.h" #if BOARD_WIFI_ENABLED #include "wifi_manager.h" #endif static const char *TAG = "app"; void app_main(void) { esp_log_level_set("*", ESP_LOG_INFO); 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_lcd_panel_io_handle_t io_handle = NULL; esp_lcd_panel_handle_t panel_handle = NULL; ESP_ERROR_CHECK(display_init(&io_handle, &panel_handle)); lv_display_t *display = lvgl_port_init(io_handle, panel_handle); #if BOARD_TOUCH_ENABLED ESP_ERROR_CHECK(touch_init(display)); #endif lvgl_port_lock(); ui_init(); lvgl_port_unlock(); ui_handlers_init(); #if BOARD_WIFI_ENABLED ESP_LOGI(TAG, "Starting WiFi"); wifi_manager_init(); #endif ESP_LOGI(TAG, "Starting BLE"); ble_manager_init(); }