Refactor previousErrorGyroI
This commit is contained in:
parent
4b6f276d2b
commit
18da3d08f8
|
@ -65,8 +65,8 @@ int32_t axisPID_P[3], axisPID_I[3], axisPID_D[3];
|
|||
// PIDweight is a scale factor for PIDs which is derived from the throttle and TPA setting, and 100 = 100% scale means no PID reduction
|
||||
uint8_t PIDweight[3];
|
||||
|
||||
static int32_t errorGyroI[3], previousErrorGyroI[3];
|
||||
static float errorGyroIf[3], previousErrorGyroIf[3];
|
||||
static int32_t errorGyroI[3], errorGyroILimit[3];
|
||||
static float errorGyroIf[3], errorGyroIfLimit[3];
|
||||
|
||||
static void pidRewrite(pidProfile_t *pidProfile, controlRateConfig_t *controlRateConfig,
|
||||
uint16_t max_angle_inclination, rollAndPitchTrims_t *angleTrim, rxConfig_t *rxConfig);
|
||||
|
@ -203,9 +203,9 @@ static void pidLuxFloat(pidProfile_t *pidProfile, controlRateConfig_t *controlRa
|
|||
if (IS_RC_MODE_ACTIVE(BOXAIRMODE) || IS_RC_MODE_ACTIVE(BOXACROPLUS)) {
|
||||
errorGyroIf[axis] *= scaleItermToRcInput(axis);
|
||||
if (motorLimitReached || lowThrottleWindupProtection) {
|
||||
PREVENT_WINDUP(errorGyroIf[axis], previousErrorGyroIf[axis]);
|
||||
PREVENT_WINDUP(errorGyroIf[axis], errorGyroIfLimit[axis]);
|
||||
} else {
|
||||
previousErrorGyroIf[axis] = errorGyroIf[axis];
|
||||
errorGyroIfLimit[axis] = errorGyroIf[axis];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -350,9 +350,9 @@ static void pidRewrite(pidProfile_t *pidProfile, controlRateConfig_t *controlRat
|
|||
if (IS_RC_MODE_ACTIVE(BOXAIRMODE) || IS_RC_MODE_ACTIVE(BOXACROPLUS)) {
|
||||
errorGyroI[axis] = (int32_t) (errorGyroI[axis] * scaleItermToRcInput(axis));
|
||||
if (motorLimitReached || lowThrottleWindupProtection) {
|
||||
PREVENT_WINDUP(errorGyroI[axis], previousErrorGyroI[axis]);
|
||||
PREVENT_WINDUP(errorGyroI[axis], errorGyroILimit[axis]);
|
||||
} else {
|
||||
previousErrorGyroI[axis] = errorGyroI[axis];
|
||||
errorGyroILimit[axis] = errorGyroI[axis];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue