From b315192dcf30aa7109b468e453a5c4f4a63506ec Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 30 Jan 2024 14:53:43 +1100 Subject: [PATCH] Rover: move scripting up to AP_Vehicle --- Rover/Parameters.cpp | 20 +++++++++++++++----- Rover/Parameters.h | 4 ---- Rover/system.cpp | 4 ---- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Rover/Parameters.cpp b/Rover/Parameters.cpp index 3481b7ea49..1c7ae1a07b 100644 --- a/Rover/Parameters.cpp +++ b/Rover/Parameters.cpp @@ -601,11 +601,7 @@ const AP_Param::GroupInfo ParametersG2::var_info[] = { // @User: Standard AP_GROUPINFO("BAL_PITCH_TRIM", 40, ParametersG2, bal_pitch_trim, 0), -#if AP_SCRIPTING_ENABLED - // @Group: SCR_ - // @Path: ../libraries/AP_Scripting/AP_Scripting.cpp - AP_SUBGROUPINFO(scripting, "SCR_", 41, ParametersG2, AP_Scripting), -#endif + // 41 was Scripting // @Param: STICK_MIXING // @DisplayName: Stick Mixing @@ -933,5 +929,19 @@ void Rover::load_parameters(void) AP_Param::convert_class(stats_info.old_key, &stats, stats.var_info, stats_old_index, stats_old_top_element, false); } #endif + // PARAMETER_CONVERSION - Added: Jan-2024 for Rover-4.6 +#if AP_SCRIPTING_ENABLED + { + // Find G2's Top Level Key + AP_Param::ConversionInfo scripting_info; + if (!AP_Param::find_top_level_key_by_pointer(&g2, scripting_info.old_key)) { + return; + } + + const uint16_t scripting_old_index = 41; // Old parameter index in g2 + const uint16_t scripting_old_top_element = 105; // Old group element in the tree for the first subgroup element (see AP_PARAM_KEY_DUMP) + AP_Param::convert_class(scripting_info.old_key, &scripting, scripting.var_info, scripting_old_index, scripting_old_top_element, false); + } +#endif } diff --git a/Rover/Parameters.h b/Rover/Parameters.h index e8dbb86a0e..ef8d619470 100644 --- a/Rover/Parameters.h +++ b/Rover/Parameters.h @@ -396,10 +396,6 @@ public: // stick mixing for auto modes AP_Int8 stick_mixing; -#if AP_SCRIPTING_ENABLED - AP_Scripting scripting; -#endif // AP_SCRIPTING_ENABLED - // waypoint navigation AR_WPNav_OA wp_nav; diff --git a/Rover/system.cpp b/Rover/system.cpp index f358aee5b7..67f0a8ebdf 100644 --- a/Rover/system.cpp +++ b/Rover/system.cpp @@ -174,10 +174,6 @@ void Rover::startup_ground(void) FUNCTOR_BIND(&rover, &Rover::Log_Write_Vehicle_Startup_Messages, void) ); #endif - -#if AP_SCRIPTING_ENABLED - g2.scripting.init(); -#endif // AP_SCRIPTING_ENABLED } // update the ahrs flyforward setting which can allow