Fix wrong attenuation being set to pins (#5522)
Fixes: https://github.com/espressif/arduino-esp32/issues/5503
This commit is contained in:
parent
5bb8177aa1
commit
5fd737925f
@ -104,8 +104,10 @@ void __analogSetPinAttenuation(uint8_t pin, adc_attenuation_t attenuation)
|
|||||||
adc1_config_channel_atten(channel, attenuation);
|
adc1_config_channel_atten(channel, attenuation);
|
||||||
}
|
}
|
||||||
__analogInit();
|
__analogInit();
|
||||||
|
if((__pin_attenuation[pin] != ADC_ATTENDB_MAX) || (attenuation != __analogAttenuation)){
|
||||||
__pin_attenuation[pin] = attenuation;
|
__pin_attenuation[pin] = attenuation;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool __adcAttachPin(uint8_t pin){
|
bool __adcAttachPin(uint8_t pin){
|
||||||
int8_t channel = digitalPinToAnalogChannel(pin);
|
int8_t channel = digitalPinToAnalogChannel(pin);
|
||||||
@ -113,6 +115,7 @@ bool __adcAttachPin(uint8_t pin){
|
|||||||
log_e("Pin %u is not ADC pin!", pin);
|
log_e("Pin %u is not ADC pin!", pin);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
__analogInit();
|
||||||
int8_t pad = digitalPinToTouchChannel(pin);
|
int8_t pad = digitalPinToTouchChannel(pin);
|
||||||
if(pad >= 0){
|
if(pad >= 0){
|
||||||
#if CONFIG_IDF_TARGET_ESP32
|
#if CONFIG_IDF_TARGET_ESP32
|
||||||
|
Loading…
Reference in New Issue
Block a user