From b20ebc6540486ee2aaefa1720aa7f39c017b5dee Mon Sep 17 00:00:00 2001 From: bnsgeyer Date: Mon, 14 May 2018 15:05:39 -0700 Subject: [PATCH] AP_Motors: Tradheli- removes unnecessary code from swash servo trim bug fix --- libraries/AP_Motors/AP_MotorsHeli.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libraries/AP_Motors/AP_MotorsHeli.cpp b/libraries/AP_Motors/AP_MotorsHeli.cpp index d0bde79ba4..858289749d 100644 --- a/libraries/AP_Motors/AP_MotorsHeli.cpp +++ b/libraries/AP_Motors/AP_MotorsHeli.cpp @@ -427,7 +427,8 @@ void AP_MotorsHeli::reset_flight_controls() } // convert input in -1 to +1 range to pwm output for swashplate servo. Special handling of trim is required -// to keep travel between the swashplate servos consistent. +// to keep travel between the swashplate servos consistent. Swashplate servo travel range is fixed to 1000 pwm +// and therefore the input is multiplied by 500 to get PWM output. int16_t AP_MotorsHeli::calc_pwm_output_1to1_swash_servo(float input, const SRV_Channel *servo) { int16_t ret; @@ -438,12 +439,7 @@ int16_t AP_MotorsHeli::calc_pwm_output_1to1_swash_servo(float input, const SRV_C input = -input; } -// With values of trim other than 1500 between swashplate servos - if (input >= 0.0f) { - ret = (int16_t (input * 500.0f) + servo->get_trim()); - } else { - ret = (int16_t (input * 500.0f) + servo->get_trim()); - } + ret = (int16_t (input * 500.0f) + servo->get_trim()); return constrain_int16(ret, servo->get_output_min(), servo->get_output_max()); }