/** * @file splash_screen.c * @brief Splash screen implementation for LVGL * * Displays the company logo on startup for a configured duration. * The implementation creates a temporary screen, renders the logo, * and then cleans up to prepare for the main application UI. */ #include "ui/splash_screen.h" #include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "lvgl.h" #include "ui/assets/splash_screen/logo_iro.h" static const char *TAG = "splash_screen"; // ---------------------------------------------------------------------------- // Public API Implementation // ---------------------------------------------------------------------------- void splashScreenShow(void) { ESP_LOGI(TAG, "Showing splash screen"); // Create a temporary screen for the splash lv_obj_t *splashScreen = lv_obj_create(NULL); lv_obj_set_style_bg_color(splashScreen, lv_color_black(), LV_PART_MAIN | LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(splashScreen, LV_OPA_COVER, LV_PART_MAIN | LV_STATE_DEFAULT); // Create and center the logo image lv_obj_t *logoImage = lv_img_create(splashScreen); lv_img_set_src(logoImage, &logoIro); lv_obj_center(logoImage); // Activate the splash screen lv_scr_load(splashScreen); lv_refr_now(NULL); ESP_LOGI(TAG, "Splash screen displayed, waiting %d ms", SPLASH_SCREEN_DURATION_MS); // Block for the display duration vTaskDelay(pdMS_TO_TICKS(SPLASH_SCREEN_DURATION_MS)); // Clean up the logo image before transitioning lv_obj_del(logoImage); ESP_LOGI(TAG, "Splash screen complete"); }