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() {