From 7d73334b542d34bc3a702971c59c1f531ec45f6c Mon Sep 17 00:00:00 2001 From: rusefi Date: Wed, 16 Oct 2019 23:02:24 -0400 Subject: [PATCH] Revert "Revert "Performance improvement: call GetBaseFuel less (#979)"" This reverts commit 323904728da6aa05c5a430a94df02dd5b0467794. --- firmware/controllers/algo/engine.cpp | 6 +----- firmware/controllers/algo/engine.h | 2 +- firmware/controllers/algo/fuel_math.cpp | 2 +- firmware/controllers/trigger/main_trigger_callback.cpp | 6 ------ 4 files changed, 3 insertions(+), 13 deletions(-) diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index 41f0e44b02..b7a290a6dd 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -368,13 +368,9 @@ void Engine::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) { engine->m.beforeFuelCalc = getTimeNowLowerNt(); int rpm = GET_RPM(); - /** - * we have same assignment of 'getInjectionDuration' to 'injectionDuration' in handleFuel() - * Open question why do we refresh that in two places? - */ + ENGINE(injectionDuration) = getInjectionDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX); engine->m.fuelCalcTime = getTimeNowLowerNt() - engine->m.beforeFuelCalc; - } void doScheduleStopEngine(DECLARE_ENGINE_PARAMETER_SIGNATURE) { diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index fa12c32967..5de0986af1 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -29,7 +29,7 @@ #include "global_execution_queue.h" #endif /* EFI_UNIT_TEST */ -#define FAST_CALLBACK_PERIOD_MS 20 +#define FAST_CALLBACK_PERIOD_MS 5 class RpmCalculator; diff --git a/firmware/controllers/algo/fuel_math.cpp b/firmware/controllers/algo/fuel_math.cpp index 61b8f1691b..6de092a976 100644 --- a/firmware/controllers/algo/fuel_math.cpp +++ b/firmware/controllers/algo/fuel_math.cpp @@ -220,7 +220,7 @@ int getNumberOfInjections(injection_mode_e mode DECLARE_ENGINE_PARAMETER_SUFFIX) * @see getCoilDutyCycle */ percent_t getInjectorDutyCycle(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) { - floatms_t totalInjectiorAmountPerCycle = getInjectionDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX) * getNumberOfInjections(engineConfiguration->injectionMode PASS_ENGINE_PARAMETER_SUFFIX); + floatms_t totalInjectiorAmountPerCycle = ENGINE(injectionDuration) * getNumberOfInjections(engineConfiguration->injectionMode PASS_ENGINE_PARAMETER_SUFFIX); floatms_t engineCycleDuration = getEngineCycleDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX); return 100 * totalInjectiorAmountPerCycle / engineCycleDuration; } diff --git a/firmware/controllers/trigger/main_trigger_callback.cpp b/firmware/controllers/trigger/main_trigger_callback.cpp index 29b8f63883..90a968ef22 100644 --- a/firmware/controllers/trigger/main_trigger_callback.cpp +++ b/firmware/controllers/trigger/main_trigger_callback.cpp @@ -389,12 +389,6 @@ static ALWAYS_INLINE void handleFuel(const bool limitedFuel, uint32_t trgEventIn ENGINE(engineLoadAccelEnrichment.onEngineCycle(PASS_ENGINE_PARAMETER_SIGNATURE)); } - /** - * we have same assignment of 'getInjectionDuration' to 'injectionDuration' in periodicFastCallback() - * Open question why do we refresh that in two places? - */ - ENGINE(injectionDuration) = getInjectionDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX); - for (int injEventIndex = 0; injEventIndex < CONFIG(specs.cylindersCount); injEventIndex++) { InjectionEvent *event = &fs->elements[injEventIndex]; uint32_t eventIndex = event->injectionStart.triggerEventIndex;