diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index 2745e8b45d..9b47123d50 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -150,6 +150,9 @@ public: */ floatms_t injectorLag; + /** + * See useWarmupPidAfr + */ Pid warmupAfrPid; float baroCorrection; diff --git a/firmware/controllers/alternatorController.cpp b/firmware/controllers/alternatorController.cpp index 56174757dc..934ff897ef 100644 --- a/firmware/controllers/alternatorController.cpp +++ b/firmware/controllers/alternatorController.cpp @@ -63,7 +63,7 @@ static msg_t AltCtrlThread(int param) { continue; } - currentAltDuty = engineConfiguration->alternatorControl.offset + altPid.getValue(engineConfiguration->targetVBatt, getVBatt(PASS_ENGINE_PARAMETER_F), 1); + currentAltDuty = altPid.getValue(engineConfiguration->targetVBatt, getVBatt(PASS_ENGINE_PARAMETER_F), 1); if (boardConfiguration->isVerboseAlternator) { scheduleMsg(logger, "alt duty: %f/vbatt=%f/p=%f/i=%f/d=%f int=%f", currentAltDuty, getVBatt(PASS_ENGINE_PARAMETER_F), altPid.getP(), altPid.getI(), altPid.getD(), altPid.getIntegration()); diff --git a/firmware/controllers/math/pid.cpp b/firmware/controllers/math/pid.cpp index 706cbb59a3..1a2e82cb4a 100644 --- a/firmware/controllers/math/pid.cpp +++ b/firmware/controllers/math/pid.cpp @@ -36,7 +36,7 @@ float Pid::getValue(float target, float input, float dTime) { prevError = error; - float result = pTerm + iTerm + dTerm; + float result = pTerm + iTerm + dTerm + pid->offset; if (result > maxResult) { // iTerm -= result - maxResult; result = maxResult;