mavlink: Safely avoid send the same vehicle_command and vehicle_command_ack back

The previous approach was checking system id and component id but it
will not work in 100% of cases as external devices can send MAVLink
message with the right system id but with broadcast component id.
This commit is contained in:
José Roberto de Souza
2017-08-08 21:46:30 +02:00
committed by Lorenz Meier
parent 89a428fbfe
commit 7c268f4fa1
5 changed files with 16 additions and 9 deletions
+1 -4
View File
@@ -462,10 +462,7 @@ protected:
if (_cmd_sub->update(&_cmd_time, &cmd)) {
/* only send commands for other systems/components, don't forward broadcast commands */
if ((cmd.target_system != mavlink_system.sysid || cmd.target_component != mavlink_system.compid) &&
(cmd.target_system != 0)) {
if (!cmd.from_external) {
if (_mavlink->verbose()) {
PX4_INFO("sending command %d to %d/%d", cmd.command, cmd.target_system, cmd.target_component);
}