Skip to content

Commit

Permalink
Rover: reuse set-mode-by-number method
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker authored and rmackay9 committed Sep 1, 2021
1 parent 0a8e157 commit 96be74b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Rover/RC_Channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 96be74b

Please sign in to comment.