I have ILI9341 320x240px TFT LCD screen which I am using with ESP32-S3-wroom-1 module.
I have tested with TFT_eSPI and works fine, but when using LVGL, I am seeing weird artefacts on the edges. enter image description here
I am using Arduino IDE
Started off the sketch from
https://github.com/lvgl/lvgl/blob/master/examples/arduino/LVGL_Arduino/LVGL_Arduino.ino
Havent changed sketch file much.
I am using LVGL latest v8.2.0
/*====================
COLOR SETTINGS
*====================*/
/*Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)*/
#define LV_COLOR_DEPTH 16
/*Swap the 2 bytes of RGB565 color. Useful if the display has an 8-bit interface (e.g. SPI)*/
#define LV_COLOR_16_SWAP 1
/*Enable features to draw on transparent background.
*It's required if opa, and transform_* style properties are used.
*Can be also used if the UI is above another layer, e.g. an OSD menu or video player.*/
#define LV_COLOR_SCREEN_TRANSP 1
/* Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently.
* 0: round down, 64: round up from x.75, 128: round up from half, 192: round up from x.25, 254: round up */
#define LV_COLOR_MIX_ROUND_OFS 0
/*Images pixels with this color will not be drawn if they are chroma keyed)*/
#define LV_COLOR_CHROMA_KEY lv_color_hex(0x00ff00) /*pure green*/
LV_COLOR_SCREEN_TRANSP 1
was originally 0 changing it did not change anything.
I am following the FAQ which mentions
1.6.7 Why I see nonsense colors on the screen? Probably LVGL's color format is not compatible with your displays color format. Check LV_COLOR_DEPTH in lv_conf.h. If you are using 16 bit colors with SPI (or other byte-oriented interface) probably you need to set LV_COLOR_16_SWAP 1 in lv_conf.h. It swaps the upper and lower bytes of the pixels.
as you can see above in the config, the values are as recommended.
Any help will be greatly appreciated.
1 Answer 1
Turns out, I had to disable LV_COLOR_16_SWAP
I had been trying with different colour depths and everything else, I still cannot see gradients drawn properly, but the colours seem to be correct now.enter image description here
-
I am encountering the exact same problem, using the same ESP32-S3, but using ESP-IDF framework; not Arduino. My solution was exactly the same as yours; comment out the
LV_COLOR_16_SWAP
in the generatedui.c
. BTW, the project I am working on is here: github.com/smeisner/smart-thermostat I am hoping this gets fixed sometime soon!Steve Meisner– Steve Meisner2023年09月10日 15:18:02 +00:00Commented Sep 10, 2023 at 15:18 -
BTW, I found this on the SquareLine Studio forum: forum.squareline.io/t/…Steve Meisner– Steve Meisner2023年09月10日 15:24:45 +00:00Commented Sep 10, 2023 at 15:24
-
Thanks @SteveMeisner for sharing the linkAnil Maharjan– Anil Maharjan2023年09月11日 16:43:50 +00:00Commented Sep 11, 2023 at 16:43