sm_led_indication
=================
State machine mapping operating and fault states to RGB LED indication states.
Inherited Component
-------------------
- :doc:`Status_Indication_Manager `
Inherited Requirements
----------------------
- :doc:`REQ-IFC-005 `
- :doc:`REQ-DIA-003 `
Relationship Diagram
--------------------
.. image:: /_static/sw_unit_uml/sm_led_indication_be8f98bd-0265-4e8f-95ec-b60afe9779f5_uml.svg
:alt: UML class diagram for sm_led_indication
:class: dblclick-open-image
SW Unit Relations
-----------------
Incoming Relations
~~~~~~~~~~~~~~~~~~
.. list-table::
:header-rows: 1
* - Relation
- UML Type
- Visibility
- Source Unit
- Description
* - :doc:`SWR-006 `
- composition
- private
- :doc:`ao_status_indication `
- Status indication active object embeds LED indication state machine.
Data Types
----------
.. _dt-d1dc04e4-712b-41dc-bf6b-57e679c632b7:
.. raw:: html
sm_led_indication_contextstruct
Internal runtime context for sm_led_indication.
.. rubric:: Struct Members
.. list-table::
:header-rows: 1
* - Name
- Type
- Description
* - sm_state
- :ref:`uint8_t `
- LED SM current state.
* - pattern_code
- :ref:`uint8_t `
- Active pattern code.
* - blink_enabled
- :ref:`bool `
- Blink state.
* - transition_tick
- :ref:`uint32_t `
- Last transition tick.
.. _dt-0994811c-ec75-4994-9f33-872d91ca16f3:
.. raw:: html
sm_led_indication_eventstruct
Event payload handled by sm_led_indication.
.. rubric:: Struct Members
.. list-table::
:header-rows: 1
* - Name
- Type
- Description
* - signal_id
- :ref:`uint16_t `
- LED SM event id.
* - mode_code
- :ref:`uint8_t `
- Mode code input.
* - warning_active
- :ref:`bool `
- Warning input.
* - fault_active
- :ref:`bool `
- Fault input.
.. _dt-95793e0d-98bd-4579-9da5-65538737c15f:
.. raw:: html
sm_led_indication_resultenum
Result code for sm_led_indication operations.
.. rubric:: Enum Members
.. list-table::
:header-rows: 1
* - Name
- Value
- Description
* - OK
- 0
- LED SM transition applied.
* - INVALID_TRANSITION
- 1
- Transition rejected by guard.
* - PATTERN_LATCHED
- 2
- Fault pattern latched.
Attributes
----------
.. list-table::
:header-rows: 1
* - Attribute
- Type
- Visibility
- Description
* - ctx
- :ref:`sm_led_indication_context `
- private
- Runtime context for sm_led_indication state timing and error tracking.
Methods
-------
dispatch
~~~~~~~~
- **Return Type:** :ref:`sm_led_indication_result `
- **Visibility:** public
- **Description:** Process one sm_led_indication event and update runtime outputs.
.. rubric:: Parameters
.. list-table::
:header-rows: 1
* - Name
- Type
- Direction
- Description
* - event
- :ref:`sm_led_indication_event `
- in
- Process one sm_led_indication event and update runtime outputs.
init
~~~~
- **Return Type:** :ref:`sm_led_indication_result `
- **Visibility:** public
- **Description:** Initialize sm_led_indication runtime state and dependencies.
Dynamic Behaviour
-----------------
State Machines
~~~~~~~~~~~~~~
sm_led_indication_state
^^^^^^^^^^^^^^^^^^^^^^^
.. uml::
@startuml
hide empty description
[*] --> Led_Off
Led_Off --> Led_Normal : EVT_STATUS_NORMAL
Led_Normal --> Led_Warning : EVT_STATUS_WARNING
Led_Warning --> Led_Normal : EVT_STATUS_NORMAL
Led_Normal --> Led_Protective : EVT_STATUS_PROTECTIVE
Led_Warning --> Led_Protective : EVT_STATUS_PROTECTIVE
Led_Protective --> Led_Normal : EVT_STATUS_NORMAL
Led_Normal --> Led_Fault : EVT_FAULT_SET
Led_Warning --> Led_Fault : EVT_FAULT_SET
Led_Protective --> Led_Fault : EVT_FAULT_SET
Led_Fault --> Led_Normal : EVT_FAULT_CLEAR
Led_Normal : do / set_led(GREEN)
Led_Warning : do / set_led(YELLOW)
Led_Protective : do / set_led(RED_BLINK)
Led_Fault : do / set_led(RED_SOLID)
@enduml
This state machine defines LED priority rules mapping normal warning protective and fault context into deterministic visual indications and ensures fault signaling dominates lower severity status outputs until explicit clear.
Sequence Diagrams
~~~~~~~~~~~~~~~~~
SEQ-003_Status_To_LED_Indication
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. uml::
@startuml
hide footbox
title Diagnostic Status To LED Indication
participant ao_diagnostics
participant ao_status_indication
participant sm_led_indication
participant drv_rgb_led
ao_diagnostics -> ao_status_indication : IF_OperatingStatus(system_status)
ao_status_indication -> sm_led_indication : evaluate indication pattern
sm_led_indication -> ao_status_indication : resolved LED intent
ao_status_indication -> drv_rgb_led : IF_StatusLedCommand(led_command)
@enduml
Diagnostics status outputs are transformed by status indication logic into concrete LED driver commands.