mavlink_command_sender: fix logic after first test

- change/add a few printfs so they make more sense
- don't accidentally ignore command_acks
- don't forward commands to the same component id, and don't forward
  commands that are broadcast to all components (target component 0)
This commit is contained in:
Julian Oes
2017-07-08 11:52:23 +02:00
committed by Lorenz Meier
parent af0107ae0a
commit e6d31f951c
3 changed files with 12 additions and 7 deletions
+9 -4
View File
@@ -455,10 +455,15 @@ protected:
if (_cmd_sub->update(&_cmd_time, &cmd)) {
/* only send commands for other systems/components */
//if (cmd.target_system != mavlink_system.sysid || cmd.target_component != mavlink_system.compid) {
MavlinkCommandSender::instance().handle_vehicle_command(cmd, _mavlink->get_channel());
//}
/* 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_component != MAV_COMP_ID_ALL)) {
PX4_INFO("sending command %d to %d/%d", cmd.command, cmd.target_system, cmd.target_component);
MavlinkCommandSender::instance().handle_vehicle_command(cmd, _mavlink->get_channel());
} else {
PX4_INFO("not forwarding command %d to %d/%d", cmd.command, cmd.target_system, cmd.target_component);
}
}
MavlinkCommandSender::instance().check_timeout(_mavlink->get_channel());