The update to LVGL 9.x introduced changes in the configuration of the display and touch screen. I have updated a working configuration based on the previous LVGL implementation (ESPHOME 2026.1.0) and having issues with the touchscreen that seem to be related to the transformation.
I am using a 320x240 touchscreen and use the following display configuration:
display:
- platform: mipi_spi
model: ILI9341
buffer_size: 50%
dimensions:
width: 240
height: 320
offset_width: 0
offset_height: 0
The screen is used in landscape mode:
lvgl:
rotation: 90
As expected, drawing on the screen, x=0 and y=0 is top left and x=320 and y=240 is bottom right.
I have calibrated the toch screen and found the raw values for X and Y.
The calibration showed that the X and Y access are swapped.
touchscreen:
platform: xpt2046
display: my_display
id: my_touchscreen
calibration:
y_min: 453
y_max: 3767
x_min: 290
x_max: 3871
transform:
swap_xy: true
When testing the touchscreen, there seems to be an issue with the transformation of the raw values of the touchscreen.
Top Right returns:
x=237, y=0, x_raw=3838, y_raw=414 ---> incorrect, x should read 320 (width of the screen)
Bottom left returns:
x=1, y=319, x_raw=314, y_raw=3797 ---> incorrect, y should read 240 (height of the screen)
Bottom right returns:
x=239, y=319, x_raw=3892, y_raw=3876 --->incorrect, x should read 320, y should read 240
The transformed values for x and y show that the width and height of the screen were swapped when performing the transform.
My questions:
- Is this a programmatic bug or did I implement the rotation in an incorrect way??
Component details
MCU: ESP32-WROOM-32D (esp-idf framework)
Display: 2.8" ILI9341 320×240 TFT via MIPI-SPI
Touch: XPT2046 resistive touchscreen (separate SPI bus)
ESPHOME version: 2026.5.0 (tested with the 2026.4.x versions too)
EDIT: I have reported this as a bug on Touchscreen transformation issues after LVGL update · Issue #25 · ESPBoards/esphome-lvgl-ui-builder