From 96be74bdc25e5eaa166ea7721389deea6c92d044 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 25 Aug 2021 12:02:31 +1000 Subject: [PATCH] Rover: reuse set-mode-by-number method --- Rover/RC_Channel.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Rover/RC_Channel.cpp b/Rover/RC_Channel.cpp index 77168949644a5..430f747f5af6a 100644 --- a/Rover/RC_Channel.cpp +++ b/Rover/RC_Channel.cpp @@ -21,10 +21,8 @@ void RC_Channel_Rover::mode_switch_changed(modeswitch_pos_t new_pos) // should not have been called return; } - Mode *new_mode = rover.mode_from_mode_num((Mode::Number)rover.modes[new_pos].get()); - if (new_mode != nullptr) { - rover.set_mode(*new_mode, ModeReason::RC_COMMAND); - } + + rover.set_mode((Mode::Number)rover.modes[new_pos].get(), ModeReason::RC_COMMAND); } // init_aux_switch_function - initialize aux functions