I believe the touchscreen code to detect a touch event could be improved.
Let me describe what happens.
The problem happen sometimes randomly or can be seen easily by pressing multiple times on the screen per second. What happens is we get a touchevent not on the correct position.
The position is ALWAYS too much UP and LEFT from the correct possition where the finger was pressed.
This behavior happens less with a touchscreen pen, but can still happen sometimes.
The screen is calibrated and most of the time its at the correct position.
The theory I have for this bug is that: you must have a loop somewhere that samples the analog pins multiple times per second.
But sometimes the sample is taken while a finger is being pressed (lets say halfway pressed).
I believe that an Improvement could be made:
First, detect that the analog is above the threshold that āsomething is pressedā, but donāt fire the touch event yet! wait for a sample or 2 that the curve is āstableā enough that the touch is fully pressed and only then fire the event at the correct position.
I already verified with an oscilloscope, and the touchscreen analog output seems to be not the problem (it seems sensitive enough if I press and depress the touchscreen 2-3 times a second).
There were other users in the past that reported this problem, but never investigated further I believe.
Is the touchscreen code available somewhere?