From e6ccaeb2c96cc8987af388c29b21afdd868ef5a1 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 5 Sep 2024 12:35:23 +1000 Subject: [PATCH] Copter: rename RTLAltType enumeration entries removes redundant namespacing as this is enum class --- ArduCopter/AP_Arming.cpp | 4 ++-- ArduCopter/mode.h | 4 ++-- ArduCopter/mode_rtl.cpp | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ArduCopter/AP_Arming.cpp b/ArduCopter/AP_Arming.cpp index f33be96541..681e684dd0 100644 --- a/ArduCopter/AP_Arming.cpp +++ b/ArduCopter/AP_Arming.cpp @@ -179,7 +179,7 @@ bool AP_Arming_Copter::terrain_database_required() const } if (copter.wp_nav->get_terrain_source() == AC_WPNav::TerrainSource::TERRAIN_FROM_TERRAINDATABASE && - copter.mode_rtl.get_alt_type() == ModeRTL::RTLAltType::RTL_ALTTYPE_TERRAIN) { + copter.mode_rtl.get_alt_type() == ModeRTL::RTLAltType::TERRAIN) { return true; } return AP_Arming::terrain_database_required(); @@ -252,7 +252,7 @@ bool AP_Arming_Copter::parameter_checks(bool display_failure) // checks when using range finder for RTL #if MODE_RTL_ENABLED == ENABLED - if (copter.mode_rtl.get_alt_type() == ModeRTL::RTLAltType::RTL_ALTTYPE_TERRAIN) { + if (copter.mode_rtl.get_alt_type() == ModeRTL::RTLAltType::TERRAIN) { // get terrain source from wpnav const char *failure_template = "RTL_ALT_TYPE is above-terrain but %s"; switch (copter.wp_nav->get_terrain_source()) { diff --git a/ArduCopter/mode.h b/ArduCopter/mode.h index 031a9a0d26..45ca97176d 100644 --- a/ArduCopter/mode.h +++ b/ArduCopter/mode.h @@ -1420,8 +1420,8 @@ public: // enum for RTL_ALT_TYPE parameter enum class RTLAltType : int8_t { - RTL_ALTTYPE_RELATIVE = 0, - RTL_ALTTYPE_TERRAIN = 1 + RELATIVE = 0, + TERRAIN = 1 }; ModeRTL::RTLAltType get_alt_type() const; diff --git a/ArduCopter/mode_rtl.cpp b/ArduCopter/mode_rtl.cpp index cfee04ff72..e5d774bc33 100644 --- a/ArduCopter/mode_rtl.cpp +++ b/ArduCopter/mode_rtl.cpp @@ -52,11 +52,11 @@ ModeRTL::RTLAltType ModeRTL::get_alt_type() const { // sanity check parameter switch ((ModeRTL::RTLAltType)g.rtl_alt_type) { - case RTLAltType::RTL_ALTTYPE_RELATIVE ... RTLAltType::RTL_ALTTYPE_TERRAIN: + case RTLAltType::RELATIVE ... RTLAltType::TERRAIN: return g.rtl_alt_type; } // user has an invalid value - return RTLAltType::RTL_ALTTYPE_RELATIVE; + return RTLAltType::RELATIVE; } // rtl_run - runs the return-to-launch controller @@ -410,7 +410,7 @@ void ModeRTL::compute_return_target() // determine altitude type of return journey (alt-above-home, alt-above-terrain using range finder or alt-above-terrain using terrain database) ReturnTargetAltType alt_type = ReturnTargetAltType::RELATIVE; - if (terrain_following_allowed && (get_alt_type() == RTLAltType::RTL_ALTTYPE_TERRAIN)) { + if (terrain_following_allowed && (get_alt_type() == RTLAltType::TERRAIN)) { // convert RTL_ALT_TYPE and WPNAV_RFNG_USE parameters to ReturnTargetAltType switch (wp_nav->get_terrain_source()) { case AC_WPNav::TerrainSource::TERRAIN_UNAVAILABLE: