-->
Page 3 of 3

Re: TFT ILI9341 display touch controller x axis reversed

PostPosted: Mon Apr 06, 2020 10:46 am
by RichardS
I would expect all the 240's and 320's below to be 239's and 319's instead...

In the case of:
xf = 240 -x;

x = 0 then xf = 240, I would expect the display to accept 0 to 239.... not 240 :-)

RichardS


lpservices wrote:Hello,

this is the codeblock in ReadTouchXY I replaced for the reversed X axis on my display:

my altered code:

switch (tft->getRotation())
{
case 0:
xf = 240 -x;
yf = y;
break;
case 1:
xf = y;
yf = x;
break;
case 2:
xf = x;
yf = 320-y;
break;
case 3:
xf = 320 -y;
yf = 240 - x;
break;
}

The original code :

switch (tft->getRotation())
{
case 0:
xf = 240 - x;
yf = 320 - y;
break;
case 1:
xf = 320 - y;
yf = x;
break;
case 2:
xf = x;
yf = y;
break;
case 3:
xf = y;
yf = 240 - x;
break;
}
This solved my problem for all rotations of the display, hope this of some use to other buyers of this display
At the moment I am looking at implementing a calibration routine to implement tft.calibrate()