From fba9a3081347570c2854b555474ff596e6f17e34 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Tue, 11 Jun 2024 23:09:41 +0200 Subject: [PATCH] ESP32: Espressif deprecated ADC_ATTEN_DB_11 --- DCCTimerESP.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/DCCTimerESP.cpp b/DCCTimerESP.cpp index e57f6af..39824a5 100644 --- a/DCCTimerESP.cpp +++ b/DCCTimerESP.cpp @@ -297,7 +297,12 @@ void DCCTimer::DCCEXInrushControlOn(uint8_t pin, int duty, bool inverted) { int ADCee::init(uint8_t pin) { pinMode(pin, ANALOG); adc1_config_width(ADC_WIDTH_BIT_12); +// Espressif deprecated ADC_ATTEN_DB_11 somewhere between 2.0.9 and 2.0.17 +#ifdef ADC_ATTEN_11db + adc1_config_channel_atten(pinToADC1Channel(pin),ADC_ATTEN_11db); +#else adc1_config_channel_atten(pinToADC1Channel(pin),ADC_ATTEN_DB_11); +#endif return adc1_get_raw(pinToADC1Channel(pin)); } int16_t ADCee::ADCmax() {