feat(radio): add more power LED color overrides#7454
Conversation
📝 WalkthroughWalkthroughThe PR expands power LED selection from blue-only to six compile-time colors. It adds RGB driver functions, board-specific declarations and startup wiring, status LED capability validation, strip support, and corrected option preprocessor conditionals. ChangesPower LED Color Selection Extension
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant BuildConfiguration
participant BoardStartup
participant LEDDriver
participant StatusLED
BuildConfiguration->>BoardStartup: provide POWER_LED_* compile definition
BoardStartup->>LEDDriver: call selected led{Color}()
LEDDriver-->>BoardStartup: apply RGB output
StatusLED->>LEDDriver: invoke LED_ERROR_END or LED_BIND mapping
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Support additional POWER_LED_* build options and validate that only one color override is enabled at a time. Extend the generic STM32 LED driver to handle RGB combinations for yellow, magenta, and cyan.
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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 `@radio/src/edgetx.h`:
- Around line 618-620: In the LED macro fallback `#else` block, add a LED_BIND()
definition alongside LED_ERROR_END(). Assign it the appropriate fallback LED
color used by this branch so callers such as bind_button_driver.cpp compile
successfully when no green LED is available.
- Around line 594-596: Add a capability validation branch alongside the existing
POWER_LED_GREEN check in the preprocessor configuration, using POWER_LED_BLUE
and the board’s corresponding blue-LED capability macro. Emit a compile-time
error when POWER_LED_BLUE is explicitly enabled without supported blue LED
hardware, while preserving the existing green validation.
In `@radio/src/targets/pa01/board.cpp`:
- Around line 389-393: Replace the conditional power-LED selection in
radio/src/targets/pa01/board.cpp lines 389-393 and
radio/src/boards/rm-h750/board.cpp lines 171-175 with exhaustive preprocessor
mapping: each POWER_LED_BLUE, POWER_LED_GREEN, POWER_LED_YELLOW,
POWER_LED_MAGENTA, POWER_LED_CYAN, and POWER_LED_WHITE macro must invoke its
corresponding led*() function, preserving the correct selection for every
supported color.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ba996555-5310-4b85-b904-20f50de4f51b
📒 Files selected for processing (17)
radio/src/CMakeLists.txtradio/src/boards/generic_stm32/led_driver.cppradio/src/boards/jumper-h750/board.cppradio/src/boards/jumper-h750/board.hradio/src/boards/rm-h750/board.cppradio/src/boards/rm-h750/board.hradio/src/edgetx.hradio/src/options.hradio/src/targets/horus/board.hradio/src/targets/pa01/CMakeLists.txtradio/src/targets/pa01/board.cppradio/src/targets/pa01/board.hradio/src/targets/pa01/led_driver.cppradio/src/targets/pl18/CMakeLists.txtradio/src/targets/pl18/board.hradio/src/targets/pl18/led_driver.cppradio/src/targets/st16/board.h
🚧 Files skipped from review as they are similar to previous changes (5)
- radio/src/options.h
- radio/src/boards/rm-h750/board.h
- radio/src/boards/generic_stm32/led_driver.cpp
- radio/src/boards/jumper-h750/board.h
- radio/src/CMakeLists.txt
Summary of changes:
Support additional POWER_LED_* build options and validate that only one color override is enabled at a time. Extend the generic STM32 LED driver to handle RGB combinations for yellow, magenta, and cyan. (except red)
Summary by CodeRabbit