Skip to content

Commit

Permalink
Blimp: move scripting up to AP_Vehicle
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker committed Jan 30, 2024
1 parent e108a26 commit 2076e72
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
20 changes: 15 additions & 5 deletions Blimp/Parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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));

Expand Down
5 changes: 0 additions & 5 deletions Blimp/Parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,6 @@ class ParametersG2
// 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;

Expand Down
4 changes: 0 additions & 4 deletions Blimp/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,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
Expand Down

0 comments on commit 2076e72

Please sign in to comment.