mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
ESP32C3: Get analogRead working correctly
Thanks to SimonGAndrews! we need to call it twice to get a decent value on the C3 for some reason! https://forum.espruino.com/conversations/395499/?offset=100#17482163
This commit is contained in:
parent
9b3cc7f806
commit
5f3f6782ad
@ -1,3 +1,5 @@
|
||||
: ESP32C3: Get analogRead working correctly
|
||||
|
||||
2v24 : Bangle.js2: Add 'Bangle.touchRd()', 'Bangle.touchWr()'
|
||||
Bangle.js2: After Bangle.showTestScreen, put Bangle.js into a hard off state (not soft off)
|
||||
Fix for unexpected power draw on newest batch of Bangle.js devices
|
||||
|
||||
@ -145,6 +145,11 @@ int readADC(Pin pin){
|
||||
#if ESP_IDF_VERSION_MAJOR>=4
|
||||
// ESP_IDF 4.x - int adc1_get_voltage(adc1_channel_t channel) //Deprecated. Use adc1_get_raw() instead
|
||||
int value=adc1_get_raw(channel);
|
||||
#if CONFIG_IDF_TARGET_ESP32C3
|
||||
// we need to call it twice to get a decent value on the C3 for some reason!
|
||||
// https://forum.espruino.com/conversations/395499/?offset=100#17482163
|
||||
value=adc1_get_raw(channel);
|
||||
#endif
|
||||
#else
|
||||
value = adc1_get_voltage(channel);
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user