0

3.5" TFT 320x480 + Touchscreen HXD8357D
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

3.5" TFT 320x480 + Touchscreen HXD8357D

by jamesobrady on Tue Jan 09, 2018 5:02 am

Hi there,
I have recently received this and am running the sample tftpaint sketch with a Mega 2560.
My issue is the touchscreen seems to be mirrored around the center of the screen.
If I swipe from left to right, the paint draws from right to left.
If I move my finger down, the paint draws upwards.

I cannot for the life of me figure out how to solve this-Im an arduino newbie.
If i physically swap the Xp Xm and Yp Ym pins on the mega it works as it should but I imagine this is not a good solution.
Changing the mapping of the pins in the sketch results in the touchscreen not working.

Any help or advice is sincerely appreciated.
Thank you.

jamesobrady
 
Posts: 2
Joined: Tue Jan 09, 2018 4:56 am

Re: 3.5" TFT 320x480 + Touchscreen HXD8357D

by jamesobrady on Tue Jan 09, 2018 6:00 am

I found a solution to my issue here:
In the code if I change this:


Code: Select all | TOGGLE FULL SIZE
p.x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);
    p.y = map(p.y, TS_MINY, TS_MAXY, tft.height(), 0);


to this:

Code: Select all | TOGGLE FULL SIZE
  p.x = map(p.x,  TS_MAXX, TS_MINX, tft.width(), 0);
    p.y = map(p.y,  TS_MAXY, TS_MINY, tft.height(), 0);


It works as expected.

jamesobrady
 
Posts: 2
Joined: Tue Jan 09, 2018 4:56 am

Please be positive and constructive with your questions and comments.


cron