Add led serial command for RGB LED control - #2772
Open
loratrak wants to merge 1 commit into
Open
Conversation
The `led` command was listed in `help` but never registered with the CLI, so typing it in the terminal returned "Command not found". Its help entry also described it as changing the UI main color, which is what the existing `screen color` command does. Register a real `led` composite command that drives the physical RGB LED: led r|g|b <0-255> change a single channel, keeping the other two led rgb <r> <g> <b> set the full color led hex <RRGGBB> set the full color led brightness <0-100> aliases: br, bright led effect <0-9> 0 selects the solid color led off The callbacks write through bruceConfig and call ledSetup() instead of touching leds[] directly. When an effect is active its task reads the color, effect, speed and direction straight from bruceConfig, so a direct write would be overwritten on the next frame. As a side effect the change persists across reboots, matching the behaviour of the LED settings menu. The whole translation unit is guarded by HAS_RGB_LED: led_control.h only declares its API under that define, and PlatformIO compiles every source file regardless of the target board. Also fix the help text. The UI section now documents the real `screen` commands, and a new "RGB LED Commands" section is printed only on boards that actually have an RGB LED. Built for m5stack-cardputer (HAS_RGB_LED) and Marauder-Mini (without it).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
ledcommand is listed in the CLIhelpoutput but was never registered with the CLI, so typing it in the serial terminal returnsERROR: Command not found. The help entry also describes it as changing the UI main color, which is what the existingscreen color rgb/screen color hexcommands already do.Change
Register a real
ledcomposite command that drives the physical RGB LED:The callbacks write through
bruceConfigand callledSetup()instead of touchingleds[]directly. When an effect is active, its task reads the color, effect, speed and direction straight frombruceConfig(led_control.cpp), so a direct write would be overwritten on the next frame. As a side effect the change persists across reboots, matching the behaviour of the LED settings menu.The whole translation unit is guarded by
HAS_RGB_LED:led_control.honly declares its API under that define, and PlatformIO compiles every source file regardless of the target board.The help text is fixed as well. The UI section now documents the real
screencommands, and a new "RGB LED Commands" section is printed only on boards that actually have an RGB LED.Testing
Built successfully for
m5stack-cardputerandLilygo-t-embed-cc1101(hasHAS_RGB_LED) andMarauder-Mini(does not), covering both sides of the guard. Tested only on Lilygo-t-embed-cc1101🤖 Generated with Claude Code and double checked by me ;-)