diff --git a/src/lib/led/led.cpp b/src/lib/led/led.cpp index 4da5481c3d..97c0a4ff54 100644 --- a/src/lib/led/led.cpp +++ b/src/lib/led/led.cpp @@ -70,7 +70,7 @@ int LedController::update(LedControlData &control_data) // handle state updates hrt_abstime now = hrt_absolute_time(); - uint16_t blink_delta_t = (uint16_t)((now - _last_update_call) / 100); + uint16_t blink_delta_t = (uint16_t)((now - _last_update_call) / 100); // Note: this is in 0.1ms for (int i = 0; i < BOARD_MAX_LEDS; ++i) { bool do_not_change_state = false; @@ -106,7 +106,7 @@ int LedController::update(LedControlData &control_data) _states[i].current_blinking_time -= current_blink_duration; if (cur_data.blink_times_left == 254) { - // handle toggling for infinite case + // handle toggling for infinite case: toggle between 254 and 255 cur_data.blink_times_left = 255; do_not_change_state = true; diff --git a/src/lib/led/led.h b/src/lib/led/led.h index b2150b4e00..b22e6f747b 100644 --- a/src/lib/led/led.h +++ b/src/lib/led/led.h @@ -91,12 +91,12 @@ public: */ int update(LedControlData &control_data); - static const int BLINK_FAST_DURATION = 100 * - 1000; ///< duration of half a blinking cycle (on-to-off and off-to-on) in us - static const int BLINK_NORMAL_DURATION = 500 * - 1000; ///< duration of half a blinking cycle (on-to-off and off-to-on) in us - static const int BLINK_SLOW_DURATION = 2000 * - 1000; ///< duration of half a blinking cycle (on-to-off and off-to-on) in us + static const int BLINK_FAST_DURATION = 100 * 1000; /**< duration of half a blinking cycle + (on-to-off and off-to-on) in us */ + static const int BLINK_NORMAL_DURATION = 500 * 1000; /**< duration of half a blinking cycle + (on-to-off and off-to-on) in us */ + static const int BLINK_SLOW_DURATION = 2000 * 1000; /**< duration of half a blinking cycle + (on-to-off and off-to-on) in us */ int led_control_subscription() const { return _led_control_sub; } @@ -135,7 +135,7 @@ private: struct PerLedData { PerPriorityData priority[led_control_s::MAX_PRIORITY + 1]; - uint16_t current_blinking_time = 0; ///< how long the Led was in current state (in 0.1 ms) + uint16_t current_blinking_time = 0; ///< how long the Led was in current state (in 0.1 ms, wraps if > 6.5s) NextState next_state; };