maybe #393 reset bugfix

This commit is contained in:
rusefi 2017-04-10 22:07:51 -04:00
parent 713a23dc8d
commit 5e839b0880
4 changed files with 20 additions and 10 deletions

View File

@ -51,6 +51,12 @@ static bool isEnabled(int index) {
}
}
static void pidReset(void) {
auxPid.reset();
auxPid.minResult = engineConfiguration->aux1PidMin;
auxPid.maxResult = engineConfiguration->aux1PidMax;
}
static msg_t auxPidThread(int param) {
UNUSED(param);
chRegSetThreadName("AuxPidController");
@ -59,9 +65,7 @@ static msg_t auxPidThread(int param) {
chThdSleepMilliseconds(dt);
if (parametersVersion.isOld()) {
auxPid.reset();
auxPid.minResult = engineConfiguration->aux1PidMin;
auxPid.maxResult = engineConfiguration->aux1PidMax;
pidReset();
}
float rpm = engine->rpmCalculator.rpmValue;
@ -71,7 +75,7 @@ static msg_t auxPidThread(int param) {
if (!enabledAtCurrentRpm) {
// we need to avoid accumulating iTerm while engine is not running
auxPid.reset();
pidReset();
continue;
}

View File

@ -43,16 +43,20 @@ extern TunerStudioOutputChannels tsOutputChannels;
static bool currentPlainOnOffState = false;
static bool shouldResetPid = false;
static void pidReset(void) {
altPid.reset();
altPid.minResult = engineConfiguration->bc.alternatorPidMin;
altPid.maxResult = engineConfiguration->bc.alternatorPidMax;
}
static msg_t AltCtrlThread(int param) {
UNUSED(param);
chRegSetThreadName("AlternatorController");
while (true) {
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__)
if (shouldResetPid) {
pidReset();
alternatorPidResetCounter++;
altPid.reset();
altPid.minResult = engineConfiguration->bc.alternatorPidMin;
altPid.maxResult = engineConfiguration->bc.alternatorPidMax;
shouldResetPid = false;
}
#endif
@ -78,7 +82,7 @@ static msg_t AltCtrlThread(int param) {
if (!engine->isAlternatorControlEnabled) {
// we need to avoid accumulating iTerm while engine is not running
altPid.reset();
pidReset();
continue;
}
@ -127,7 +131,7 @@ void showAltInfo(void) {
void setAltPFactor(float p) {
engineConfiguration->alternatorControl.pFactor = p;
scheduleMsg(logger, "setAltPid: %f", p);
altPid.reset();
pidReset();
showAltInfo();
}

View File

@ -106,6 +106,8 @@ void Pid::postState(TunerStudioOutputChannels *tsOutputChannels) {
tsOutputChannels->debugFloatField3 = getPrevError();
tsOutputChannels->debugFloatField4 = getI();
tsOutputChannels->debugFloatField5 = getD();
tsOutputChannels->debugFloatField6 = minResult;
tsOutputChannels->debugFloatField7 = maxResult;
tsOutputChannels->debugIntField1 = getP();
tsOutputChannels->debugIntField2 = getOffset();
tsOutputChannels->debugFloatField6 = dTerm;

View File

@ -250,5 +250,5 @@ int getRusEfiVersion(void) {
return 123; // this is here to make the compiler happy about the unused array
if (UNUSED_CCM_SIZE[0] * 0 != 0)
return 3211; // this is here to make the compiler happy about the unused array
return 20170409;
return 20170410;
}