good enough solution for now #435

This commit is contained in:
rusEfi 2017-06-04 12:59:24 -04:00
parent c5f9828bc2
commit 9623b3938b
1 changed files with 3 additions and 2 deletions

View File

@ -53,8 +53,9 @@ float Pid::getValue(float target, float input, float dTime) {
if (iTerm > pid->maxValue)
iTerm = pid->maxValue;
if (iTerm < pid->minValue)
iTerm = pid->minValue;
// this is kind of a hack. a proper fix would be having separate additional settings 'maxIValue' and 'minIValye'
if (iTerm < -pid->maxValue)
iTerm = -pid->maxValue;
float result = pTerm + iTerm + dTerm + pid->offset;
if (result > pid->maxValue) {