Rover: reuse set-mode-by-number method

This commit is contained in:
Peter Barker 2021-08-25 12:02:31 +10:00 committed by Randy Mackay
parent 0a8e1575b1
commit 96be74bdc2
1 changed files with 2 additions and 4 deletions

View File

@ -21,10 +21,8 @@ void RC_Channel_Rover::mode_switch_changed(modeswitch_pos_t new_pos)
// should not have been called // should not have been called
return; return;
} }
Mode *new_mode = rover.mode_from_mode_num((Mode::Number)rover.modes[new_pos].get());
if (new_mode != nullptr) { rover.set_mode((Mode::Number)rover.modes[new_pos].get(), ModeReason::RC_COMMAND);
rover.set_mode(*new_mode, ModeReason::RC_COMMAND);
}
} }
// init_aux_switch_function - initialize aux functions // init_aux_switch_function - initialize aux functions