diff --git a/src/main/flight/pid.c b/src/main/flight/pid.c index 523a50fc0c..39fa4b8064 100644 --- a/src/main/flight/pid.c +++ b/src/main/flight/pid.c @@ -218,11 +218,11 @@ static void pidBetaflight(const pidProfile_t *pidProfile, uint16_t max_angle_inc #endif if (FLIGHT_MODE(ANGLE_MODE)) { // ANGLE mode - control is angle based, so control loop is needed - setpointRate[axis] = errorAngle * pidProfile->P8[PIDLEVEL] / 10.0f; + ptermSetpointRate[axis] = setpointRate[axis] = errorAngle * pidProfile->P8[PIDLEVEL] / 10.0f; } else { // HORIZON mode - direct sticks control is applied to rate PID // mix up angle error to desired AngleRate to add a little auto-level feel - setpointRate[axis] = setpointRate[axis] + (errorAngle * pidProfile->I8[PIDLEVEL] * horizonLevelStrength / 10.0f); + ptermSetpointRate[axis] = setpointRate[axis] = setpointRate[axis] + (errorAngle * pidProfile->I8[PIDLEVEL] * horizonLevelStrength / 10.0f); } } diff --git a/src/main/mw.c b/src/main/mw.c index 54b605a120..b112aa6678 100644 --- a/src/main/mw.c +++ b/src/main/mw.c @@ -203,7 +203,7 @@ void calculateSetpointRate(int axis, int16_t rc) { rcSuperfactor = 1.0f / (constrainf(1.0f - (ABS(rcCommandf) * (currentControlRateProfile->rates[axis] / 100.0f)), 0.01f, 1.00f)); if (currentProfile->pidProfile.pidController == PID_CONTROLLER_BETAFLIGHT) { ptermSetpointRate[axis] = constrainf(angleRate * rcSuperfactor, -1998.0f, 1998.0f); - if (currentProfile->pidProfile.ptermSRateWeight < 100 && axis != YAW) { + if (currentProfile->pidProfile.ptermSRateWeight < 100 && axis != YAW && !flightModeFlags) { const float pWeight = currentProfile->pidProfile.ptermSRateWeight / 100.0f; angleRate = angleRate + (pWeight * ptermSetpointRate[axis] - angleRate); } else {