The GUI design in EEZ studio looks like this below
But the result on TFT Display is looks like this
the lv_conf.h file settings are for the color depth,
#define LV_COLOR_DEPTH 16. But I have tried changing it to 24 and 32 but the result blurry and nothing can be read. What should be done to get the designed screen?
Thanks
Tinus
November 10, 2025, 10:56am
2
Hello,
It looks like the colors are swapped. You may have to reimplement the lv_flush_cb() function to swap the colors.
1 Like
where to start, where should I implement this callback function?
Tinus
November 11, 2025, 7:00am
4
It should already be implemented somehwere, it’s used to draw your frames to the screen.If you are using a driver somebody else made, which is it?
While selecting the TFT_Driver in user_setup.h file, the result of generic display driver #define ILI9341_DRIVER results in
But the driver
#define ILI9341_2_DRIVER results
the second driver i think linked to this github repository
ILI9341_Init.h - Strange graphic issues depending on TFT · Issue #1172 · Bodmer/TFT_eSPI · GitHub
thanks in advance
Have you tried to add this in setup() loop, where tft is initialised?
tft.setSwapBytes(true);
You also have these settings for TFT_eSPI :
#define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
1 Like
Tried the tft.setSwapBytes(true) in the setup(), but no visible change. But regarding the settings you mentioned i think the TFT_config.h file already have this defined like this
#ifdef CONFIG_TFT_RGB_ORDER
#define TFT_RGB_ORDER TFT_RGB
#endif
#ifdef CONFIG_TFT_BGR_ORDER
#define TFT_RGB_ORDER TFT_BGR
#endif
does it need any repetition some other files as well?
No. Have you tried only tft_eSPI example first?
Btw, you could figure out how to use lvgl internal driver, since you are using V9.
The example worked nicely without color distortion. “lvgl internal driver” by this you meant “lv_tft_espi” .c .h files right?
Changes in User_setup.h file:
#define ILI9341_2_DRIVER
#define TFT_RGB_ORDER TFT_BGR
#define TFT_INVERSION_ON
Changes in lv_conf.h file:
#define LV_COLOR_16_SWAP 1
color depth 16
changes in lvgl_tft_espi.c Source file: @Tinus
static void flush_cb(lv_display_t * disp, const lv_area_t * area, uint8_t * px_map)
{
lv_tft_espi_t * dsc = (lv_tft_espi_t *)lv_display_get_driver_data(disp);
uint32_t w = (area->x2 - area->x1 + 1);
uint32_t h = (area->y2 - area->y1 + 1);
dsc->tft->startWrite();
dsc->tft->setAddrWindow(area->x1, area->y1, w, h);
dsc->tft->pushColors((uint16_t *)px_map, w * h, false); //Changed "true" to "false"
dsc->tft->endWrite();
lv_display_flush_ready(disp);
}
Note that LVGL v9.4 can render in SWAPPED color format too. You can enable it by
lv_display_set_color_format(disp, LV_COLOR_FORMAT_RGB565_SWAPPED);
1 Like