Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1eefaa3
ArduCopter: remove parameter conversions from before 4.3
peterbarker Aug 27, 2026
5e07288
ArduPlane: remove parameter conversions from before 4.3
peterbarker Aug 27, 2026
f8f58ea
ArduPlane: remove magic repair of Q_M_PWM_MIN/Q_M_PWM_MAX
peterbarker Aug 27, 2026
c94c65a
ArduSub: remove parameter conversions from before 4.3
peterbarker Aug 27, 2026
182571b
Rover: remove parameter conversions from before 4.3
peterbarker Aug 27, 2026
f185c64
SRV_Channel: remove SERVOn_FUNCTION parameter width conversion
peterbarker Aug 27, 2026
8cb0a3c
AP_BoardConfig: remove BRD_SERIAL_NUM parameter width conversion
peterbarker Aug 27, 2026
7e0ad96
AP_VideoTX: remove VTX_OPTIONS parameter width conversion
peterbarker Aug 27, 2026
89b1e4a
ArduSub: remove ATC_RAT_*_FILT parameter conversion
peterbarker Aug 27, 2026
7a2b1ae
Rover: remove CH7_OPTION to RC7_OPTION parameter conversion
peterbarker Aug 27, 2026
fbe62e6
ArduPlane: remove remaining parameter conversions from before 4.3
peterbarker Aug 27, 2026
124540b
ArduSub: remove conversion_table
peterbarker Aug 27, 2026
43f3de5
Rover: remove parameter conversions from before 4.3
peterbarker Aug 27, 2026
1b3c187
APM_Control: remove convert_pid()
peterbarker Aug 27, 2026
24a0c96
AP_Compass: remove primary compass parameter conversion
peterbarker Aug 27, 2026
e4f27b3
AP_Logger: remove LOG_FILE_BUFSIZE parameter width conversion
peterbarker Aug 27, 2026
68a8c2d
AP_Mount: remove convert_params()
peterbarker Aug 27, 2026
dd197ad
AP_NavEKF3: remove convert_parameters()
peterbarker Aug 27, 2026
ab14525
AntennaTracker: remove RCn_OPTION parameter conversion
peterbarker Aug 27, 2026
a0a7912
ArduCopter: remove RCn_OPTION parameter conversion
peterbarker Aug 27, 2026
41aedf0
ArduPlane: remove RCn_OPTION parameter conversion
peterbarker Aug 27, 2026
b4e021a
ArduSub: remove RCn_OPTION parameter conversion
peterbarker Aug 27, 2026
5261216
Blimp: remove RCn_OPTION parameter conversion
peterbarker Aug 27, 2026
6ac7651
Rover: remove RCn_OPTION parameter conversions
peterbarker Aug 27, 2026
3756a23
RC_Channel: remove convert_options()
peterbarker Aug 27, 2026
6365262
AP_GPS: remove GPS_AUTO_SWITCH use-second parameter conversion
peterbarker Aug 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions AntennaTracker/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ void Tracker::init_ardupilot()
#endif

// initialise rc channels including setting mode
// PARAMETER_CONVERSION - Added: Sep-2021 for Tracker-4.5
rc().convert_options(RC_Channel::AUX_FUNC::ARMDISARM_UNUSED, RC_Channel::AUX_FUNC::ARMDISARM);
rc().init();

// initialise servos
Expand Down
4 changes: 0 additions & 4 deletions ArduCopter/Copter.h
Original file line number Diff line number Diff line change
Expand Up @@ -968,10 +968,6 @@ class Copter : public AP_Vehicle {

// Parameters.cpp
void load_parameters(void) override;
void convert_pid_parameters(void);
#if HAL_PROXIMITY_ENABLED
void convert_prx_parameters();
#endif

// precision_landing.cpp
void init_precland();
Expand Down
90 changes: 0 additions & 90 deletions ArduCopter/Parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1271,11 +1271,6 @@ void Copter::load_parameters(void)
{
AP_Vehicle::load_parameters(g.format_version, Parameters::k_format_version);

// PARAMETER_CONVERSION - Added: Mar-2022
#if AP_FENCE_ENABLED
AP_Param::convert_class(g.k_param_fence_old, &fence, fence.var_info, 0, true);
#endif

// PARAMETER_CONVERSION - Added: Jul-2025 for ArduPilot-4.7
#if AP_RPM_ENABLED
AP_Param::convert_class(g.k_param_rpm_sensor_old, &rpm_sensor, rpm_sensor.var_info, 0, true, true);
Expand Down Expand Up @@ -1363,88 +1358,3 @@ void Copter::load_parameters(void)
// setup AP_Param frame type flags
AP_Param::set_frame_type_flags(AP_PARAM_FRAME_COPTER);
}

// handle conversion of PID gains
void Copter::convert_pid_parameters(void)
{
const AP_Param::ConversionInfo angle_and_filt_conversion_info[] = {
// PARAMETER_CONVERSION - Added: Aug-2021
{ Parameters::k_param_pi_vel_xy, 3, AP_PARAM_FLOAT, "PSC_NE_VEL_FLTE" },
};

// convert angle controller gain and filter without scaling
for (const auto &info : angle_and_filt_conversion_info) {
AP_Param::convert_old_parameter(&info, 1.0f);
}

#if AP_INERTIALSENSOR_HARMONICNOTCH_ENABLED
#if HAL_INS_NUM_HARMONIC_NOTCH_FILTERS > 1
if (!ins.harmonic_notches[1].params.enabled()) {
// notch filter parameter conversions (moved to INS_HNTC2) for 4.2.x, converted from fixed notch
const AP_Param::ConversionInfo notchfilt_conversion_info[] {
// PARAMETER_CONVERSION - Added: Apr-2022 for ArduPilot-4.2
{ Parameters::k_param_ins, 101, AP_PARAM_INT8, "INS_HNTC2_ENABLE" },
{ Parameters::k_param_ins, 293, AP_PARAM_FLOAT, "INS_HNTC2_ATT" },
{ Parameters::k_param_ins, 357, AP_PARAM_FLOAT, "INS_HNTC2_FREQ" },
{ Parameters::k_param_ins, 421, AP_PARAM_FLOAT, "INS_HNTC2_BW" },
};
AP_Param::convert_old_parameters(&notchfilt_conversion_info[0], ARRAY_SIZE(notchfilt_conversion_info));
AP_Param::set_default_by_name("INS_HNTC2_MODE", 0);
AP_Param::set_default_by_name("INS_HNTC2_HMNCS", 1);
}
#endif
#endif // AP_INERTIALSENSOR_HARMONICNOTCH_ENABLED

// ACRO_RP_P and ACRO_Y_P replaced with ACRO_RP_RATE and ACRO_Y_RATE for Copter-4.2
// PARAMETER_CONVERSION - Added: Sep-2021
const AP_Param::ConversionInfo acro_rpy_conversion_info[] = {
{ Parameters::k_param_acro_rp_p, 0, AP_PARAM_FLOAT, "ACRO_RP_RATE" },
{ Parameters::k_param_acro_yaw_p, 0, AP_PARAM_FLOAT, "ACRO_Y_RATE" }
};
for (const auto &info : acro_rpy_conversion_info) {
AP_Param::convert_old_parameter(&info, 45.0);
}

// convert rate and expo command model parameters for Copter-4.3
// PARAMETER_CONVERSION - Added: Jun-2022 for ArduPilot-4.3
const AP_Param::ConversionInfo cmd_mdl_conversion_info[] = {
{ Parameters::k_param_g2, 47, AP_PARAM_FLOAT, "ACRO_RP_RATE" },
{ Parameters::k_param_acro_rp_expo, 0, AP_PARAM_FLOAT, "ACRO_RP_EXPO" },
{ Parameters::k_param_g2, 48, AP_PARAM_FLOAT, "ACRO_Y_RATE" },
{ Parameters::k_param_g2, 9, AP_PARAM_FLOAT, "ACRO_Y_EXPO" },
{ Parameters::k_param_g2, 49, AP_PARAM_FLOAT, "PILOT_Y_RATE" },
{ Parameters::k_param_g2, 50, AP_PARAM_FLOAT, "PILOT_Y_EXPO" },
};
for (const auto &info : cmd_mdl_conversion_info) {
AP_Param::convert_old_parameter(&info, 1.0);
}

// make any SRV_Channel upgrades needed
SRV_Channels::upgrade_parameters();
}

#if HAL_PROXIMITY_ENABLED
void Copter::convert_prx_parameters()
{
// convert PRX to PRX1_ parameters for Copter-4.3
// PARAMETER_CONVERSION - Added: Aug-2022
static const AP_Param::ConversionInfo prx_conversion_info[] = {
{ Parameters::k_param_g2, 72, AP_PARAM_INT8, "PRX1_TYPE" },
{ Parameters::k_param_g2, 136, AP_PARAM_INT8, "PRX1_ORIENT" },
{ Parameters::k_param_g2, 200, AP_PARAM_INT16, "PRX1_YAW_CORR" },
{ Parameters::k_param_g2, 264, AP_PARAM_INT16, "PRX1_IGN_ANG1" },
{ Parameters::k_param_g2, 328, AP_PARAM_INT8, "PRX1_IGN_WID1" },
{ Parameters::k_param_g2, 392, AP_PARAM_INT16, "PRX1_IGN_ANG2" },
{ Parameters::k_param_g2, 456, AP_PARAM_INT8, "PRX1_IGN_WID2" },
{ Parameters::k_param_g2, 520, AP_PARAM_INT16, "PRX1_IGN_ANG3" },
{ Parameters::k_param_g2, 584, AP_PARAM_INT8, "PRX1_IGN_WID3" },
{ Parameters::k_param_g2, 648, AP_PARAM_INT16, "PRX1_IGN_ANG4" },
{ Parameters::k_param_g2, 712, AP_PARAM_INT8, "PRX1_IGN_WID4" },
{ Parameters::k_param_g2, 1224, AP_PARAM_FLOAT, "PRX1_MIN" },
{ Parameters::k_param_g2, 1288, AP_PARAM_FLOAT, "PRX1_MAX" },
};
for (const auto &info : prx_conversion_info) {
AP_Param::convert_old_parameter(&info, 1.0);
}
}
#endif
8 changes: 0 additions & 8 deletions ArduCopter/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ void Copter::init_ardupilot()
allocate_motors();

// initialise rc channels including setting mode
// PARAMETER_CONVERSION - Added: Sep-2021 for Copter-4.2
rc().convert_options(RC_Channel::AUX_FUNC::ARMDISARM_UNUSED, RC_Channel::AUX_FUNC::ARMDISARM_AIRMODE);
rc().init();

// sets up motors and output to escs
Expand Down Expand Up @@ -509,16 +507,10 @@ void Copter::allocate_motors(void)
}

// upgrade parameters. This must be done after allocating the objects
convert_pid_parameters();
#if FRAME_CONFIG == HELI_FRAME
motors->heli_motors_param_conversions();
#endif

#if HAL_PROXIMITY_ENABLED
// convert PRX to PRX1_ parameters
convert_prx_parameters();
#endif

// upgrade attitude controller parameters
copter.attitude_control->convert_parameters();

Expand Down
194 changes: 0 additions & 194 deletions ArduPlane/Parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1305,63 +1305,15 @@ ParametersG2::ParametersG2(void) :
AP_Param::setup_object_defaults(this, var_info);
}

/*
This is a conversion table from old parameter values to new
parameter names. The startup code looks for saved values of the old
parameters and will copy them across to the new parameters if the
new parameter does not yet have a saved value. It then saves the new
value.

Note that this works even if the old parameter has been removed. It
relies on the old k_param index not being removed

The second column below is the index in the var_info[] table for the
old object. This should be zero for top level parameters.
*/
static const AP_Param::ConversionInfo conversion_table[] = {
// PARAMETER_CONVERSION - Added: Mar-2021 for ArduPlane-4.1
{ Parameters::k_param_fence_minalt, 0, AP_PARAM_INT16, "FENCE_ALT_MIN"},
{ Parameters::k_param_fence_maxalt, 0, AP_PARAM_INT16, "FENCE_ALT_MAX"},
{ Parameters::k_param_fence_retalt, 0, AP_PARAM_INT16, "FENCE_RET_ALT"},
{ Parameters::k_param_fence_ret_rally, 0, AP_PARAM_INT8, "FENCE_RET_RALLY"},
{ Parameters::k_param_fence_autoenable, 0, AP_PARAM_INT8, "FENCE_AUTOENABLE"},
};

struct RCConversionInfo {
uint16_t old_key; // k_param_*
uint32_t old_group_element; // index in old object
RC_Channel::AUX_FUNC fun; // new function
};

static const RCConversionInfo rc_option_conversion[] = {
{ Parameters::k_param_flapin_channel_old, 0, RC_Channel::AUX_FUNC::FLAP},
{ Parameters::k_param_g2, 968, RC_Channel::AUX_FUNC::SOARING},
#if AP_FENCE_ENABLED
{ Parameters::k_param_fence_channel, 0, RC_Channel::AUX_FUNC::FENCE},
#endif
#if AP_MISSION_ENABLED
{ Parameters::k_param_reset_mission_chan, 0, RC_Channel::AUX_FUNC::MISSION_RESET},
#endif
#if HAL_PARACHUTE_ENABLED
{ Parameters::k_param_parachute_channel, 0, RC_Channel::AUX_FUNC::PARACHUTE_RELEASE},
#endif
{ Parameters::k_param_fbwa_tdrag_chan, 0, RC_Channel::AUX_FUNC::FBWA_TAILDRAGGER},
{ Parameters::k_param_reset_switch_chan, 0, RC_Channel::AUX_FUNC::MODE_SWITCH_RESET},
};

void Plane::load_parameters(void)
{
AP_Vehicle::load_parameters(g.format_version, Parameters::k_format_version);

AP_Param::convert_old_parameters(&conversion_table[0], ARRAY_SIZE(conversion_table));

// setup defaults in SRV_Channels
g2.servo_channels.set_default_function(CH_1, SRV_Channel::k_aileron);
g2.servo_channels.set_default_function(CH_2, SRV_Channel::k_elevator);
g2.servo_channels.set_default_function(CH_3, SRV_Channel::k_throttle);
g2.servo_channels.set_default_function(CH_4, SRV_Channel::k_rudder);

SRV_Channels::upgrade_parameters();

#if HAL_QUADPLANE_ENABLED
if (quadplane.enable) {
Expand All @@ -1372,151 +1324,9 @@ void Plane::load_parameters(void)

AP_Param::set_frame_type_flags(AP_PARAM_FRAME_PLANE);

// Convert chan params to RCx_OPTION
// PARAMETER_CONVERSION - Added: Mar-2021 for ArduPlane-4.1
for (uint8_t i=0; i<ARRAY_SIZE(rc_option_conversion); i++) {
AP_Int8 chan_param;
AP_Param::ConversionInfo info {rc_option_conversion[i].old_key, rc_option_conversion[i].old_group_element, AP_PARAM_INT8, nullptr};
if (AP_Param::find_old_parameter(&info, &chan_param) && chan_param.get() > 0) {
RC_Channel *chan = rc().channel(chan_param.get() - 1);
if (chan != nullptr && !chan->option.configured()) {
chan->option.set_and_save((int16_t)rc_option_conversion[i].fun); // save the new param
}
}
}


// PARAMETER_CONVERSION - Added: Mar-2021 for ArduPlane-4.1
#if AP_FENCE_ENABLED
enum ap_var_type ptype_fence_type;
AP_Int8 *fence_type_new = (AP_Int8*)AP_Param::find("FENCE_TYPE", &ptype_fence_type);
if (fence_type_new && !fence_type_new->configured()) {
// If we find the new parameter and it hasn't been configured
// attempt to upgrade the altitude fences.
int8_t fence_type_new_val = AC_FENCE_TYPE_POLYGON;
AP_Int16 fence_alt_min_old;
AP_Param::ConversionInfo fence_alt_min_info_old = {
Parameters::k_param_fence_minalt,
0,
AP_PARAM_INT16,
nullptr
};
if (AP_Param::find_old_parameter(&fence_alt_min_info_old, &fence_alt_min_old)) {
if (fence_alt_min_old.configured()) {
//
fence_type_new_val |= AC_FENCE_TYPE_ALT_MIN;
}
}

AP_Int16 fence_alt_max_old;
AP_Param::ConversionInfo fence_alt_max_info_old = {
Parameters::k_param_fence_maxalt,
0,
AP_PARAM_INT16,
nullptr
};
if (AP_Param::find_old_parameter(&fence_alt_max_info_old, &fence_alt_max_old)) {
if (fence_alt_max_old.configured()) {
fence_type_new_val |= AC_FENCE_TYPE_ALT_MAX;
}
}

fence_type_new->set_and_save((int8_t)fence_type_new_val);
}

AP_Int8 fence_action_old;
AP_Param::ConversionInfo fence_action_info_old = {
Parameters::k_param_fence_action,
0,
AP_PARAM_INT8,
"FENCE_ACTION"
};
if (AP_Param::find_old_parameter(&fence_action_info_old, &fence_action_old)) {
enum ap_var_type ptype;
AP_Int8 *fence_action_new = (AP_Int8*)AP_Param::find(&fence_action_info_old.new_name[0], &ptype);
AC_Fence::Action fence_action_new_val;
if (fence_action_new && !fence_action_new->configured()) {
switch(fence_action_old.get()) {
case 0: // FENCE_ACTION_NONE
case 2: // FENCE_ACTION_REPORT_ONLY
default:
fence_action_new_val = AC_Fence::Action::REPORT_ONLY;
break;
case 1: // FENCE_ACTION_GUIDED
fence_action_new_val = AC_Fence::Action::GUIDED;
break;
case 3: // FENCE_ACTION_GUIDED_THR_PASS
fence_action_new_val = AC_Fence::Action::GUIDED_THROTTLE_PASS;
break;
case 4: // FENCE_ACTION_RTL
fence_action_new_val = AC_Fence::Action::RTL_AND_LAND;
break;
}
fence_action_new->set_and_save((int8_t)fence_action_new_val);

// Now upgrade the new fence enable at the same time
enum ap_var_type ptype_fence_enable;
AP_Int8 *fence_enable = (AP_Int8*)AP_Param::find("FENCE_ENABLE", &ptype_fence_enable);
// fences were used if there was a count, and the old fence action was not zero
AC_Fence *ap_fence = AP::fence();
bool fences_exist = false;
if (ap_fence) {
// If the fence library is present, attempt to read the fence count
fences_exist = ap_fence->polyfence().total_fence_count() > 0;
}

bool fences_used = fence_action_old.get() != 0;
if (fence_enable && !fence_enable->configured()) {
// The fence enable parameter exists, so now set it accordingly
fence_enable->set_and_save(fences_exist && fences_used);
}
}
}
#endif // AP_FENCE_ENABLED

#if AP_TERRAIN_AVAILABLE
// PARAMETER_CONVERSION - Added: Mar-2021 for ArduPlane-4.1
g.terrain_follow.convert_parameter_width(AP_PARAM_INT8);
#endif

// PARAMETER_CONVERSION - Added: Jun-2021 for ArduPlane-4.1
g.use_reverse_thrust.convert_parameter_width(AP_PARAM_INT16);

// PARAMETER_CONVERSION - Added: Jun-2026 for FBWB_CLIMB_RATE width change
g.flybywire_climb_rate.convert_parameter_width(AP_PARAM_INT8);

#if AP_AIRSPEED_ENABLED
// PARAMETER_CONVERSION - Added: Jan-2022
{
const uint16_t old_key = g.k_param_airspeed;
const uint16_t old_index = 0; // Old parameter index in the tree
AP_Param::convert_class(old_key, &airspeed, airspeed.var_info, old_index, true);
}
#endif

#if AP_INERTIALSENSOR_HARMONICNOTCH_ENABLED
#if HAL_INS_NUM_HARMONIC_NOTCH_FILTERS > 1
if (!ins.harmonic_notches[1].params.enabled()) {
// notch filter parameter conversions (moved to INS_HNTC2) for 4.2.x, converted from fixed notch
const AP_Param::ConversionInfo notchfilt_conversion_info[] {
// PARAMETER_CONVERSION - Added: Apr-2022 for ArduPlane-4.2
{ Parameters::k_param_ins, 101, AP_PARAM_INT8, "INS_HNTC2_ENABLE" },
{ Parameters::k_param_ins, 293, AP_PARAM_FLOAT, "INS_HNTC2_ATT" },
{ Parameters::k_param_ins, 357, AP_PARAM_FLOAT, "INS_HNTC2_FREQ" },
{ Parameters::k_param_ins, 421, AP_PARAM_FLOAT, "INS_HNTC2_BW" },
};
AP_Param::convert_old_parameters(&notchfilt_conversion_info[0], ARRAY_SIZE(notchfilt_conversion_info));
AP_Param::set_default_by_name("INS_HNTC2_MODE", 0);
AP_Param::set_default_by_name("INS_HNTC2_HMNCS", 1);
}
#endif // HAL_INS_NUM_HARMONIC_NOTCH_FILTERS
#endif // AP_INERTIALSENSOR_HARMONICNOTCH_ENABLED

// PARAMETER_CONVERSION - Added: Mar-2022
#if AP_FENCE_ENABLED
AP_Param::convert_class(g.k_param_fence, &fence, fence.var_info, 0, true);
#endif

// PARAMETER_CONVERSION - Added: Jul-2025 for ArduPilot-4.7
#if AP_RPM_ENABLED
AP_Param::convert_class(g.k_param_rpm_sensor_old, &rpm_sensor, rpm_sensor.var_info, 0, true, true);
Expand All @@ -1541,10 +1351,6 @@ void Plane::load_parameters(void)
landing.convert_parameters();

static const AP_Param::G2ObjectConversion g2_conversions[] {
// PARAMETER_CONVERSION - Added: Oct-2021
#if HAL_EFI_ENABLED
{ &efi, efi.var_info, 22 },
#endif
#if AP_STATS_ENABLED
// PARAMETER_CONVERSION - Added: Jan-2024 for Plane-4.6
{ &stats, stats.var_info, 5 },
Expand Down
Loading
Loading