From b69c51a2963509bd4266a0894c402158c741bc3f Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 30 Jan 2024 15:26:59 +1100 Subject: [PATCH] Blimp: move scripting up to AP_Vehicle --- Blimp/Parameters.cpp | 20 +++++++++++++++----- Blimp/Parameters.h | 5 ----- Blimp/system.cpp | 4 ---- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Blimp/Parameters.cpp b/Blimp/Parameters.cpp index d231274847..f0641e0cf2 100644 --- a/Blimp/Parameters.cpp +++ b/Blimp/Parameters.cpp @@ -807,11 +807,7 @@ const AP_Param::GroupInfo ParametersG2::var_info[] = { // @User: Standard AP_GROUPINFO("PILOT_SPEED_DN", 24, ParametersG2, pilot_speed_dn, 0), -#if AP_SCRIPTING_ENABLED - // @Group: SCR_ - // @Path: ../libraries/AP_Scripting/AP_Scripting.cpp - AP_SUBGROUPINFO(scripting, "SCR_", 30, ParametersG2, AP_Scripting), -#endif + // 30 was AP_Scripting // @Param: FS_VIBE_ENABLE // @DisplayName: Vibration Failsafe enable @@ -884,6 +880,20 @@ void Blimp::load_parameters(void) 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); + } +#endif hal.console->printf("load_all took %uus\n", (unsigned)(micros() - before)); diff --git a/Blimp/Parameters.h b/Blimp/Parameters.h index 3d44b579a2..769e9d2df7 100644 --- a/Blimp/Parameters.h +++ b/Blimp/Parameters.h @@ -305,11 +305,6 @@ public: // Land alt final stage AP_Int16 land_alt_low; - -#if AP_SCRIPTING_ENABLED - AP_Scripting scripting; -#endif // AP_SCRIPTING_ENABLED - // vibration failsafe enable/disable AP_Int8 fs_vibe_enabled; diff --git a/Blimp/system.cpp b/Blimp/system.cpp index dc3799a74a..5bde10d45b 100644 --- a/Blimp/system.cpp +++ b/Blimp/system.cpp @@ -79,10 +79,6 @@ void Blimp::init_ardupilot() startup_INS_ground(); -#if AP_SCRIPTING_ENABLED - g2.scripting.init(); -#endif // AP_SCRIPTING_ENABLED - ins.set_log_raw_bit(MASK_LOG_IMU_RAW); // setup fin output