From 342e9900f8b73e7eae4aeb93a48f1a202cc49d74 Mon Sep 17 00:00:00 2001 From: Silvan Fuhrer Date: Fri, 25 Jun 2021 16:40:34 +0200 Subject: [PATCH] vtol main: only guard against transition to FW in certain flight modes, never to MC Signed-off-by: Silvan Fuhrer --- .../vtol_att_control/vtol_att_control_main.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/modules/vtol_att_control/vtol_att_control_main.cpp b/src/modules/vtol_att_control/vtol_att_control_main.cpp index 9e99380f62..bedce885a0 100644 --- a/src/modules/vtol_att_control/vtol_att_control_main.cpp +++ b/src/modules/vtol_att_control/vtol_att_control_main.cpp @@ -150,11 +150,12 @@ void VtolAttitudeControl::vehicle_cmd_poll() uint8_t result = vehicle_command_ack_s::VEHICLE_RESULT_ACCEPTED; - // deny any transition in auto takeoff mode, plus transition from RW to FW in land or RTL mode - if (vehicle_status.nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_TAKEOFF - || (vehicle_status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING - && (vehicle_status.nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_LAND - || vehicle_status.nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_RTL))) { + // deny transition from MC to FW in Takeoff, Land, RTL and Orbit + if (int(vehicle_command.param1 + 0.5f) == vtol_vehicle_status_s::VEHICLE_VTOL_STATE_FW && + (vehicle_status.nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_TAKEOFF + || vehicle_status.nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_LAND + || vehicle_status.nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_RTL + || vehicle_status.nav_state == vehicle_status_s::NAVIGATION_STATE_ORBIT)) { result = vehicle_command_ack_s::VEHICLE_RESULT_TEMPORARILY_REJECTED;