Skip to content

Commit

Permalink
AP_MotorsHeli: Add param conversion for RSC_AROT params
Browse files Browse the repository at this point in the history
  • Loading branch information
MattKear committed Sep 23, 2024
1 parent 3cb4d51 commit 454062a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
16 changes: 16 additions & 0 deletions libraries/AP_Motors/AP_MotorsHeli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,3 +628,19 @@ float AP_MotorsHeli::get_cyclic_angle_scaler(void) const {
return ((float)(_collective_max-_collective_min))*1e-3 * (_collective_max_deg.get() - _collective_min_deg.get()) * 2.0;
}
#endif

// Helper function for param conversions to be done in motors class
void AP_MotorsHeli::heli_motors_param_conversions(void)
{
// PARAMETER_CONVERSION - Added: Sep-2024
// move autorotation related parameters within the RSC into their own class
const AP_Param::ConversionInfo rsc_arot_conversion_info[] = {
{ 90, 108096, AP_PARAM_INT8, "H_RSC_AROT_ENBL" },
{ 90, 104000, AP_PARAM_INT8, "H_RSC_AROT_RAMP" },
{ 90, 112192, AP_PARAM_INT16, "H_RSC_AROT_IDLE" },
};
uint8_t table_size = ARRAY_SIZE(rsc_arot_conversion_info);
for (uint8_t i=0; i<table_size; i++) {
AP_Param::convert_old_parameter(&rsc_arot_conversion_info[i], 1.0);
}
}
2 changes: 1 addition & 1 deletion libraries/AP_Motors/AP_MotorsHeli.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class AP_MotorsHeli : public AP_Motors {
void _output_test_seq(uint8_t motor_seq, int16_t pwm) override {};

// Helper function for param conversions to be done in motors class
virtual void heli_motors_param_conversions(void) { return; }
virtual void heli_motors_param_conversions(void);

// var_info for holding Parameter information
static const struct AP_Param::GroupInfo var_info[];
Expand Down
3 changes: 3 additions & 0 deletions libraries/AP_Motors/AP_MotorsHeli_Single.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,9 @@ bool AP_MotorsHeli_Single::arming_checks(size_t buflen, char *buffer) const
// Called from system.cpp
void AP_MotorsHeli_Single::heli_motors_param_conversions(void)
{
// Run common conversions from base class
AP_MotorsHeli::heli_motors_param_conversions();

// PARAMETER_CONVERSION - Added: Nov-2023
// Convert trim for DDFP tails
// Previous DDFP configs used servo trim for setting the yaw trim, which no longer works with thrust linearisation. Convert servo trim
Expand Down

0 comments on commit 454062a

Please sign in to comment.