Make button timing constants overridable - #5844
Conversation
WLED_DEBOUNCE_THRESHOLD, WLED_LONG_PRESS and WLED_DOUBLE_PRESS were plain #defines, so a custom value could only be set by editing button.cpp directly. Guard them with #ifndef, matching the existing WLED_PWM_FREQ pattern, so they can be set per-board via build_flags in platformio_override.ini instead.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. WalkthroughThe button timing macros now use individual guards. Build-provided values remain unchanged, while defaults remain 50 ms, 600 ms, and 350 ms. ChangesButton timing configuration
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Feature Merge Risk: ⚪ Minimal · up to The change is limited to configurable button timing defaults and retains existing behavior when no overrides are supplied. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
Summary
button.cppdirectly. This update allows overriding default button timing via build flags. (E.g.,WLED_DEBOUNCE_THRESHOLD,WLED_LONG_PRESS,WLED_DOUBLE_PRESS)#ifndef(matching the existingWLED_PWM_FREQpattern), so they can instead be set per-board viabuild_flagsinplatformio_override.iniHow I tested...
-D WLED_LONG_PRESS=2000) viaplatformio_override.iniand confirmed the new value takes effectUsage...
Example override in
platformio_override.ini:Summary by CodeRabbit