LVGL version
9.5.0
Platform
Using Cheap Yellow Display (CYD) with Touchscreen.
Development uses PlatformIO extension to Visual Studio Code on Linux.
What happened?
When LVGL is set to rotation of 90° or 270°, the touchscreen pointer events coordinates are diagonally opposite the correct point.
How to reproduce?
I created an example project https://github.com/nwholloway/lvgl-rotation with buttons in each corner, and a central button to set LVGLs rotation.
I believe the problem is in lv_display_rotate_point, where the switch cases for LV_DISPLAY_ROTATION_90 and LV_DISPLAY_ROTATION_270 are swapped.
Making the following change locally rectified it for me.
diff --git a/src/display/lv_display.c b/src/display/lv_display.c
index 63555da77..0d4cc57d7 100644
--- a/src/display/lv_display.c
+++ b/src/display/lv_display.c
@@ -1256,16 +1256,16 @@ void lv_display_rotate_point(lv_display_t * disp, lv_point_t * point)
switch(rotation) {
case LV_DISPLAY_ROTATION_90:
- point->x = disp->ver_res - y - 1;
- point->y = x;
+ point->x = y;
+ point->y = disp->hor_res - x - 1;
break;
case LV_DISPLAY_ROTATION_180:
point->x = disp->hor_res - x - 1;
point->y = disp->ver_res - y - 1;
break;
case LV_DISPLAY_ROTATION_270:
- point->x = y;
- point->y = disp->hor_res - x - 1;
+ point->x = disp->ver_res - y - 1;
+ point->y = x;
break;
default:
break;
I haven't created a PR, as I haven't investigated getting unit tests running (which would need updating to match).
LVGL version
9.5.0
Platform
Using Cheap Yellow Display (CYD) with Touchscreen.
Development uses PlatformIO extension to Visual Studio Code on Linux.
What happened?
When LVGL is set to rotation of 90° or 270°, the touchscreen pointer events coordinates are diagonally opposite the correct point.
How to reproduce?
I created an example project https://github.com/nwholloway/lvgl-rotation with buttons in each corner, and a central button to set LVGLs rotation.
I believe the problem is in
lv_display_rotate_point, where the switch cases forLV_DISPLAY_ROTATION_90andLV_DISPLAY_ROTATION_270are swapped.Making the following change locally rectified it for me.
I haven't created a PR, as I haven't investigated getting unit tests running (which would need updating to match).