Changes to the touch calibration #200
kdschlosser
announced in
Announcements
Replies: 1 comment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There have been problems plaguing the touch calibration for some time. I spent some time today and i "dumbed" down the code a lot. It is super simple with a colored 20 x 20 dot that will appear that will need to be pressed a total of 8 times. pressing and holding will also work. the coordinates when they are collected will get printed out to the REPL.
I have had some people ask about using the values given from TFT_eSPI's calibration. This cannot be done. the TFT_eSPI Arduino library does not handle a touch screen being adhered to a display crooked/rotated slightly. It doesn't run calculations that build a transform matrix. It simply remaps x and y touch coordinates to display coordinates. I know this because it only uses 2 points x0, y0, x1, y1 for the coordinates and there is an additional integer that is a simple bit shift that holds x mirror, y mirror and swap xy.
These are the calculations that I am using:
And the code that is used to create the matrix and correct the x, y coordinates:
This is a way more complex calibration than the one used in TFT_eSPI which enables it to handle things like the touch panel not being attached to the display 100% straight. It can be slightly crooked and it will properly adjust the input coordinates to the correct display coordinates.
Beta Was this translation helpful? Give feedback.
All reactions