Skip to content

Commit

Permalink
Plane: reuse set_mode_by_number implementation
Browse files Browse the repository at this point in the history
Was just duplicated
  • Loading branch information
peterbarker authored and rmackay9 committed Sep 1, 2021
1 parent 44a72cf commit 0a8e157
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions ArduPlane/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,8 @@ bool Plane::set_mode(Mode &new_mode, const ModeReason reason)
bool Plane::set_mode(const uint8_t new_mode, const ModeReason reason)
{
static_assert(sizeof(Mode::Number) == sizeof(new_mode), "The new mode can't be mapped to the vehicles mode number");
Mode *mode = plane.mode_from_mode_num(static_cast<Mode::Number>(new_mode));
if (mode == nullptr) {
gcs().send_text(MAV_SEVERITY_INFO, "Error: invalid mode number: %u", (unsigned)new_mode);
return false;
}
return set_mode(*mode, reason);

return set_mode_by_number(static_cast<Mode::Number>(new_mode), reason);
}

bool Plane::set_mode_by_number(const Mode::Number new_mode_number, const ModeReason reason)
Expand Down

0 comments on commit 0a8e157

Please sign in to comment.