#include #include "sdkconfig.h" /**/ #include "esp_log.h" #include "esp_system.h" /* FreeRTOS */ #include "freertos/FreeRTOS.h" #include "freertos/task.h" /* LVGL */ #include "lvgl.h" /* Private */ #include "app_lvgl.h" #define UI_WEATHER_TASK_HEAP 2048 #define APP_LOG_TAG "UI_WX" LV_FONT_DECLARE(noto_sans_96) LV_FONT_DECLARE(weather_icon_96) static void app_ui_weather_task(void *pvParameters); int app_ui_weather_init(void) { if (xTaskCreate(app_ui_weather_task, "UI_WX", UI_WEATHER_TASK_HEAP, NULL, 3, NULL) != pdPASS) { return -1; } ESP_LOGI(APP_LOG_TAG, "UI WX initialized."); return 0; } static void app_ui_weather_task(void *pvParameters) { lv_obj_t *main_label = NULL; if (app_lvgl_lock(portMAX_DELAY) == 0) { main_label = lv_label_create(lv_scr_act()); lv_label_set_text(main_label, "\U0000F052"); lv_obj_set_width(main_label, 960); lv_obj_set_style_text_align(main_label, LV_TEXT_ALIGN_CENTER, 0); lv_obj_align(main_label, LV_ALIGN_CENTER, 0, 0); lv_obj_set_style_text_font(main_label, &weather_icon_96, 0); ESP_LOGI(APP_LOG_TAG, "UI label created"); app_lvgl_unlock(); } for (;;) { vTaskSuspend(NULL); } }