Copter: function for mot_pwm checks

This commit is contained in:
ashvath 2020-01-29 22:21:22 +05:30 committed by Randy Mackay
parent 8854f382bd
commit d97fdcac31
2 changed files with 14 additions and 0 deletions

View File

@ -483,6 +483,17 @@ int16_t AP_MotorsMulticopter::get_pwm_output_max() const
return _throttle_radio_max;
}
// parameter checks for MOT_PWM_MIN/MAX
bool AP_MotorsMulticopter::check_mot_pwm_params()
{
if ((_pwm_min == 0 && _pwm_max !=0) || (_pwm_min != 0 && _pwm_max == 0) ||
(_pwm_min < 0 || _pwm_min < 0) || (_pwm_min > _pwm_max))
{
return true;
}
return false;
}
// set_throttle_range - sets the minimum throttle that will be sent to the engines when they're not off (i.e. to prevents issues with some motors spinning and some not at very low throttle)
// also sets throttle channel minimum and maximum pwm
void AP_MotorsMulticopter::set_throttle_range(int16_t radio_min, int16_t radio_max)

View File

@ -84,6 +84,9 @@ public:
int16_t get_pwm_output_min() const;
int16_t get_pwm_output_max() const;
// parameter check for MOT_PWM_MIN/MAX
bool check_mot_pwm_params();
// set thrust compensation callback
FUNCTOR_TYPEDEF(thrust_compensation_fn_t, void, float *, uint8_t);
void set_thrust_compensation_callback(thrust_compensation_fn_t callback) {