-
Notifications
You must be signed in to change notification settings - Fork 71
Fix pointer coordinate mapping #454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Previously was using the already mapped x coord to compute the new y coord
the mapping is not wrong. Your touch screen is more than likely connected wrong to the IC. Is this with an XPT2046 touch screen? If it is it's very common to have them connected incorrectly to the touch IC and it has been seen before. What you need to do is the following.. if not indev.is_calibrated:
indev.calibrate()
indev._cal.mirrorX = not indev._cal.mirrorX
indev._cal.mirrorY = not indev._cal.mirrorY where the mirrorX and mirrorY you use to slip the axis that is incorrect. If you have an issue with the X and Y axis's being flip flopped meaning x, y = y, x then you pass a startup rotation to the indev driver. |
The mapping data is correct but there is a bug in the implementation of the mapping calculation.
The x value used to compute y is the scaled value from the previous line. It should be the value that is passed to the function. The PR fixes this. |
I don't see why the mirroring is necessary if the calibration function is used. The affine transformation that the calibration function does should take care of that. It would only be necessary to use the mirror parameters if swapping the calibration data to another board that has reversed connections. |
HOLY shit, you are right.. I cannot believe I messed that up like I did. By setting x it messed up the value of x for the y coordinate. I knew that the way I was doing the calibration should have handled any mirrored axis and any rotation should there be any but for some reason it didn't work 100% correctly. I stared at it for days and could not see the problem. Thank you for taking the time to point that out to me. The only thing that I ask is that you add a comment as to why the values are stored like they are so in the future myself or perhaps someone else doesn't go and change it for some reason. I thank you very much for locating and correcting this issue. It just needed another set of eyeballs that was familiar with using a matrix to handle the calibration. |
I know I am being kind of a pain but not as a docstring. docstrings consume memory because they get loaded as a variable. Comments also take up some memory but not as much as a docstring does. Just a simple one liner that states the backups of the XY need to exist because they are both used in the X and Y decoding of the calibration data... Just so I don't forget and do the dumbass thing of changing it back for some reason. You can also add your username to the comment as well if you like. This has been a long standing issue and I really do tip my hat to you for finding it. I am super stoked about it being fixed and being able to remove the startup rotation and also the mirrors from the calibration design. |
1d6d12c
to
2cfd967
Compare
Previously was using the already mapped x coord to compute the new y coord