diff --git a/firmware/controllers/algo/aux_pid.cpp b/firmware/controllers/algo/aux_pid.cpp index 5875932c8f..d324f95378 100644 --- a/firmware/controllers/algo/aux_pid.cpp +++ b/firmware/controllers/algo/aux_pid.cpp @@ -58,8 +58,11 @@ static msg_t auxPidThread(int param) { int dt = maxI(10, engineConfiguration->auxPidDT[0]); chThdSleepMilliseconds(dt); - if (parametersVersion.isOld()) + if (parametersVersion.isOld()) { auxPid.reset(); + auxPid.minResult = engineConfiguration->aux1PidMin; + auxPid.maxResult = engineConfiguration->aux1PidMax; + } float rpm = engine->rpmCalculator.rpmValue; diff --git a/firmware/controllers/alternatorController.cpp b/firmware/controllers/alternatorController.cpp index af01042038..930762a98f 100644 --- a/firmware/controllers/alternatorController.cpp +++ b/firmware/controllers/alternatorController.cpp @@ -51,6 +51,8 @@ static msg_t AltCtrlThread(int param) { if (shouldResetPid) { alternatorPidResetCounter++; altPid.reset(); + altPid.minResult = engineConfiguration->bc.alternatorPidMin; + altPid.maxResult = engineConfiguration->bc.alternatorPidMax; shouldResetPid = false; } #endif @@ -154,7 +156,9 @@ void setDefaultAlternatorParameters(void) { } void onConfigurationChangeAlternatorCallback(engine_configuration_s *previousConfiguration) { - shouldResetPid = !altPid.isSame(&previousConfiguration->alternatorControl); + shouldResetPid = !altPid.isSame(&previousConfiguration->alternatorControl) || + engineConfiguration->bc.alternatorPidMin != previousConfiguration->bc.alternatorPidMin || + engineConfiguration->bc.alternatorPidMax != previousConfiguration->bc.alternatorPidMax; } void initAlternatorCtrl(Logging *sharedLogger) { diff --git a/firmware/controllers/math/pid.h b/firmware/controllers/math/pid.h index c6a0df0940..be2d7cd1ab 100644 --- a/firmware/controllers/math/pid.h +++ b/firmware/controllers/math/pid.h @@ -35,10 +35,10 @@ public: #if EFI_PROD_CODE || EFI_SIMULATOR void postState(TunerStudioOutputChannels *tsOutputChannels); #endif -private: - pid_s *pid; float minResult; float maxResult; +private: + pid_s *pid; float iTerm; float dTerm; // we are remembering this only for debugging purposes