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:
Julian Oes
2021-12-01 14:40:52 +01:00
committed by Daniel Agar
parent a2064cceff
commit a9b9362fea
+3 -3
View File
@@ -713,9 +713,9 @@ Commander::Commander() :
bool
Commander::handle_command(const vehicle_command_s &cmd)
{
/* only handle commands that are meant to be handled by this system and component */
if (cmd.target_system != _status.system_id || ((cmd.target_component != _status.component_id)
&& (cmd.target_component != 0))) { // component_id 0: valid for all components
/* 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_system != 0))
|| ((cmd.target_component != _status.component_id) && (cmd.target_component != 0))) {
return false;
}