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

switch micro-optimizations

This commit is contained in:
Thorsten Laux 2018-05-24 15:30:55 +02:00
parent dc452ced00
commit 25cc445d7e

View file

@ -641,7 +641,7 @@ void pidController(const pidProfile_t *pidProfile, const rollAndPitchTrims_t *an
const float pidFeedForward = const float pidFeedForward =
pidCoefficient[axis].Kd * dynCd * transition * pidCoefficient[axis].Kd * dynCd * transition *
(currentPidSetpoint - previousPidSetpoint[axis]) * tpaFactor / dT; (currentPidSetpoint - previousPidSetpoint[axis]) * tpaFactor / dT;
if ((pidData[axis].P > 0) == (pidFeedForward > 0)) { if (pidData[axis].P * pidFeedForward > 0) {
if (ABS(pidFeedForward) > ABS(pidData[axis].P)) { if (ABS(pidFeedForward) > ABS(pidData[axis].P)) {
pidData[axis].P = 0; pidData[axis].P = 0;
pidData[axis].D += pidFeedForward; pidData[axis].D += pidFeedForward;