diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index a7e58d8b9d..97c8fd5788 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -785,6 +785,7 @@ PX4IO::init() /* send command to arm system via command API */ vcmd.timestamp = hrt_absolute_time(); vcmd.param1 = 1.0f; /* request arming */ + vcmd.param3 = 1234.f; /* mark the command coming from IO (for in-air restoring) */ vcmd.command = vehicle_command_s::VEHICLE_CMD_COMPONENT_ARM_DISARM; /* send command once */ diff --git a/src/modules/commander/Commander.cpp b/src/modules/commander/Commander.cpp index 75e6162dd6..3116cbb063 100644 --- a/src/modules/commander/Commander.cpp +++ b/src/modules/commander/Commander.cpp @@ -691,8 +691,11 @@ Commander::handle_command(vehicle_status_s *status_local, const vehicle_command_ break; } - // Flick to inair restore first if this comes from an onboard system - if (cmd.source_system == status_local->system_id && cmd.source_component == status_local->component_id) { + const bool cmd_from_io = (static_cast(roundf(cmd.param3)) == 1234); + + // Flick to inair restore first if this comes from an onboard system and from IO + if (cmd.source_system == status_local->system_id && cmd.source_component == status_local->component_id + && cmd_from_io && cmd_arms) { status.arming_state = vehicle_status_s::ARMING_STATE_IN_AIR_RESTORE; } else {