From b9a792a07c7dd0cba6757f983671943ebe31eee6 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Mon, 17 Jan 2022 20:52:50 -0500 Subject: [PATCH] Better handling of RPM during stop of cranking #3803 refactoring: reusing existing method --- firmware/controllers/actuators/electronic_throttle.cpp | 2 +- firmware/controllers/actuators/fuel_pump.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/firmware/controllers/actuators/electronic_throttle.cpp b/firmware/controllers/actuators/electronic_throttle.cpp index f5b5afa04c..87d5e907de 100644 --- a/firmware/controllers/actuators/electronic_throttle.cpp +++ b/firmware/controllers/actuators/electronic_throttle.cpp @@ -543,7 +543,7 @@ void EtbController::update() { } if (engineConfiguration->disableEtbWhenEngineStopped) { - if (engine->triggerCentral.getTimeSinceTriggerEvent(getTimeNowNt()) > 1) { + if (!engine->triggerCentral.engineMovedRecently()) { // If engine is stopped and so configured, skip the ETB update entirely // This is quieter and pulls less power than leaving it on all the time m_motor->disable(); diff --git a/firmware/controllers/actuators/fuel_pump.cpp b/firmware/controllers/actuators/fuel_pump.cpp index b9dc4a3bf7..bc5823b0de 100644 --- a/firmware/controllers/actuators/fuel_pump.cpp +++ b/firmware/controllers/actuators/fuel_pump.cpp @@ -10,8 +10,7 @@ void FuelPumpController::onSlowCallback() { isPrime = timeSinceIgn >= 0 && timeSinceIgn < engineConfiguration->startUpFuelPumpDuration; // If there was a trigger event recently, turn on the pump, the engine is running! - auto timeSinceTrigger = engine->triggerCentral.getTimeSinceTriggerEvent(getTimeNowNt()); - engineTurnedRecently = timeSinceTrigger < 1; + engineTurnedRecently = engine->triggerCentral.engineMovedRecently(); isPumpOn = isPrime || engineTurnedRecently;