commander: fix broken 'commander arm/disarm' CLI

Regression from https://github.com/PX4/Firmware/pull/13613.

VEHICLE_CMD_COMPONENT_ARM_DISARM from CLI would enter the
ARMING_STATE_IN_AIR_RESTORE logic. This was never intended for disarming
(and leads to state machine transition failures), and IMO it is also not
intended for commands from CLI.
This commit is contained in:
Beat Küng
2020-02-20 10:45:12 +01:00
committed by Daniel Agar
parent 20276d4ff8
commit 116a094e31
2 changed files with 6 additions and 2 deletions
+5 -2
View File
@@ -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<int>(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 {