mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 06:18:52 +08:00
mavlink: drop acks early that aren't for us
This fixes an issue where we dropped acks that we should have sent out just because the queue was clogged with acks that have nothing to do with us and just happen to be sent to us. We should just ignore them and not publish them to uORB.
This commit is contained in:
@@ -803,6 +803,16 @@ MavlinkReceiver::handle_message_command_ack(mavlink_message_t *msg)
|
||||
mavlink_command_ack_t ack;
|
||||
mavlink_msg_command_ack_decode(msg, &ack);
|
||||
|
||||
// We should not clog the command_ack queue with acks that are not for us.
|
||||
// Therefore, we drop them early and move on.
|
||||
bool target_ok = evaluate_target_ok(0, ack.target_system, ack.target_component);
|
||||
|
||||
if (!target_ok) {
|
||||
PX4_DEBUG("Drop ack %d for %d from %d/%d to %d/%d\n",
|
||||
ack.result, ack.command, msg->sysid, msg->compid, ack.target_system, ack.target_component);
|
||||
return;
|
||||
}
|
||||
|
||||
MavlinkCommandSender::instance().handle_mavlink_command_ack(ack, msg->sysid, msg->compid, _mavlink.get_channel());
|
||||
|
||||
vehicle_command_ack_s command_ack{};
|
||||
|
||||
Reference in New Issue
Block a user