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.
This commit is contained in:
Matthias Grob 2019-04-25 20:51:58 +01:00 committed by Lorenz Meier
parent f177a68da9
commit 3bf5d6af12
1 changed files with 3 additions and 2 deletions

View File

@ -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); || (_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 // 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) const bool should_evaluate_rc_mode_switch = first_time_rc
&& some_switch_changed); || position_got_valid
|| (rc_values_updated && some_switch_changed);
if (!should_evaluate_rc_mode_switch) { if (!should_evaluate_rc_mode_switch) {