mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-07 17:35:22 +08:00
lib/led: add some clarifying comments
This commit is contained in:
+2
-2
@@ -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;
|
||||
|
||||
|
||||
+7
-7
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user