From 3bf5d6af1208e3a57e32e4fb787b3037ef98bd93 Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Thu, 25 Apr 2019 20:51:58 +0100 Subject: [PATCH] commander: fix RC mode switch not getting applied after boot the condition to enter the rc mode switch evaluation was neglecting the first connection of an RC when "no RC switch changed". this means depending on the actual initialization values of _last_sp_man and the desired mode preselected on the RC while connecting it would not get evaluated. --- src/modules/commander/Commander.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/commander/Commander.cpp b/src/modules/commander/Commander.cpp index e39641feb7..f4c7a40914 100644 --- a/src/modules/commander/Commander.cpp +++ b/src/modules/commander/Commander.cpp @@ -2746,8 +2746,9 @@ Commander::set_main_state_rc(const vehicle_status_s &status_local, bool *changed || (_last_sp_man.man_switch != sp_man.man_switch); // only switch mode based on RC switch if necessary to also allow mode switching via MAVLink - const bool should_evaluate_rc_mode_switch = position_got_valid || ((first_time_rc || rc_values_updated) - && some_switch_changed); + const bool should_evaluate_rc_mode_switch = first_time_rc + || position_got_valid + || (rc_values_updated && some_switch_changed); if (!should_evaluate_rc_mode_switch) {