mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 05:23:33 +08:00
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:
committed by
Lorenz Meier
parent
89a428fbfe
commit
7c268f4fa1
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user