Description
What MCU/Processor/Board and compiler are you using?
I am running on a ESP32 S3 DevKit C board with Arduino Framework.
As IDE I am using PlatformIO.
What LVGL version are you using?
v9
What do you want to achieve?
I am trying to get familiar with LVGL and started a small test project.
I am using TFT_eSPI as driver with my SPI connected display. The display is using ST7789.
I want to draw a simple label in the middle of the active screen. The screen is white, that’s why I think lvl is working. In addition I see a label, but it has always the value “text” and it’s always in the upper left corner.
What have you tried so far?
I tried adding different widgets. It seems that only the first widget drawn, is actually shown.
But the behaviour is identical for all widgets - always on the upper left corner.
Code to reproduce
The code block(s) should be formatted like:
void begin()
{
lv_init();
uint8_t draw_buf[DRAW_BUF_SIZE];
display = lv_tft_espi_create(TFT_HOR_RES, TFT_VER_RES, draw_buf, DRAW_BUF_SIZE);
TFT_eSPI *tft = (TFT_eSPI *)lv_display_get_driver_data(display);
tft->invertDisplay(0);
xTaskCreate(tick, "tick", 3000, NULL, 1, NULL);
xTaskCreate(timer, "disp", 10000, NULL, 1, NULL);
lv_obj_t *label = lv_label_create(lv_scr_act());
lv_label_set_text(label, "Hello Arduino, I'm LVGL!");
lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
lv_obj_t *slider = lv_slider_create(lv_scr_act());
lv_slider_set_range(slider, 0, 100);
lv_obj_set_pos(slider, 20, 100);
lv_obj_set_width(slider, 150);
}
void timer(void *ctx)
{
while (1)
{
lv_timer_handler();
vTaskDelay(20 / portTICK_PERIOD_MS);
}
}
void tick(void *ctx)
{
while (1)
{
lv_tick_inc(5);
vTaskDelay(5 / portTICK_PERIOD_MS);
}
}
Screenshot and/or video
The above code does produce this output.