You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
wled 16.0.x: esp8266 analog pin cannot be chosen in settings #5747
with wled 0.15.0 when choosing an analog input in the settings the pin17 (actually a0) can be used to set up the input.
with wled 0.16.x (only tested 0.16.1) only "unused" seems to be available as pin but when saving the settings the analog setting is not available in macros.
Workaround: choose an existing unused pin before choosing "analog". this results in an exclamation mark in the pin but because the pin is unused anyway it still works as intended:
I found my solution but i wanted to report the issue anyway.
Thanks for this great software!
To Reproduce Bug
install wled 0.16.1 on esp8266, go to settings, choose analog and press save
Expected Behavior
the analog input is kept in settings and can be used in macros
Install Method
Binary from WLED.me
What version of WLED?
WLED 16.0.1 (2606300)
Which microcontroller/board are you seeing the problem on?
Your workaround is correct, the ADC pin on ESP8266 is a very special case that falls out of the grid of how the code currently works. I need to check how to best fix this.
changed the title [-]wled 0.16.x: esp8266 analog pin cannot be chosen in settings[/-][+]wled 16.0.x: esp8266 analog pin cannot be chosen in settings[/+]on Aug 10, 2026
#!/bin/bashprintf'%s\n''--- Relevant UI references ---'
rg -n -C 4 'd\.adc|\.adc\b|BTN_TYPE_ANALOG|analog|Analog|BT[0-9]|max_gpio|rsvd' wled00/data -g '*.{js,htm}'| head -n 300
printf'%s\n''--- Map source files ---'forfin wled00/set.cpp wled00/cfg.cpp wled00/pin_manager.cpp wled00/xml.cpp;doecho"--- $f ---"
ast-grep outline "$f" --items all --match 'Settings|settings|Config|config|Pin|pin|appendGPIO'2>&1| head -n 100
doneprintf'%s\n''--- Settings button save path ---'
cat -n wled00/set.cpp | sed -n '350,445p'printf'%s\n''--- Config button load path ---'
cat -n wled00/cfg.cpp | sed -n '380,475p'printf'%s\n''--- Pin manager bounds and validity ---'
cat -n wled00/pin_manager.cpp | sed -n '1,42p;145,215p;300,326p;390,435p'printf'%s\n''--- GPIO settings output ---'
cat -n wled00/xml.cpp | sed -n '95,205p'
Length of output: 51697
Script executed:
#!/bin/bashprintf'%s\n''--- Button dropdown and macros ---'
ast-grep outline wled00/data/common.js --items all --match 'pin|Pin|DD|Dropdown'2>&1| head -n 100
rg -n -C 4 'btnPinDd|pinDropdowns|addBtn|buttons\[|BT[0-9]|BE[0-9]|btns|macro' wled00/data/settings_leds.htm wled00/data/settings_time.htm wled00/xml.cpp wled00/set.cpp wled00/cfg.cpp | head -n 310
cat -n wled00/data/common.js | sed -n '300,380p'
cat -n wled00/data/settings_leds.htm | sed -n '830,885p'printf'%s\n''--- Button config save and default handling ---'
cat -n wled00/cfg.cpp | sed -n '469,515p;1060,1125p'printf'%s\n''--- Button deallocation around settings save ---'
rg -n -C 4 'deallocatePin\(.*button|for.*button.*buttons|buttons\.clear|btn\.pin|btn\.type' wled00/set.cpp wled00/cfg.cpp wled00/xml.cpp wled00/button.cpp
Length of output: 39496
@DedeHai Yes. A localized fix could treat pin == -1 as implicit A0, but only for ESP8266 buttons with type BTN_TYPE_ANALOG or BTN_TYPE_ANALOG_INVERTED.
In wled00/set.cpp and wled00/cfg.cpp, keep those buttons without allocating a GPIO or calling pinMode(). Apply the same rule to the default-button path.
In the settings UI, show A0 (fixed) for those types. Use the button type to disable the button, rather than presenting -1 as “unused.”
When loading older analog configurations, normalize their stored pin to -1. This also releases the GPIO used by the workaround. Preserve the button’s macros.
Leave other pin handling unchanged. handleButton() already permits an ESP8266 analog button with a negative pin, and handleAnalog() reads A0.
The trade-off is that A0 would remain outside PinManager, so this would not detect conflicts with usermods that also use A0. It would fix button selection and persistence, not provide general A0 ownership tracking.
I have not tested this. I would check both analog types, save and reboot, macro visibility, migration from the workaround, and switching back to a digital button.
Learnings used
Learnt from: softhack007
Repo: wled/WLED PR: 0
File: :0-0
Timestamp: 2026-10-03T14:59:43.661Z
Learning: In wled/WLED, softhack007 prefers contributors to answer maintainer questions directly with short explanations in their own words, even if the explanations are technically imprecise or the English is imperfect. Contributors should state uncertainty and actual test results rather than relay unverified AI-generated technical answers. AI may assist with translation or wording, but should not manufacture explanations that shift fact-checking and AI-session supervision onto maintainers.
Activity
DedeHai commentedon Jul 20, 2026
Your workaround is correct, the ADC pin on ESP8266 is a very special case that falls out of the grid of how the code currently works. I need to check how to best fix this.
[-]wled 0.16.x: esp8266 analog pin cannot be chosen in settings[/-][+]wled 16.0.x: esp8266 analog pin cannot be chosen in settings[/+]DedeHai commentedon Dec 3, 2026
@coderabbitai do you see an easy fix for this that does not need fundamental changes on how the pins are handled?
coderabbitai commentedon Dec 3, 2026
Analysis chain
Script executed:
Length of output: 24289
Script executed:
Length of output: 29716
Script executed:
Length of output: 51697
Script executed:
Length of output: 39496
@DedeHaiYes. A localized fix could treatpin == -1as implicit A0, but only for ESP8266 buttons with typeBTN_TYPE_ANALOGorBTN_TYPE_ANALOG_INVERTED.wled00/set.cppandwled00/cfg.cpp, keep those buttons without allocating a GPIO or callingpinMode(). Apply the same rule to the default-button path.-1as “unused.”-1. This also releases the GPIO used by the workaround. Preserve the button’s macros.handleButton()already permits an ESP8266 analog button with a negative pin, andhandleAnalog()readsA0.The trade-off is that A0 would remain outside
PinManager, so this would not detect conflicts with usermods that also use A0. It would fix button selection and persistence, not provide general A0 ownership tracking.I have not tested this. I would check both analog types, save and reboot, macro visibility, migration from the workaround, and switching back to a digital button.
Learnings used
You are interacting with an AI system.