From 0a8e1575b14700dd91ab3b86783fa714878a7ccf Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 25 Aug 2021 11:48:08 +1000 Subject: [PATCH] Plane: reuse set_mode_by_number implementation Was just duplicated --- ArduPlane/system.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ArduPlane/system.cpp b/ArduPlane/system.cpp index 1bbaee02cdc021..ab15717ac2ff40 100644 --- a/ArduPlane/system.cpp +++ b/ArduPlane/system.cpp @@ -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(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(new_mode), reason); } bool Plane::set_mode_by_number(const Mode::Number new_mode_number, const ModeReason reason)