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.
This commit is contained in:
Julian Oes
2019-08-14 16:06:15 +02:00
committed by Daniel Agar
parent a4fb18a6c4
commit 82bee2bf54
@@ -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;