mirror of https://github.com/ArduPilot/ardupilot
AP_Motors: rename get_pwm_min to get_pwm_output_min
This commit is contained in:
parent
0c225cf498
commit
8d1f50e78f
|
@ -122,8 +122,8 @@ void AP_MotorsCoax::output_to_motors()
|
|||
rc_write(AP_MOTORS_MOT_2, calc_pwm_output_1to1(_pitch_radio_passthrough, _servo2));
|
||||
rc_write(AP_MOTORS_MOT_3, calc_pwm_output_1to1(_roll_radio_passthrough, _servo3));
|
||||
rc_write(AP_MOTORS_MOT_4, calc_pwm_output_1to1(_pitch_radio_passthrough, _servo4));
|
||||
rc_write(AP_MOTORS_MOT_5, get_pwm_min());
|
||||
rc_write(AP_MOTORS_MOT_6, get_pwm_min());
|
||||
rc_write(AP_MOTORS_MOT_5, get_pwm_output_min());
|
||||
rc_write(AP_MOTORS_MOT_6, get_pwm_output_min());
|
||||
hal.rcout->push();
|
||||
break;
|
||||
case SPIN_WHEN_ARMED:
|
||||
|
@ -133,8 +133,8 @@ void AP_MotorsCoax::output_to_motors()
|
|||
rc_write(AP_MOTORS_MOT_2, calc_pwm_output_1to1(_throttle_low_end_pct * _actuator_out[1], _servo2));
|
||||
rc_write(AP_MOTORS_MOT_3, calc_pwm_output_1to1(_throttle_low_end_pct * _actuator_out[2], _servo3));
|
||||
rc_write(AP_MOTORS_MOT_4, calc_pwm_output_1to1(_throttle_low_end_pct * _actuator_out[3], _servo4));
|
||||
rc_write(AP_MOTORS_MOT_5, constrain_int16(get_pwm_min() + _throttle_low_end_pct * _min_throttle, get_pwm_min(), get_pwm_min() + _min_throttle));
|
||||
rc_write(AP_MOTORS_MOT_6, constrain_int16(get_pwm_min() + _throttle_low_end_pct * _min_throttle, get_pwm_min(), get_pwm_min() + _min_throttle));
|
||||
rc_write(AP_MOTORS_MOT_5, constrain_int16(get_pwm_output_min() + _throttle_low_end_pct * _min_throttle, get_pwm_output_min(), get_pwm_output_min() + _min_throttle));
|
||||
rc_write(AP_MOTORS_MOT_6, constrain_int16(get_pwm_output_min() + _throttle_low_end_pct * _min_throttle, get_pwm_output_min(), get_pwm_output_min() + _min_throttle));
|
||||
hal.rcout->push();
|
||||
break;
|
||||
case SPOOL_UP:
|
||||
|
|
|
@ -94,7 +94,7 @@ void AP_MotorsMatrix::output_to_motors()
|
|||
// set motor output based on thrust requests
|
||||
for (i=0; i<AP_MOTORS_MAX_NUM_MOTORS; i++) {
|
||||
if (motor_enabled[i]) {
|
||||
motor_out[i] = get_pwm_min();
|
||||
motor_out[i] = get_pwm_output_min();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -102,7 +102,7 @@ void AP_MotorsMatrix::output_to_motors()
|
|||
// sends output to motors when armed but not flying
|
||||
for (i=0; i<AP_MOTORS_MAX_NUM_MOTORS; i++) {
|
||||
if (motor_enabled[i]) {
|
||||
motor_out[i] = constrain_int16(get_pwm_min() + _throttle_low_end_pct * _min_throttle, get_pwm_min(), get_pwm_min() + _min_throttle);
|
||||
motor_out[i] = constrain_int16(get_pwm_output_min() + _throttle_low_end_pct * _min_throttle, get_pwm_output_min(), get_pwm_output_min() + _min_throttle);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -328,12 +328,12 @@ float AP_MotorsMulticopter::get_compensation_gain() const
|
|||
|
||||
int16_t AP_MotorsMulticopter::calc_thrust_to_pwm(float thrust_in) const
|
||||
{
|
||||
return constrain_int16((get_pwm_min() + _min_throttle + apply_thrust_curve_and_volt_scaling(thrust_in) *
|
||||
( get_pwm_max() - (get_pwm_min() + _min_throttle))), get_pwm_min() + _min_throttle, get_pwm_max());
|
||||
return constrain_int16((get_pwm_output_min() + _min_throttle + apply_thrust_curve_and_volt_scaling(thrust_in) *
|
||||
(get_pwm_output_max() - (get_pwm_output_min() + _min_throttle))), get_pwm_output_min() + _min_throttle, get_pwm_output_max());
|
||||
}
|
||||
|
||||
// get minimum or maximum pwm value that can be output to motors
|
||||
int16_t AP_MotorsMulticopter::get_pwm_min() const
|
||||
int16_t AP_MotorsMulticopter::get_pwm_output_min() const
|
||||
{
|
||||
// return _pwm_min if both PWM_MIN and PWM_MAX parameters are defined and valid
|
||||
if ((_pwm_min > 0) && (_pwm_max > 0) && (_pwm_max > _pwm_min)) {
|
||||
|
@ -343,7 +343,7 @@ int16_t AP_MotorsMulticopter::get_pwm_min() const
|
|||
}
|
||||
|
||||
// get maximum pwm value that can be output to motors
|
||||
int16_t AP_MotorsMulticopter::get_pwm_max() const
|
||||
int16_t AP_MotorsMulticopter::get_pwm_output_max() const
|
||||
{
|
||||
// return _pwm_max if both PWM_MIN and PWM_MAX parameters are defined and valid
|
||||
if ((_pwm_min > 0) && (_pwm_max > 0) && (_pwm_max > _pwm_min)) {
|
||||
|
@ -362,7 +362,7 @@ void AP_MotorsMulticopter::set_throttle_range(uint16_t min_throttle, int16_t rad
|
|||
_throttle_radio_max = radio_max;
|
||||
}
|
||||
// update _min_throttle
|
||||
_min_throttle = (float)min_throttle * ((get_pwm_max() - get_pwm_min()) / 1000.0f);
|
||||
_min_throttle = (float)min_throttle * ((get_pwm_output_max() - get_pwm_output_min()) / 1000.0f);
|
||||
}
|
||||
|
||||
void AP_MotorsMulticopter::output_logic()
|
||||
|
@ -527,11 +527,11 @@ void AP_MotorsMulticopter::output_logic()
|
|||
}
|
||||
|
||||
// passes throttle directly to all motors for ESC calibration.
|
||||
// throttle_input is in the range of 0 ~ 1 where 0 will send get_pwm_min() and 1 will send get_pwm_max()
|
||||
// throttle_input is in the range of 0 ~ 1 where 0 will send get_pwm_output_min() and 1 will send get_pwm_output_max()
|
||||
void AP_MotorsMulticopter::set_throttle_passthrough_for_esc_calibration(float throttle_input)
|
||||
{
|
||||
if (armed()) {
|
||||
uint16_t pwm_out = get_pwm_min() + constrain_float(throttle_input, 0.0f, 1.0f) * (get_pwm_max() - get_pwm_min());
|
||||
uint16_t pwm_out = get_pwm_output_min() + constrain_float(throttle_input, 0.0f, 1.0f) * (get_pwm_output_max() - get_pwm_output_min());
|
||||
// send the pilot's input directly to each enabled motor
|
||||
hal.rcout->cork();
|
||||
for (uint16_t i=0; i < AP_MOTORS_MAX_NUM_MOTORS; i++) {
|
||||
|
@ -555,7 +555,7 @@ void AP_MotorsMulticopter::output_motor_mask(float thrust, uint8_t mask)
|
|||
if (mask & (1U<<i)) {
|
||||
motor_out = calc_thrust_to_pwm(thrust);
|
||||
} else {
|
||||
motor_out = get_pwm_min();
|
||||
motor_out = get_pwm_output_min();
|
||||
}
|
||||
rc_write(i, motor_out);
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
void output_logic();
|
||||
|
||||
// passes throttle directly to all motors for ESC calibration.
|
||||
// throttle_input is in the range of 0 ~ 1 where 0 will send get_pwm_min() and 1 will send get_pwm_max()
|
||||
// throttle_input is in the range of 0 ~ 1 where 0 will send get_pwm_output_min() and 1 will send get_pwm_output_max()
|
||||
void set_throttle_passthrough_for_esc_calibration(float throttle_input);
|
||||
|
||||
// get_lift_max - get maximum lift ratio - for logging purposes only
|
||||
|
@ -143,8 +143,8 @@ protected:
|
|||
int16_t calc_thrust_to_pwm(float thrust_in) const;
|
||||
|
||||
// get minimum or maximum pwm value that can be output to motors
|
||||
int16_t get_pwm_min() const;
|
||||
int16_t get_pwm_max() const;
|
||||
int16_t get_pwm_output_min() const;
|
||||
int16_t get_pwm_output_max() const;
|
||||
|
||||
// apply any thrust compensation for the frame
|
||||
virtual void thrust_compensation(void) {}
|
||||
|
|
|
@ -125,8 +125,8 @@ void AP_MotorsSingle::output_to_motors()
|
|||
rc_write(AP_MOTORS_MOT_2, calc_pwm_output_1to1(_pitch_radio_passthrough+_yaw_radio_passthrough, _servo2));
|
||||
rc_write(AP_MOTORS_MOT_3, calc_pwm_output_1to1(-_roll_radio_passthrough+_yaw_radio_passthrough, _servo3));
|
||||
rc_write(AP_MOTORS_MOT_4, calc_pwm_output_1to1(-_pitch_radio_passthrough+_yaw_radio_passthrough, _servo4));
|
||||
rc_write(AP_MOTORS_MOT_5, get_pwm_min());
|
||||
rc_write(AP_MOTORS_MOT_6, get_pwm_min());
|
||||
rc_write(AP_MOTORS_MOT_5, get_pwm_output_min());
|
||||
rc_write(AP_MOTORS_MOT_6, get_pwm_output_min());
|
||||
hal.rcout->push();
|
||||
break;
|
||||
case SPIN_WHEN_ARMED:
|
||||
|
@ -136,8 +136,8 @@ void AP_MotorsSingle::output_to_motors()
|
|||
rc_write(AP_MOTORS_MOT_2, calc_pwm_output_1to1(_throttle_low_end_pct * _actuator_out[1], _servo2));
|
||||
rc_write(AP_MOTORS_MOT_3, calc_pwm_output_1to1(_throttle_low_end_pct * _actuator_out[2], _servo3));
|
||||
rc_write(AP_MOTORS_MOT_4, calc_pwm_output_1to1(_throttle_low_end_pct * _actuator_out[3], _servo4));
|
||||
rc_write(AP_MOTORS_MOT_5, constrain_int16(get_pwm_min() + _throttle_low_end_pct * _min_throttle, get_pwm_min(), get_pwm_min() + _min_throttle));
|
||||
rc_write(AP_MOTORS_MOT_6, constrain_int16(get_pwm_min() + _throttle_low_end_pct * _min_throttle, get_pwm_min(), get_pwm_min() + _min_throttle));
|
||||
rc_write(AP_MOTORS_MOT_5, constrain_int16(get_pwm_output_min() + _throttle_low_end_pct * _min_throttle, get_pwm_output_min(), get_pwm_output_min() + _min_throttle));
|
||||
rc_write(AP_MOTORS_MOT_6, constrain_int16(get_pwm_output_min() + _throttle_low_end_pct * _min_throttle, get_pwm_output_min(), get_pwm_output_min() + _min_throttle));
|
||||
hal.rcout->push();
|
||||
break;
|
||||
case SPOOL_UP:
|
||||
|
|
|
@ -128,18 +128,18 @@ void AP_MotorsTri::output_to_motors()
|
|||
case SHUT_DOWN:
|
||||
// sends minimum values out to the motors
|
||||
hal.rcout->cork();
|
||||
rc_write(AP_MOTORS_MOT_1, get_pwm_min());
|
||||
rc_write(AP_MOTORS_MOT_2, get_pwm_min());
|
||||
rc_write(AP_MOTORS_MOT_4, get_pwm_min());
|
||||
rc_write(AP_MOTORS_MOT_1, get_pwm_output_min());
|
||||
rc_write(AP_MOTORS_MOT_2, get_pwm_output_min());
|
||||
rc_write(AP_MOTORS_MOT_4, get_pwm_output_min());
|
||||
rc_write(AP_MOTORS_CH_TRI_YAW, _yaw_servo_trim);
|
||||
hal.rcout->push();
|
||||
break;
|
||||
case SPIN_WHEN_ARMED:
|
||||
// sends output to motors when armed but not flying
|
||||
hal.rcout->cork();
|
||||
rc_write(AP_MOTORS_MOT_1, constrain_int16(get_pwm_min() + _throttle_low_end_pct * _min_throttle, get_pwm_min(), get_pwm_min() + _min_throttle));
|
||||
rc_write(AP_MOTORS_MOT_2, constrain_int16(get_pwm_min() + _throttle_low_end_pct * _min_throttle, get_pwm_min(), get_pwm_min() + _min_throttle));
|
||||
rc_write(AP_MOTORS_MOT_4, constrain_int16(get_pwm_min() + _throttle_low_end_pct * _min_throttle, get_pwm_min(), get_pwm_min() + _min_throttle));
|
||||
rc_write(AP_MOTORS_MOT_1, constrain_int16(get_pwm_output_min() + _throttle_low_end_pct * _min_throttle, get_pwm_output_min(), get_pwm_output_min() + _min_throttle));
|
||||
rc_write(AP_MOTORS_MOT_2, constrain_int16(get_pwm_output_min() + _throttle_low_end_pct * _min_throttle, get_pwm_output_min(), get_pwm_output_min() + _min_throttle));
|
||||
rc_write(AP_MOTORS_MOT_4, constrain_int16(get_pwm_output_min() + _throttle_low_end_pct * _min_throttle, get_pwm_output_min(), get_pwm_output_min() + _min_throttle));
|
||||
rc_write(AP_MOTORS_CH_TRI_YAW, _yaw_servo_trim);
|
||||
hal.rcout->push();
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue