From fb4b0929172b6b3e0bc28ae813a2d35a88cb072b Mon Sep 17 00:00:00 2001 From: IamPete1 <33176108+IamPete1@users.noreply.github.com> Date: Tue, 9 Apr 2019 01:05:38 +0100 Subject: [PATCH] plane: restore thr_min behaviour and update description --- ArduPlane/Parameters.cpp | 2 +- ArduPlane/servos.cpp | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ArduPlane/Parameters.cpp b/ArduPlane/Parameters.cpp index 5af7c81bf8..7ef73f3de0 100644 --- a/ArduPlane/Parameters.cpp +++ b/ArduPlane/Parameters.cpp @@ -401,7 +401,7 @@ const AP_Param::Info Plane::var_info[] = { // @Param: THR_MIN // @DisplayName: Minimum Throttle - // @Description: Minimum throttle percentage used in automatic throttle modes. Negative values allow reverse thrust if hardware supports it. + // @Description: Minimum throttle percentage used in all modes except manual, provided THR_PASS_STAB is not set. Negative values allow reverse thrust if hardware supports it. // @Units: % // @Range: -100 100 // @Increment: 1 diff --git a/ArduPlane/servos.cpp b/ArduPlane/servos.cpp index ddfa186619..3f9582486b 100644 --- a/ArduPlane/servos.cpp +++ b/ArduPlane/servos.cpp @@ -442,9 +442,10 @@ void Plane::set_servos_controlled(void) } else if (g.throttle_passthru_stabilize) { // manual pass through of throttle while in FBWA or // STABILIZE mode with THR_PASS_STAB set - SRV_Channels::set_output_scaled(SRV_Channel::k_throttle, channel_throttle->get_control_in_zero_dz()); + SRV_Channels::set_output_scaled(SRV_Channel::k_throttle, get_throttle_input(true)); } else { - SRV_Channels::set_output_scaled(SRV_Channel::k_throttle, channel_throttle->get_control_in()); + SRV_Channels::set_output_scaled(SRV_Channel::k_throttle, + constrain_int16(get_throttle_input(true), min_throttle, max_throttle)); } } else if ((control_mode == &mode_guided || control_mode == &mode_avoidADSB) && guided_throttle_passthru) { @@ -749,9 +750,10 @@ void Plane::set_servos(void) case AP_Arming::Required::YES_MIN_PWM: default: - SRV_Channels::set_output_scaled(SRV_Channel::k_throttle, 0); - SRV_Channels::set_output_scaled(SRV_Channel::k_throttleLeft, 0); - SRV_Channels::set_output_scaled(SRV_Channel::k_throttleRight, 0); + int8_t min_throttle = MAX(aparm.throttle_min.get(),0); + SRV_Channels::set_output_scaled(SRV_Channel::k_throttle, min_throttle); + SRV_Channels::set_output_scaled(SRV_Channel::k_throttleLeft, min_throttle); + SRV_Channels::set_output_scaled(SRV_Channel::k_throttleRight, min_throttle); break; } }