mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 04:03:34 +08:00
lib/led: error if dropping ORB_ID(led_control) messages
This commit is contained in:
@@ -41,11 +41,18 @@
|
||||
int LedController::update(LedControlData &control_data)
|
||||
{
|
||||
while (_led_control_sub.updated() || _force_update) {
|
||||
const unsigned last_generation = _led_control_sub.get_last_generation();
|
||||
|
||||
// handle new state
|
||||
led_control_s led_control;
|
||||
|
||||
if (_led_control_sub.copy(&led_control)) {
|
||||
|
||||
if ((_led_control_sub.get_last_generation() != last_generation + 1)
|
||||
&& (_led_control_sub.get_last_generation() != last_generation)) {
|
||||
PX4_ERR("led_control lost, generation %d -> %d", last_generation, _led_control_sub.get_last_generation());
|
||||
}
|
||||
|
||||
// don't apply the new state just yet to avoid interrupting an ongoing blinking state
|
||||
for (int i = 0; i < BOARD_MAX_LEDS; ++i) {
|
||||
if (led_control.led_mask & (1 << i)) {
|
||||
|
||||
Reference in New Issue
Block a user