diff --git a/firmware/controllers/actuators/idle_thread.cpp b/firmware/controllers/actuators/idle_thread.cpp index f2737b89b6..49c16af135 100644 --- a/firmware/controllers/actuators/idle_thread.cpp +++ b/firmware/controllers/actuators/idle_thread.cpp @@ -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().unmock().acSwitchLastChangeTimeMs) < 500/*ms*/; // check if within the dead zone isInDeadZone = !acToggleJustTouched && absI(rpm - targetRpm) <= engineConfiguration->idlePidRpmDeadZone; if (isInDeadZone) { diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index f815b6cdf3..0f873c755e 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -321,7 +321,7 @@ void Engine::updateSwitchInputs() { bool result = getAcToggle(); if (engine->acSwitchState != result) { engine->acSwitchState = result; - engine->acSwitchLastChangeTime = getTimeNowUs(); + engine->module().unmock().acSwitchLastChangeTimeMs = US2MS(getTimeNowUs()); } engine->acSwitchState = result; } diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index 0f50597022..c8977287a4 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -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;