Hi,
My touch panel gives of the following RAW values - I have just shown min and max
-------------------- 1965 ----------------------
| |
| |
1980 64
| |
| |
---------------------176------------------------
So my touch panel is as if upside down and wrong way around compared to the TFT pixel map.
Here are the two pieces of code I use in setup and loop .... the raw function is from XPT2046.h is spapadm library
// in setup()
// when y = 0 ie top of screen vi = 1965, when y = 599 ie bottom of screen vi = 176
yInc = 600.0 / ( 1965.0 - 176 ) ; // per pixel
// when x = 0 ie left of screen vj = 1980, when x = 1023 ie right of screen vj = 64
xInc = 1024.0 / ( 1980.0 - 64 ) ; // per pixel
x and y below are now equivalent to the pixel positions of my TFT pixel map (i.e . 0 to 1024 and 0 to 600)
// in loop()
touch.getRaw(vi, vj); // vi is y pos vj is x pos !!!!!!
x = (int)(( 1980.0 - (float)vj ) * xInc); // x is now equivalent to TFT pixel
y = (int)(( 1965.0 - (float)vi) * yInc); // y is now equivalent to TFT pixel
BTW - your last post is confusing. Are you saying your RAW y value is 79 or 249 only. If that is the case it is a hardware problem. But what is the only common HW in all your setups?