ETB overheats due to constant isTpsError true/false/true/false jitter #4832

This commit is contained in:
rusefillc 2022-11-27 23:29:08 -05:00
parent 740425611f
commit 9e3b7fabfe
1 changed files with 6 additions and 0 deletions

View File

@ -501,6 +501,7 @@ expected<percent_t> EtbController::getClosedLoop(percent_t target, percent_t obs
}
if (m_isAutotune) {
etbInputErrorCounter = 0;
return getClosedLoopAutotune(target, observation);
} else {
// Check that we're not over the error limit
@ -517,7 +518,12 @@ expected<percent_t> EtbController::getClosedLoop(percent_t target, percent_t obs
etbDutyRateOfChange = m_dutyIntegrator.accumulate(prevOutput - output);
prevOutput = output;
static bool wasInputError = false; // 'static' meaning it's a global variable just with limited visibility
bool isInputError = !Sensor::get(SensorType::Tps1).Valid || isTps2Error() || isPedalError();
if (Sensor::getOrZero(SensorType::Rpm) == 0 && wasInputError != isInputError) {
wasInputError = isInputError;
etbInputErrorCounter++;
}
return output;
}
}