mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-27 10:17:45 +08:00
commander: handle system broadcast commands
This changes the command handling logic to accept commands which are targeted at any system, signaled by target_system set to 0.
This commit is contained in:
@@ -713,9 +713,9 @@ Commander::Commander() :
|
|||||||
bool
|
bool
|
||||||
Commander::handle_command(const vehicle_command_s &cmd)
|
Commander::handle_command(const vehicle_command_s &cmd)
|
||||||
{
|
{
|
||||||
/* only handle commands that are meant to be handled by this system and component */
|
/* only handle commands that are meant to be handled by this system and component, or broadcast */
|
||||||
if (cmd.target_system != _status.system_id || ((cmd.target_component != _status.component_id)
|
if (((cmd.target_system != _status.system_id) && (cmd.target_system != 0))
|
||||||
&& (cmd.target_component != 0))) { // component_id 0: valid for all components
|
|| ((cmd.target_component != _status.component_id) && (cmd.target_component != 0))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user