From 8c60a62161bf79d031cfb702b04fb3448ce6e8b1 Mon Sep 17 00:00:00 2001 From: gdsports <31050875+gdsports@users.noreply.github.com> Date: Tue, 28 Sep 2021 13:29:41 -0700 Subject: [PATCH] Fix analogRead of adc2 channels See also #5658 and #5671 --- cores/esp32/esp32-hal-adc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cores/esp32/esp32-hal-adc.c b/cores/esp32/esp32-hal-adc.c index 0530f1d84fb..664af9b4711 100644 --- a/cores/esp32/esp32-hal-adc.c +++ b/cores/esp32/esp32-hal-adc.c @@ -46,7 +46,11 @@ static uint8_t __analogVRefPin = 0; #endif static uint8_t __analogAttenuation = 3;//11db +#if CONFIG_IDF_TARGET_ESP32S2 +static uint8_t __analogWidth = 4;//13 bits +#else static uint8_t __analogWidth = 3;//12 bits +#endif static uint8_t __analogClockDiv = 1; static adc_attenuation_t __pin_attenuation[SOC_GPIO_PIN_COUNT];