DustinWatts / FreeTouchDeck

For interfacing with Windows/macOS/Linux using an ESP32, a touchscreen and BLE.
https://www.youtube.com/dustinwatts
MIT License
617 stars 124 forks source link

Buttons offset #100

Closed hermannw closed 1 year ago

hermannw commented 1 year ago

I recently discovered this project and I love it! Thanks Dustin for sharing this! I am using an ESP32DEVKITV1 and I used the web installer. Everything works great with one exception: I did the touch screen calibration multiple times but it looks like the buttons are off.

image

This is roughly how the touch function works. So the touch function of the upper button row, starts about 2/3 from the upper edge. Any idea why this happens?

Hermann

DustinWatts commented 1 year ago

@hermannw Hi Hermann! Thanks for the compliment.

Highly likely is that something went wrong with the calibration. You can reset the calibration by typing cal reset in the serial monitor. But you have probably haven't changed anything in your config. So uploading the SPIFFS again will also work an is probably easier.

Although reading your comment you have done it multiple times already. Do you have the chance to test it with a different screen? Are you using the PCB or did you wire it up? I have seen this offset few times. Most times recalibrating fixed the problem. Most other times turned out to be faulty wiring. Including cross-talk due to wires and breadboards. A few were bad screens. If there is damage on the resistive network of the screen this problem is here to stay, at least with this screen.

Let me know how it turns out!

hermannw commented 1 year ago

Hi Dustin, yes I have redone the calibration several times and there is no change. I am using a veroboard with the ESP one one side and the LCD on the other. I tested it with a breadboard before and it showed the same offset. What could be wrong on the wiring? The ESP board is a different one but from what I understand, the main difference between them is the board and not the processor... I am planning to build another one so I am going to buy another LCD. Is there any possibility to define some offset in the software? I am familiar with the ESP programming. I just used the ready made image because I am lazy. :-) Hermann

DustinWatts commented 1 year ago

@hermannw The TFT touch calibration is a function directly from the TFT_eSPI library. The resistive touch functions are also taken directly from there. I always tried to fix the reason for the offset. I had it a lot of times during development, and it was always an error in the code. But in the images and the -master version here on Github no such errors exist as far as I know.

I forgot to ask, does the screen react to the touch when you do the calibration? I mean the two top corners.

Without knowing what ESP32 you are exactly you are using I can not say if it makes a difference. Chances are it does not because like you said, most ESP32 dev boards use the same WROOM module. But it could be that there is a difference on your board that makes SPI (resistive touch uses SPI) function differently.

I recommend compiling the code using the Arduino IDE. You can follow the instructions in the FreeTouchDeck.ino (the comments tell you what you need to know), on Instructables, or here in the Wiki. I know this is a lot more work then using the image but you can compile for the board you are using. The images are compiled for the standard ESP32 DevKit.

hermannw commented 1 year ago

The calibration works ok. I am using a stylus for better precision. All four corners react and at the end there is a message that the calibration was saved. I just downloaded the repository and compiled it. The result is the same. I'll try with another LCD. Thanks for the help!

Edit: To test the LCD, I uploaded the Touch_calibrate sketch from the TFT-eSPI library. After the calibration, it gave me these coordinates: 14:48:25.522 -> // Use this calibration code in setup(): 14:48:25.522 -> uint16_t calData[5] = { 451, 3129, 389, 2382, 5 }; 14:48:25.522 -> tft.setTouch(calData); 14:48:25.522 -> The test afterwards shows about 10mm offset at the top of the screen and it gets smaller the further down I go! So I have to touch the screen about 10mm below where the white dot shows up... Interestingly at the very left edge it works ok. Is it possible that the restive network or the touch controller are screwed up?

hermannw commented 1 year ago

Well, it was indeed the LCD... I replaced it with another one and that works.

DustinWatts commented 1 year ago

Is it possible that the restive network or the touch controller are screwed up?

Both are possible. But I am glad that it was the screen and that with another screen it works. I hope you can still get your money back for the faulty one. If not, you can replace only the touch film, it is difficult, but possible.