Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt for ADC resolution on ESP32 #15

Open
lukasfischer83 opened this issue Oct 16, 2018 · 6 comments
Open

Adapt for ADC resolution on ESP32 #15

lukasfischer83 opened this issue Oct 16, 2018 · 6 comments

Comments

@lukasfischer83
Copy link

Arduino board: ESP32
Hi, I just noticed a small bug on ESP32, which has 12bit ADC resolution. The driver works as expected if analogReadResolution(10); is called before using getPoint(). Otherwhise, as expected, it does not ;).
So maybe you could implement a check on the resolution and change the calculations (1023 is hardcoded in some lines) or simply right-shift the adc results by two if ESP32 is defined.
Cheers, Lukas

@Ryan-obl
Copy link

Good catch, thank goodness I found your post (and your simple solution) in time!

Now the Adafruit touchscreen works like a charm on my ESP32!

@LeonidKokhnovich
Copy link

LeonidKokhnovich commented Feb 1, 2019

@lukasfischer83 @Ryan-obl Hey! I wonder what pins do you use on ESP32 for Xp, Xm, Yp and Ym? It doesn't seem to work for me.

@Psycho-0
Copy link

Psycho-0 commented Apr 6, 2019

This edit works, I would refrain from using inputonly pins for xxyy measurements. This led to unusable results in my tests.

@Ryan-obl
Copy link

Ryan-obl commented Apr 7, 2019

@lukasfischer83 @Ryan-obl Hey! I wonder what pins do you use on ESP32 for Xp, Xm, Yp and Ym? It doesn't seem to work for me.

Hey @LeonidKokhnovich , I would use any pins that has any of the ESP32's ADCs on it, which naturally would depend on which board your ESP32 is on.

For instance, I'm using the ESP32 DevKitC v4, whose pinout can be found at:
https://components101.com/microcontrollers/esp32-devkitc

Cheers, Ryan

@dumtux
Copy link

dumtux commented May 25, 2021

Arduino board: ESP32
Hi, I just noticed a small bug on ESP32, which has 12bit ADC resolution. The driver works as expected if analogReadResolution(10); is called before using getPoint(). Otherwhise, as expected, it does not ;).
So maybe you could implement a check on the resolution and change the calculations (1023 is hardcoded in some lines) or simply right-shift the adc results by two if ESP32 is defined.
Cheers, Lukas

This was so much helpful.
I struggled with ESP32 touchscreen issue.
The touchpoint values were strange. I thought some other circuits are interfering electric signals and so ESP32 is reading wrong values. But it was ADC resolution issue. I realized that after reading this.
Thanks again!

@ScruffR
Copy link

ScruffR commented Oct 15, 2023

I just filed a pull-request to solve that problem
#43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants