Copter: move scripting up to AP_Vehicle

This commit is contained in:
Peter Barker 2024-01-30 14:24:44 +11:00 committed by Andrew Tridgell
parent 33895e8816
commit 78e3719835
3 changed files with 15 additions and 13 deletions

View File

@ -913,11 +913,7 @@ const AP_Param::GroupInfo ParametersG2::var_info[] = {
AP_SUBGROUPPTR(autotune_ptr, "AUTOTUNE_", 29, ParametersG2, AutoTune),
#endif
#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: TUNE_MIN
// @DisplayName: Tuning minimum
@ -1392,6 +1388,20 @@ void Copter::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));

View File

@ -600,10 +600,6 @@ public:
void *autotune_ptr;
#endif
#if AP_SCRIPTING_ENABLED
AP_Scripting scripting;
#endif // AP_SCRIPTING_ENABLED
AP_Float tuning_min;
AP_Float tuning_max;

View File

@ -179,10 +179,6 @@ void Copter::init_ardupilot()
startup_INS_ground();
#if AP_SCRIPTING_ENABLED
g2.scripting.init();
#endif // AP_SCRIPTING_ENABLED
#if AC_CUSTOMCONTROL_MULTI_ENABLED == ENABLED
custom_control.init();
#endif