From 5a8eca75bfee7aa1e8e7107ad089ee924736b96f Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 20 Apr 2015 22:00:36 +0200 Subject: Commander: Fix RTL mode switch logic --- src/modules/commander/commander.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index 3fecd9f58..948543714 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -2237,14 +2237,14 @@ set_main_state_rc(struct vehicle_status_s *status_local, struct manual_control_s /* fallback to LOITER if home position not set */ res = main_state_transition(status_local,vehicle_status_s::MAIN_STATE_AUTO_LOITER); + } - if (res != TRANSITION_DENIED) { - /* changed successfully or already in this state */ - return res; - } - - /* mode rejected, continue to evaluate the main system mode */ + if (res != TRANSITION_DENIED) { + /* changed successfully or already in this state */ + return res; } + + /* if we get here mode was rejected, continue to evaluate the main system mode */ } /* offboard and RTL switches off or denied, check main mode switch */ -- cgit v1.2.3