|
|
|
@ -51,10 +51,11 @@ int LedController::update(LedControlData &control_data)
@@ -51,10 +51,11 @@ int LedController::update(LedControlData &control_data)
|
|
|
|
|
|
|
|
|
|
orb_check(_led_control_sub, &updated); |
|
|
|
|
|
|
|
|
|
while (updated) { |
|
|
|
|
while (updated || _force_update) { |
|
|
|
|
// handle new state
|
|
|
|
|
led_control_s led_control; |
|
|
|
|
orb_copy(ORB_ID(led_control), _led_control_sub, &led_control); |
|
|
|
|
|
|
|
|
|
if (orb_copy(ORB_ID(led_control), _led_control_sub, &led_control) == 0) { |
|
|
|
|
|
|
|
|
|
// don't apply the new state just yet to avoid interrupting an ongoing blinking state
|
|
|
|
|
for (int i = 0; i < BOARD_MAX_LEDS; ++i) { |
|
|
|
@ -62,6 +63,9 @@ int LedController::update(LedControlData &control_data)
@@ -62,6 +63,9 @@ int LedController::update(LedControlData &control_data)
|
|
|
|
|
_states[i].next_state.set(led_control); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_force_update = false; |
|
|
|
|
|
|
|
|
|
orb_check(_led_control_sub, &updated); |
|
|
|
|
} |
|
|
|
|