auto-sync
This commit is contained in:
parent
8814e39b07
commit
78a8b96228
|
@ -45,12 +45,20 @@ float Pid::getValue(float target, float input, float dTime) {
|
||||||
|
|
||||||
prevError = error;
|
prevError = error;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If we have exceeded the ability of the controlled device to hit target, the I factor will keep accumulating and approach infinity.
|
||||||
|
* Here we limit the I-term #353
|
||||||
|
*/
|
||||||
|
if (iTerm > maxResult - (pTerm + dTerm + pid->offset))
|
||||||
|
iTerm = maxResult - (pTerm + dTerm + pid->offset);
|
||||||
|
|
||||||
|
if (iTerm < minResult - (pTerm + dTerm + pid->offset))
|
||||||
|
iTerm = minResult - (pTerm + dTerm + pid->offset);
|
||||||
|
|
||||||
float result = pTerm + iTerm + dTerm + pid->offset;
|
float result = pTerm + iTerm + dTerm + pid->offset;
|
||||||
if (result > maxResult) {
|
if (result > maxResult) {
|
||||||
// iTerm -= result - maxResult;
|
|
||||||
result = maxResult;
|
result = maxResult;
|
||||||
} else if (result < minResult) {
|
} else if (result < minResult) {
|
||||||
// iTerm += minResult - result;
|
|
||||||
result = minResult;
|
result = minResult;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -249,5 +249,5 @@ int getRusEfiVersion(void) {
|
||||||
return 123; // this is here to make the compiler happy about the unused array
|
return 123; // this is here to make the compiler happy about the unused array
|
||||||
if (UNUSED_CCM_SIZE[0] * 0 != 0)
|
if (UNUSED_CCM_SIZE[0] * 0 != 0)
|
||||||
return 3211; // this is here to make the compiler happy about the unused array
|
return 3211; // this is here to make the compiler happy about the unused array
|
||||||
return 20170212;
|
return 20170213;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue