Enhanced version of touchscreen #292
Replies: 17 comments
-
Thank you for the work. I think we don't have the same (touch) chip. Do you know whitch chip you have? |
Beta Was this translation helpful? Give feedback.
-
I think it has a XPT2046 chip which is the same (as far I know) as a Texas Instrument chip. |
Beta Was this translation helpful? Give feedback.
-
FYI, I removed the first "for" loop (4 times dummy reading of the chip) and it still works well. |
Beta Was this translation helpful? Give feedback.
-
The zip file version above is not a direct replacement, it generates errors on compile. A new supporting header Touch.h is needed. Make sure the existing examples continue to run. I have have marked as a development discussion and will close it to avoid confusion. Do continue the discussions. |
Beta Was this translation helpful? Give feedback.
-
I updated the library a while ago to multi sample x sand y. It does seem to improve the raw touch read consistency but it apears to have no effect after filtering by getTouch(). YMMV. |
Beta Was this translation helpful? Give feedback.
-
If I understand correctly the application note, when you perform multiple conversions, you should use commands with the last significant bit set on 1 (in order to keep power on and so getting more stable voltages to read). |
Beta Was this translation helpful? Give feedback.
-
I use the XPT2046 data sheet here. Page 24 and Table 8 indicate the ADC is available instantly and thus there is not need to control PD0. |
Beta Was this translation helpful? Give feedback.
-
I have done my work see https://github.com/achillhasler/TFT_eTouch for new tochscreen dirver. In the User_Setup.h of TFT_eSPI you have to disable This CS is now used by the constructor If you need documentation install doxygen and graphviz and build the documentation with the Doxyfile in directory docs have a try |
Beta Was this translation helpful? Give feedback.
-
Thanks. looks good. I will create a test setup, but it will be a while before I can test it. |
Beta Was this translation helpful? Give feedback.
-
I have tried the library with an ESP8266 and ILI9341 screen with an XPT2046 fitted. The raw sketch runs fine and seems to generate sensible values. At the moment the ESP8266 just keep rebooting on the watchdog when trying the calibration sketch. I know there is a bug in the TFT_eSPI library which is stopping the built in touch controller from working so that is not helping. At the moment the TFT_eSPI library indicates the screen is being touched all the time. I will sort the TFT_eSPI issue first and then come back to test the TFT_eTouch library again. |
Beta Was this translation helpful? Give feedback.
-
I have repaired TFT_eSPI (it was stuck in SPI write only mode on the ESP8266). I have only tried the TFT_eTouch library with an ESP8266 and ILI9341 screen which is quite noisy for output position. The raw function works fine and gives stable outputs. The calibrate sketch puts marker on the screen then the ESP8266 reboots on the watchdog. I do not have the Penirq wired. Have you tested the library on an ESP8266? |
Beta Was this translation helpful? Give feedback.
-
I have updated TFT_eTouch to ver 00.05.00 but now i need a interface change in TFT_eSPI.
TFT_eSPI.cpp
The Conways_Life example supports yours and my touch implementation to see the difference. |
Beta Was this translation helpful? Give feedback.
-
I have mode the changes to my copy. The calibrate sketch throws compile errors due to some instance naming errors. When corrected the ESP8266 keeps rebooting. Conways_Life example compiles but the ESP8266 keeps rebooting immediately after the calibration screen is drawn. raw example compiles but never reports anything to the serial port, again I am using an ESP8266 and ILI9341 screeen. |
Beta Was this translation helpful? Give feedback.
-
I test that on a ESP32. i dont have a ESP8266, but why does it rebooting. Difficult to test on ESP32 there is no reboot. I test with a RPI_ILI9486_DRIVER display. If you define TOUCH_CS in TFT_eSPI User_Setup.h my touch implementation is not used in the Connways_Life demo. Does ist also reboot on ESP8266? |
Beta Was this translation helpful? Give feedback.
-
OK, I will create a setup with an ESP32 and touch screen in the next few days and see how it goes. |
Beta Was this translation helpful? Give feedback.
-
There is a new version of TFT_eTouch whitch support ESP8266 chips. Have a try |
Beta Was this translation helpful? Give feedback.
-
need your help ,tks! |
Beta Was this translation helpful? Give feedback.
-
I made some tests with my device.
I had a lot of issues to detect if a key was pressed or not and to get reliable data.
Even if I had acess to the irq pin, I saw that I could not used it. I nearly always got a level LOW so there was no difference between pressed or not pressed.
I collected lot of raw data reading 12 time X, then 12 time Y, then 12 time Z1 and then 12 time Z2 and finally I asked for a transfert of command 0X80 (to force a power down).
I noticed that first read of X is always 4096 (because it follows a 0X80 cmd).
The second read of X is often 0 (but not always) when not pressed. So testing on this is not reliable.
I noticed that Z1 is a much more reliable way to detect a press.
Finally I implemented the following principle.
I made a fonction to read just one axis in consecutive way.
First this function make 4 dummy reads (to let voltage stabilise) and then it makes 4 other consecutive reads. For this second run, it calculates min, max and sum.
If the difference between min and max is less than a parameter (e.g. 30) it assumes that the average is correct and exit. Else it makes a new run of 4 consecutive reads.
The main function to get a positon becomes very simple:
I made my changes based on the Bodmer original version (keep the same name for functions) so it is compatible with Bodmer example.
There i no need anymore for getValid(); so I had to make very small changes in the calibration function too.
This seems to work fine so far in my case (much better than other versions)
In most cases, reading the touchscreen takes about 100 microseconds when not pressed and 300 when pressed. Probably, it is even possible to reduce those delays if we remove the first 4 time reads (it seems - at least in my case- that the noise on the signal is anyway much bigger than the time to settle and so checking on difference min/max of 4 values is probably enough).
Here my version; hoping it can help.
Touch.zip
Beta Was this translation helpful? Give feedback.
All reactions