LVGL Editor UI Not Displaying on Elecrow EPD (ESP32, LVGL 9.2.0) – How to Fix It?

Description

I created a test UI using the LVGL Editor. I want to call it from main.cpp.
The code compiles and uploads successfully, but nothing shows on the display. How to fix the issue ?

I tested the LVGL Hello World example, and it worked fine, it shows on the display.

Board: Elecrow CrowPanel ESP32 5.79”

LVGL Version: 9.2.0

Code to reproduce

#include <Arduino.h>
#include <SPI.h>
#include "EPD.h"
#include "EPD_Init.h"
#include "lvgl_setup.h"
#include "../lib/Test/ui.h"

void setup() {
.
.
    // Initialize LVGL
    lvgl_init();

    // Initialize UI (generated by LVGL GUI Builder)
    ui_init(""); 
.
.

Full code

#include <Arduino.h>
#include <SPI.h>
#include "EPD.h"
#include "EPD_Init.h"
#include "lvgl_setup.h"

#include "../lib/Test/ui.h"

// Buffer for the EPD 
uint8_t ImageBW[27200];

void create_hello_world_ui(); // Forward declaration for the UI creation function

void setup() {
    Serial.begin(115200);
    Serial.println("EPD LVGL Hello World Starting...");
    
    // Initialize EPD control pin (following factory demo)
    pinMode(7, OUTPUT);
    digitalWrite(7, HIGH);
    
    // Initialize EPD hardware
    EPD_GPIOInit();
    Paint_NewImage(ImageBW, EPD_W, EPD_H, Rotation, WHITE);
    Paint_Clear(WHITE);
    
    // Fast mode initialization
    EPD_FastMode1Init();
    EPD_Display_Clear();
    EPD_Update();
    
    Serial.println("EPD initialized, starting LVGL...");
    
    // Initialize LVGL
    lvgl_init();

    // Initialize UI (generated by LVGL GUI Builder)
    ui_init(""); 

    // Create the UI
    // create_hello_world_ui();
    
    // Force LVGL to render
    lv_timer_handler();
    delay(10);
    
    Serial.println("Updating display...");
    
    // Re-initialize for display
    EPD_GPIOInit();
    EPD_FastMode1Init();
    
    // Display the rendered content
    EPD_Display(ImageBW);
    EPD_FastUpdate();  // Use FastUpdate
    
    // Put display to sleep
    EPD_DeepSleep();
    
    Serial.println("Display update complete!");
}

void loop() {
    // Static display - no updates needed
    delay(1000);
}

void create_hello_world_ui() {
    // Get the active screen
    lv_obj_t *scr = lv_display_get_screen_active(epd_display);
    
    // Clear screen to white
    lv_obj_set_style_bg_color(scr, lv_color_white(), LV_PART_MAIN);
    lv_obj_set_style_bg_opa(scr, LV_OPA_COVER, LV_PART_MAIN);
    
    // Create a label for "Hello World"
    lv_obj_t *hello_label = lv_label_create(scr);
    lv_label_set_text(hello_label, "Hello World!");
    
    // Style the label
    lv_obj_set_style_text_color(hello_label, lv_color_black(), LV_PART_MAIN);
    lv_obj_set_style_text_font(hello_label, &lv_font_montserrat_32, LV_PART_MAIN);
    
    // Center the label on screen
    lv_obj_align(hello_label, LV_ALIGN_CENTER, 0, -50);
    
    // Create a second label with additional info
    lv_obj_t *info_label = lv_label_create(scr);
    lv_label_set_text(info_label, "LVGL on E-Paper");
    
    // Style the info label
    lv_obj_set_style_text_color(info_label, lv_color_black(), LV_PART_MAIN);
    lv_obj_set_style_text_font(info_label, &lv_font_montserrat_16, LV_PART_MAIN);
    
    // Position below the main label
    lv_obj_align(info_label, LV_ALIGN_CENTER, 0, 0);
}


Screenshot and/or video


Thank you.

Currently, the ui_init("") function does not call any screen initialization or screen loading functions. You need to call them manually

   // Initialize UI (generated by LVGL GUI Builder)
   ui_init(""); 
   lv_obj_t * screen = screen_create();
   lv_screen_load(screen);
1 Like

Thank you :hugs:, it works!

I have one more question. Right now, all the headers are like #include "lvgl/lvgl.h". Is there an easy way to change it in all files to #include "lvgl.h"?