Air Conditioning Improvements #4054

This commit is contained in:
rusefillc 2022-04-09 00:26:52 -04:00
parent 6a403abf1f
commit e1235c4f2e
3 changed files with 2 additions and 3 deletions

View File

@ -213,7 +213,7 @@ float IdleController::getClosedLoop(IIdleController::Phase phase, float tpsPos,
}
// #1553 we need to give FSIO variable offset or minValue a chance
bool acToggleJustTouched = (nowUs - engine->acSwitchLastChangeTime) < MS2US(500);
bool acToggleJustTouched = (US2MS(nowUs) - engine->module<AcController>().unmock().acSwitchLastChangeTimeMs) < 500/*ms*/;
// check if within the dead zone
isInDeadZone = !acToggleJustTouched && absI(rpm - targetRpm) <= engineConfiguration->idlePidRpmDeadZone;
if (isInDeadZone) {

View File

@ -321,7 +321,7 @@ void Engine::updateSwitchInputs() {
bool result = getAcToggle();
if (engine->acSwitchState != result) {
engine->acSwitchState = result;
engine->acSwitchLastChangeTime = getTimeNowUs();
engine->module<AcController>().unmock().acSwitchLastChangeTimeMs = US2MS(getTimeNowUs());
}
engine->acSwitchState = result;
}

View File

@ -353,7 +353,6 @@ public:
// todo: extract some helper which would contain boolean state and most recent toggle time?
bool acSwitchState = false;
efitimeus_t acSwitchLastChangeTime = 0;
bool isRunningPwmTest = false;