From 82bee2bf543120679f4c147f5f9aef3584ab599f Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Wed, 14 Aug 2019 16:06:15 +0200 Subject: [PATCH] mavlink: match commands aimed at any sysid/compid When we send a command to any sysid or any compid, we need to match an ack from a specific sysid or compid. If we don't do that, we keep sending retransmissions and eventually time out. --- src/modules/mavlink/mavlink_command_sender.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/mavlink/mavlink_command_sender.cpp b/src/modules/mavlink/mavlink_command_sender.cpp index 7ca7600bad..841de386a1 100644 --- a/src/modules/mavlink/mavlink_command_sender.cpp +++ b/src/modules/mavlink/mavlink_command_sender.cpp @@ -123,8 +123,8 @@ void MavlinkCommandSender::handle_mavlink_command_ack(const mavlink_command_ack_ while (command_item_t *item = _commands.get_next()) { // Check if the incoming ack matches any of the commands that we have sent. if (item->command.command == ack.command && - from_sysid == item->command.target_system && - from_compid == item->command.target_component && + (item->command.target_system == 0 || from_sysid == item->command.target_system) && + (item->command.target_component == 0 || from_compid == item->command.target_component) && item->num_sent_per_channel[channel] != -1) { item->num_sent_per_channel[channel] = -2; // mark this as acknowledged break;