Operation

Asset Tracker Template

tags
Asset Tracker Template

Instead of using a state machine, the LED module operates as follows:

  1. When a message is received on the led_chan channel:

    • Any existing blink pattern is canceled.
    • The new LED state (colors and timing) is saved.
    • The LED is turned on with the specified color.
  2. If a blinking pattern is specified (repetitions != 0):

    • A timer is started with duration_on_msec.
    • When the timer expires, the LED toggles between on and off states.
    • The timer alternates between duration_on_msec and duration_off_msec.
    • This continues until the specified number of repetitions is reached.
    • If repetitions is -1, the blinking continues indefinitely or until a new message is received.

The module handles error cases gracefully and reports issues through logging.