Analog button fix#5659
Conversation
WalkthroughThis PR extends button settings to support analog button types. Helper functions map button type IDs and generate analog-specific options. The ChangesAnalog Button Type Support
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@wled00/data/settings_time.htm`:
- Around line 309-311: The label "Double press (n/a)" is misleading because the
select named "MD${b}" is actually hydrated from button.macroDoublePress in
wled00/xml.cpp; either rename the label to "Double press" to reflect it's
functional or make the control non-editable/disabled if the firmware still
ignores the value. Update the HTML in settings_time.htm to change the <label>
text for the select with name "MD${b}" (or add the disabled attribute/class) and
ensure consistency with the button.macroDoublePress usage in wled00/xml.cpp so
the UI accurately represents whether the value is applied.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 8bec5088-0633-4560-b48a-0fece4a75f8f
📒 Files selected for processing (2)
wled00/data/settings_time.htmwled00/xml.cpp
| <div class="ba"> | ||
| <label>Double press (n/a)</label> | ||
| <select name="MD${b}" class="s" required>${presetOpts}</select> |
There was a problem hiding this comment.
Rename this field or actually disable it.
This select is now hydrated from button.macroDoublePress in wled00/xml.cpp Line 631, so labeling it Double press (n/a) is misleading. Either call it Double press or keep it non-editable if the firmware still ignores the value.
✏️ Proposed text fix
- <label>Double press (n/a)</label>
+ <label>Double press</label>🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@wled00/data/settings_time.htm` around lines 309 - 311, The label "Double
press (n/a)" is misleading because the select named "MD${b}" is actually
hydrated from button.macroDoublePress in wled00/xml.cpp; either rename the label
to "Double press" to reflect it's functional or make the control
non-editable/disabled if the firmware still ignores the value. Update the HTML
in settings_time.htm to change the <label> text for the select with name
"MD${b}" (or add the disabled attribute/class) and ensure consistency with the
button.macroDoublePress usage in wled00/xml.cpp so the UI accurately represents
whether the value is applied.
| buttonBlock.innerHTML = ` | ||
| <div class="bh">Button ${i} - ${typeName}</div> | ||
| <div class="bs"> | ||
| <input type="hidden" name="MP${b}" value="0"> |
There was a problem hiding this comment.
do we require the hidden values? i.e. they are set to default zero in firmware if missing, see set.cpp
| if (t===undefined) t = 0; | ||
| var b = String.fromCharCode((i<10?48:55)+i); | ||
| var presetOpts = '<option value="0">Default Action</option>' + sortedPresetOptions; | ||
| var analog = isAnalogBtn(t); |
There was a problem hiding this comment.
single use variable adds code for no benefit
|
thanks, looks good to me, just two minor things. edit: |
This fixes the issues noted in #5613 (comment)
This also adds clarification for the differences between analog and digital inputs. Showing and hiding dropdowns as needed to make those selections clearer.