This commit is contained in:
rusefi 2017-04-10 15:16:00 -04:00
parent 297edc758e
commit 713a23dc8d
3 changed files with 11 additions and 4 deletions

View File

@ -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;

View File

@ -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) {

View File

@ -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