Copter: remove FS_OPTIONS parameter conversion

This code is in 4.0.7 but not 3.6.11 - i.e. after this someone upgrading from 3.6 to master (and presumably 4.4) won't get this conversion done.

This conversion is flawed in that someone configuring a default for a parameter in a configuration file will have that value over-ridden by this code.
This commit is contained in:
Peter Barker 2023-01-12 13:02:30 +11:00 committed by Peter Barker
parent 52f6810d50
commit bba5b34c1e
2 changed files with 0 additions and 37 deletions

View File

@ -879,7 +879,6 @@ private:
#endif
void convert_lgr_parameters(void);
void convert_tradheli_parameters(void) const;
void convert_fs_options_params(void) const;
// precision_landing.cpp
void init_precland();

View File

@ -1335,10 +1335,6 @@ void Copter::load_parameters(void)
convert_lgr_parameters();
#endif
// convert fs_options parameters
// PARAMETER_CONVERSION - Added: Nov-2019
convert_fs_options_params();
#if MODE_RTL_ENABLED == ENABLED
// PARAMETER_CONVERSION - Added: Sep-2021
g.rtl_altitude.convert_parameter_width(AP_PARAM_INT16);
@ -1867,35 +1863,3 @@ void Copter::convert_tradheli_parameters(void) const
}
#endif
void Copter::convert_fs_options_params(void) const
{
// PARAMETER_CONVERSION - Added: Nov-2019
// If FS_OPTIONS has already been configured and we don't change it.
enum ap_var_type ptype;
AP_Int32 *fs_opt = (AP_Int32 *)AP_Param::find("FS_OPTIONS", &ptype);
if (fs_opt == nullptr || fs_opt->configured() || ptype != AP_PARAM_INT32) {
return;
}
// Variable to capture the new FS_OPTIONS setting
int32_t fs_options_converted = (int32_t)FailsafeOption::GCS_CONTINUE_IF_PILOT_CONTROL;
// If FS_THR_ENABLED is 2 (continue mission), change to RTL and add continue mission to the new FS_OPTIONS parameter
if (g.failsafe_throttle == FS_THR_ENABLED_CONTINUE_MISSION) {
fs_options_converted |= int32_t(FailsafeOption::RC_CONTINUE_IF_AUTO);
AP_Param::set_and_save_by_name("FS_THR_ENABLE", FS_THR_ENABLED_ALWAYS_RTL);
}
// If FS_GCS_ENABLED is 2 (continue mission), change to RTL and add continue mission to the new FS_OPTIONS parameter
if (g.failsafe_gcs == FS_GCS_ENABLED_CONTINUE_MISSION) {
fs_options_converted |= int32_t(FailsafeOption::GCS_CONTINUE_IF_AUTO);
AP_Param::set_and_save_by_name("FS_GCS_ENABLE", FS_GCS_ENABLED_ALWAYS_RTL);
}
// Write the new value to FS_OPTIONS
// AP_Param::set_and_save_by_name("FS_OPTIONS", fs_options_converted);
fs_opt->set_and_save(fs_options_converted);
}