Rev 2085 | Rev 2092 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2085 | Rev 2086 | ||
---|---|---|---|
Line 202... | Line 202... | ||
202 | IPart[axis] += iDiff - controls[axis]; // With gyroIFactor == 0, PDPart is really just a D-part. Integrate D-part (the rot. rate) and the stick pos. |
202 | IPart[axis] += iDiff - controls[axis]; // With gyroIFactor == 0, PDPart is really just a D-part. Integrate D-part (the rot. rate) and the stick pos. |
203 | } else { |
203 | } else { |
204 | IPart[axis] += PDPart - controls[axis]; // With gyroIFactor == 0, PDPart is really just a D-part. Integrate D-part (the rot. rate) and the stick pos. |
204 | IPart[axis] += PDPart - controls[axis]; // With gyroIFactor == 0, PDPart is really just a D-part. Integrate D-part (the rot. rate) and the stick pos. |
205 | } |
205 | } |
Line -... | Line 206... | ||
- | 206 | ||
- | 207 | // So (int32_t) rate_PID[axis] * gyroPFactor / (GYRO_DEG_FACTOR_PITCHROLL >> 4) + |
|
- | 208 | // attitude[axis] * gyroIFactor / (GYRO_DEG_FACTOR_PITCHROLL << 2) - controls[axis] |
|
- | 209 | // We can ignore the rate: attitude[axis] * gyroIFactor / (GYRO_DEG_FACTOR_PITCHROLL << 2) - controls[axis] |
|
- | 210 | // That is: attitudeAngle[degrees] * gyroIFactor/4 - controls[axis] |
|
- | 211 | // So attitude attained at attitudeAngle[degrees] * gyroIFactor/4 == controls[axis] |
|
206 | 212 | ||
207 | // With normal Ki, limit I parts to +/- 205 (of about 1024) |
213 | // With normal Ki, limit I parts to +/- 205 (of about 1024) |
208 | if (IPart[axis] < -64000) { |
214 | if (IPart[axis] < -64000) { |
209 | IPart[axis] = -64000; |
215 | IPart[axis] = -64000; |
210 | debugOut.digital[1] |= DEBUG_FLIGHTCLIP; |
216 | debugOut.digital[1] |= DEBUG_FLIGHTCLIP; |