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

address style requests

This commit is contained in:
Thorsten Laux 2018-05-25 07:12:12 +02:00
parent 5aad57c3a7
commit af5fde98c1

View file

@ -640,19 +640,23 @@ void pidController(const pidProfile_t *pidProfile, const rollAndPitchTrims_t *an
pidData[axis].D = pidCoefficient[axis].Kd * delta * tpaFactor;
const float pidFeedForward =
pidCoefficient[axis].Kd * dynCd * transition *
(currentPidSetpoint - previousPidSetpoint[axis]) * tpaFactor / dT;
bool addFeedforward = true;
if (smartFeedforward)
if (smartFeedforward) {
if (pidData[axis].P * pidFeedForward > 0) {
if (ABS(pidFeedForward) > ABS(pidData[axis].P)) {
pidData[axis].P = 0;
}
else addFeedforward = false;
else {
addFeedforward = false;
}
}
if (addFeedforward) pidData[axis].D += pidFeedForward;
}
if (addFeedforward) {
pidData[axis].D += pidFeedForward;
}
#ifdef USE_YAW_SPIN_RECOVERY
if (yawSpinActive) {