From aff7664c21f3d5538905e65dad8a184de4761908 Mon Sep 17 00:00:00 2001 From: Andrey Date: Thu, 11 Nov 2021 19:58:43 -0500 Subject: [PATCH] refactoring: less hacky implementation --- firmware/controllers/algo/engine.h | 2 +- firmware/controllers/core/fsio_impl.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index 47ad33760d..360496aedd 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -94,7 +94,7 @@ public: AcState acState; bool enableOverdwellProtection = true; bool isPwmEnabled = true; - int triggerActivitySecond = 0; + int triggerActivitySecond = -99; const char *prevOutputName = nullptr; diff --git a/firmware/controllers/core/fsio_impl.cpp b/firmware/controllers/core/fsio_impl.cpp index a352ec3c7d..cd23faea2a 100644 --- a/firmware/controllers/core/fsio_impl.cpp +++ b/firmware/controllers/core/fsio_impl.cpp @@ -720,7 +720,9 @@ void runHardcodedFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE) { } // see FUEL_PUMP_LOGIC if (isBrainPinValid(CONFIG(fuelPumpPin))) { - enginePins.fuelPumpRelay.setValue((getTimeNowSeconds() < engine->triggerActivitySecond + engineConfiguration->startUpFuelPumpDuration) || (engine->rpmCalculator.getRpm() > 0)); + int triggerActivityOrEcuStartSecond = maxI(0, engine->triggerActivitySecond); + + enginePins.fuelPumpRelay.setValue((getTimeNowSeconds() < triggerActivityOrEcuStartSecond + engineConfiguration->startUpFuelPumpDuration) || (engine->rpmCalculator.getRpm() > 0)); } enginePins.o2heater.setValue(engine->rpmCalculator.isRunning());