lib/led: add some clarifying comments

This commit is contained in:
Beat Küng
2017-02-24 10:25:10 +01:00
committed by Lorenz Meier
parent df791cef94
commit b7f5d92b21
2 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -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
View File
@@ -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;
};