loboris / ESP32_TFT_library

Full featured TFT library for ESP32 with demo application
564 stars 219 forks source link

XPT2046 touch calculation #22

Open nottledim opened 6 years ago

nottledim commented 6 years ago

I'm not having much success getting touch to work. There is one show stopper in TFT_read_touch in tft.c.

There is a test for (ybottom - ytop) <= 0 which is always true and so calculation is always abandoned.

The constant TP_CALY_XPT2046 = 122224794 === 0x749009A Masking that value with 0x3FFF returns 0x009A - that's ybottom Shifting TP_CALY right by 16 bits and masking with 0x3FFF returns 0x0749 - thats ytop.

It's a constant calculation so I'm puzzled that it's recomputed every reading. I'm not too sure what's intended.

SindhujaNarra commented 6 years ago

Hi nottledim,

I'm having the similar issue with the XPT2046 touch calculations. Were you able to resolve it? Please let me know if you have found the solution to this issue.

Thanks in advance!

nottledim commented 6 years ago

oh, gosh - yes and no. I got it to work well enough for what I wanted by fiddling about. I don't think you could call it a resolution.

If I remember there was a problem with the mask used to select the position value from the chip register.

I'll dig the code out tomorrow to remind myself and I'll also send it to you.

Dick

On 7 June 2018 20:19:05 Sindhuja Narra notifications@github.com wrote:

Hi nottledim,

I'm having the similar issue with the XPT2046 touch calculations. Were you able to resolve it? Please let me know if you have found the solution to this issue.

Thanks in advance!

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/loboris/ESP32_TFT_library/issues/22#issuecomment-395534756

SindhujaNarra commented 6 years ago

That would be great. Thanks a lot!

earosenfeld commented 5 years ago

I am experiencing the same issue, was anyone able to resolve the issue with the XPT2046 touch calculation? Thank you