diff --git a/ArduPlane/Attitude.cpp b/ArduPlane/Attitude.cpp index 63a3a3a239..061a5d9890 100644 --- a/ArduPlane/Attitude.cpp +++ b/ArduPlane/Attitude.cpp @@ -12,14 +12,14 @@ float Plane::calc_speed_scaler(void) if (aspeed > auto_state.highest_airspeed && hal.util->get_soft_armed()) { auto_state.highest_airspeed = aspeed; } + // ensure we have scaling over the full configured airspeed + const float scale_min = MIN(0.5, g.scaling_speed / (2.0 * aparm.airspeed_max)); + const float scale_max = MAX(2.0, g.scaling_speed / (0.7 * aparm.airspeed_min)); if (aspeed > 0.0001f) { speed_scaler = g.scaling_speed / aspeed; } else { - speed_scaler = 2.0; + speed_scaler = scale_max; } - // ensure we have scaling over the full configured airspeed - float scale_min = MIN(0.5, (0.5 * aparm.airspeed_min) / g.scaling_speed); - float scale_max = MAX(2.0, (1.5 * aparm.airspeed_max) / g.scaling_speed); speed_scaler = constrain_float(speed_scaler, scale_min, scale_max); #if HAL_QUADPLANE_ENABLED