good enough solution for now #435

This commit is contained in:
rusEfi 2017-06-04 12:59:24 -04:00
parent 828a7c8ca0
commit b467d70f85
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) if (iTerm > pid->maxValue)
iTerm = pid->maxValue; iTerm = pid->maxValue;
if (iTerm < pid->minValue) // this is kind of a hack. a proper fix would be having separate additional settings 'maxIValue' and 'minIValye'
iTerm = pid->minValue; if (iTerm < -pid->maxValue)
iTerm = -pid->maxValue;
float result = pTerm + iTerm + dTerm + pid->offset; float result = pTerm + iTerm + dTerm + pid->offset;
if (result > pid->maxValue) { if (result > pid->maxValue) {