From a1cd6df32c0402b4befd15e8316bb6f98fa0cc49 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 21 Feb 2024 23:02:36 +1100 Subject: [PATCH] Blimp: convert EFI cvonversion to g2_conversion entry --- Blimp/Parameters.cpp | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/Blimp/Parameters.cpp b/Blimp/Parameters.cpp index cbc14fc410..b13b103af4 100644 --- a/Blimp/Parameters.cpp +++ b/Blimp/Parameters.cpp @@ -842,34 +842,17 @@ void Blimp::load_parameters(void) { AP_Vehicle::load_parameters(g.format_version, Parameters::k_format_version); - // PARAMETER_CONVERSION - Added: Jan-2024 for Copter-4.6 + static const AP_Param::G2ObjectConversion g2_conversions[] { #if AP_STATS_ENABLED - { - // Find G2's Top Level Key - AP_Param::ConversionInfo info; - if (!AP_Param::find_top_level_key_by_pointer(&g2, info.old_key)) { - return; - } - - const uint16_t old_index = 12; // Old parameter index in g2 - const uint16_t old_top_element = 4044; // Old group element in the tree for the first subgroup element (see AP_PARAM_KEY_DUMP) - AP_Param::convert_class(info.old_key, &stats, stats.var_info, old_index, old_top_element, false); - } -#endif // PARAMETER_CONVERSION - Added: Jan-2024 for Copter-4.6 -#if AP_SCRIPTING_ENABLED - { - // Find G2's Top Level Key - AP_Param::ConversionInfo info; - if (!AP_Param::find_top_level_key_by_pointer(&g2, info.old_key)) { - return; - } - - const uint16_t old_index = 30; // Old parameter index in g2 - const uint16_t old_top_element = 94; // Old group element in the tree for the first subgroup element (see AP_PARAM_KEY_DUMP) - AP_Param::convert_class(info.old_key, &scripting, scripting.var_info, old_index, old_top_element, false); - } + { &stats, stats.var_info, 12, 4044 }, #endif +#if AP_SCRIPTING_ENABLED + // PARAMETER_CONVERSION - Added: Jan-2024 for Copter-4.6 + { &scripting, scripting.var_info, 30, 94 }, +#endif + }; + AP_Param::convert_g2_objects(&g2, g2_conversions, ARRAY_SIZE(g2_conversions)); // PARAMETER_CONVERSION - Added: Feb-2024 #if HAL_LOGGING_ENABLED