You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
diff --git a/adafruit_touchscreen.py b/adafruit_touchscreen.py
index 5bf0fe0..4f28761 100644
--- a/adafruit_touchscreen.py
+++ b/adafruit_touchscreen.py
@@ -136,7 +136,7 @@ class Touchscreen:
with AnalogIn(self._yp_pin) as y_p:
z_2 = y_p.value
# print(z_1, z_2)
- z = 65535 - (z_2 - z_1)
+ z = z_2 + z_1
if z > self._zthresh:
with DigitalInOut(self._yp_pin) as y_p:
and a threshold value of around 40000.
Without this diff, the bottom right of the screen never registers a press.
I don't know much about these kinds of screens. Presumably this code works for other screens. Do some screens reverse this? I triple checked my wires and I don't think I wired anything backwards.
I also had to reverse the X calibration to make the coordinates correspond to the ones used when drawing on the screen:
calibration=([59889, 12545], [16373, 61473]),
The text was updated successfully, but these errors were encountered:
I do know this does work on some screens I've used it mainly with built-in displays on PyPortals. I'm not sure about whether any screens reverse the values like you mentioned.
It is fairly typical to need to change the calibration values though, the defaults tend to work okay for me as long as I don't need precise accuracy with the touch point. But if I get them dialed in the accuracy goes way up and it can register touches on relatively small screen regions successfully.
I have https://www.adafruit.com/product/2478, and the only way I can get it to work is with the following diff:
and a threshold value of around 40000.
Without this diff, the bottom right of the screen never registers a press.
I don't know much about these kinds of screens. Presumably this code works for other screens. Do some screens reverse this? I triple checked my wires and I don't think I wired anything backwards.
I also had to reverse the X calibration to make the coordinates correspond to the ones used when drawing on the screen:
The text was updated successfully, but these errors were encountered: