Skip to content

fix(buttons): prime ADC channel before setting ladder pin attenuation - #125

Merged
jonasniesner merged 1 commit into
OpenDisplay:mainfrom
teancom:fix/adc-ladder-attenuation-order
Jul 26, 2026
Merged

fix(buttons): prime ADC channel before setting ladder pin attenuation#125
jonasniesner merged 1 commit into
OpenDisplay:mainfrom
teancom:fix/adc-ladder-attenuation-order

Conversation

@teancom

@teancom teancom commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

analogSetPinAttenuation() no-ops with an esp32-hal-adc 'Pin is not configured as analog channel' error unless the pin is already attached to the ADC, and attachment only happens on the first analogRead(). Do a throwaway read in registerAdcLadder() first so the ADC_11db attenuation call takes effect and the boot log stays clean.

No behavior change in practice: the core's default attenuation is also 11 dB, so ladder readings are unchanged. Verified on an XTEINK X4 (ESP32-C3): error line gone from boot, both ladders register, and button presses on both ADC pins still classify to the same ids. This is purely so someone looking at the boot logs doesn't think there is an actual problem.

analogSetPinAttenuation() no-ops with an esp32-hal-adc 'Pin is not
configured as analog channel' error unless the pin is already attached
to the ADC, and attachment only happens on the first analogRead(). Do a
throwaway read in registerAdcLadder() first so the ADC_11db attenuation
call takes effect and the boot log stays clean.

No behavior change in practice: the core's default attenuation is also
11 dB, so ladder readings are unchanged. Verified on an XTEINK X4
(ESP32-C3): error line gone from boot, both ladders register, and
button presses on both ADC pins still classify to the same ids.
@teancom
teancom requested a review from jonasniesner as a code owner July 26, 2026 00:21
@jonasniesner
jonasniesner merged commit 5202d58 into OpenDisplay:main Jul 26, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants