From e303bae86b1b95f8e98c72687dd681a2803b10f7 Mon Sep 17 00:00:00 2001 From: Xander Gerrmann Date: Mon, 26 Mar 2018 23:19:35 +0200 Subject: [PATCH] Changed !(x==y) to (x!=y). Unadvertise when a different control group is published. --- src/modules/mavlink/mavlink_receiver.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modules/mavlink/mavlink_receiver.cpp b/src/modules/mavlink/mavlink_receiver.cpp index e638d33ddbd2..6671b2c53b9e 100644 --- a/src/modules/mavlink/mavlink_receiver.cpp +++ b/src/modules/mavlink/mavlink_receiver.cpp @@ -1057,11 +1057,14 @@ MavlinkReceiver::handle_message_set_actuator_control_target(mavlink_message_t *m actuator_controls.timestamp = hrt_absolute_time(); uint8_t control_group = set_actuator_control_target.group_mlx; static int8_t control_group_previous = -1; - /* Set duty cycles for the servos in actuator_controls_0 */ + memcpy(actuator_controls.control, set_actuator_control_target.controls, 8 * sizeof(float)); /* Reset orb advertising when current control group is unequal to the previous control group */ - if (!(control_group == control_group_previous)) { + if (control_group != control_group_previous) { + + orb_unadvertise(_actuator_controls_pub); + _actuator_controls_pub = nullptr; }