Skip to content

Use RGB LED on MCU for status info#277

Merged
pwittich merged 6 commits intomasterfrom
feature/mcu_status_led
Apr 17, 2026
Merged

Use RGB LED on MCU for status info#277
pwittich merged 6 commits intomasterfrom
feature/mcu_status_led

Conversation

@pwittich
Copy link
Copy Markdown
Contributor

This pull request implements a unified and extensible RGB LED status signaling system for the MCU, replacing the old per-channel LED control with a message-based approach. It introduces a new LedMsg_t structure for atomic RGB LED state updates, defines a set of standard LED status patterns for key system states, and updates all relevant tasks and the CLI to use the new system. The documentation is also expanded to describe LED behavior and usage.

Core LED System Refactor:

  • Introduced LedMsg_t struct and enum LEDpattern for atomic RGB LED control, replacing individual channel commands and constants. The LED task now receives full RGB state messages and applies patterns (solid, blink at various rates) via a queue (xLedQueue). Predefined status messages (e.g., LED_STATUS_NORMAL, LED_STATUS_WARN) are provided for common system states. (projects/cm_mcu/Tasks.h, projects/cm_mcu/LedTask.c, projects/cm_mcu/cm_mcu.c, [1] [2] [3]

  • Refactored the LED task to use the new LedMsg_t message type, supporting atomic updates and consistent blinking patterns for all RGB channels. Legacy per-channel command handling is removed. (projects/cm_mcu/LedTask.c, projects/cm_mcu/LedTask.cL26-R70)

System State Integration:

  • Updated system tasks (InitTask, PowerSupplyTask, GenericAlarmTask) to send the appropriate predefined LED status message to xLedQueue when changing states, ensuring the LED always reflects the current system condition. (projects/cm_mcu/InitTask.c, projects/cm_mcu/PowerSupplyTask.c, projects/cm_mcu/GenericAlarmTask.c, [1] [2] [3] [4]

  • Extended alarm task parameters (GenericAlarmParams_t) to include pointers to LED status messages for warning, alarm, and normal states, allowing flexible LED signaling for different alarm types. (projects/cm_mcu/AlarmUtilities.h, projects/cm_mcu/AlarmUtilities.c, [1] [2]

CLI and Bootloader Support:

  • Reworked the led CLI command to accept symbolic state names (e.g., normal, warn) and send the corresponding LedMsg_t message for debugging and manual override. (projects/cm_mcu/CommandLineTask.c, projects/cm_mcu/commands/SensorControl.c, [1] [2]

  • Updated the bootloader command to directly set the LED to white (all channels on) as a visual indicator before jumping to the bootloader. (projects/cm_mcu/commands/SoftwareCommands.c, projects/cm_mcu/commands/SoftwareCommands.cR9-R20)

Documentation:

  • Added a comprehensive "LED Status Signals" section to the README, detailing each LED pattern, its meaning, and usage instructions for developers. (projects/cm_mcu/README.md, projects/cm_mcu/README.mdR78-R105)

@pwittich pwittich merged commit ff082d9 into master Apr 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant