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:
Julian Oes
2024-11-07 17:10:05 +13:00
parent 25e071e21d
commit d8be547b06
+10
View File
@@ -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{};