mavlink: fix incorrect rejection of forwarded alien commands

This commit is contained in:
Oleg 2021-07-09 12:03:07 +03:00 committed by Julian Oes
parent d8704cee67
commit 76b34132a5
1 changed files with 5 additions and 1 deletions

View File

@ -462,7 +462,11 @@ void MavlinkReceiver::handle_message_command_both(mavlink_message_t *msg, const
uint8_t result = vehicle_command_ack_s::VEHICLE_RESULT_ACCEPTED;
if (!target_ok) {
acknowledge(msg->sysid, msg->compid, cmd_mavlink.command, vehicle_command_ack_s::VEHICLE_RESULT_FAILED);
if (!_mavlink->get_forwarding_on()) {
// Reject alien commands only if there is no forwarding enabled
acknowledge(msg->sysid, msg->compid, cmd_mavlink.command, vehicle_command_ack_s::VEHICLE_RESULT_FAILED);
}
return;
}