1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-21 23:35:34 +03:00

Minor cleanup

Fix for integer PIDC
This commit is contained in:
borisbstyle 2016-07-17 21:12:46 +02:00
parent 221f617799
commit 2d6e0da773
2 changed files with 1 additions and 5 deletions

View file

@ -323,7 +323,7 @@ static void pidInteger(const pidProfile_t *pidProfile, uint16_t max_angle_inclin
uint16_t dynamicFactor = (1 << 8) - constrain(((ABS(AngleRateTmp) << 6) / resetRate), 0, 1 << 8);
uint16_t dynamicKi = (pidProfile->I8[axis] * dynamicFactor) >> 8;
errorGyroI[axis] = errorGyroI[axis] + ((uint16_t)targetPidLooptime >> 11) * dynamicKi;
errorGyroI[axis] = errorGyroI[axis] + ((RateError * (uint16_t)targetPidLooptime) >> 11) * dynamicKi;
// limit maximum integrator value to prevent WindUp - accumulating extreme values when system is saturated.
// I coefficient (I8) moved before integration to make limiting independent from PID settings