Tears of joy ![]()
From the moment I hooked this screen to Zynthian, it had a scaling input problem where touch alignment gets worse towards bottom right of the screen (e.g. notes in pattern editor don’t go anywhere near your press). I’ve attempted fixes in the past without success. I posted some of my misadventures in the threads below where others had similar issues. Frustratingly, the screen has always worked fine in Bookworm/Trixie OS. Something happens in Zynthian at startup, I just couldn’t figure out what. I’d resigned myself to buying a new screen eventually and got by with just encoders and midi controllers.
It turns out, after querying a chatbot for a while and testing a few things, I found the evtest for touch input shows the bottom corner registering as 800x480 (not 1024x600). If I understand correctly, multitouch.py disables Xinput and reads direct from evdev instead, so the mismatch causes drift the further you go from the corner.
The fix that worked was to divide the actual display height 1024 by the (wrong) value evdev reports to get the scale factor and update the lines below (along with resolution constants). Being able to finally use the screen with touch overlay working is so great!!!
Summary
It was the extra two lines for each axis that solved it:
self._current_touch.x_root = round(
self._current_touch.x_root * TOUCH_DISPLAY_WIDTH / self.max_x)
elif evdev_event.code == ecodes.ABS_MT_POSITION_X:
if self._invert_x:
self._current_touch.x_root = self.max_x - evdev_event.value
else:
self._current_touch.x_root = evdev_event.value
self._current_touch.x_root = round(
self._current_touch.x_root * TOUCH_DISPLAY_WIDTH / self.max_x)
if self._current_touch not in self.events:
self.events.append(self._current_touch)
elif evdev_event.code == ecodes.ABS_MT_POSITION_Y:
if self._invert_y:
self._current_touch.y_root = self.max_y - evdev_event.value
else:
self._current_touch.y_root = evdev_event.value
self._current_touch.y_root = round(
self._current_touch.y_root * TOUCH_DISPLAY_HEIGHT / self.max_y)
if self._current_touch not in self.events:
self.events.append(self._current_touch)
@jofemodo Do you think there might be a way to allow for screens like this where the touch resolution reports different to the screen resolution?
This thread too but not clear if OP’s LCD touch problem was specifically scaling issue.