Revert "Performance improvement: call GetBaseFuel less (#979)"

This reverts commit 95e51f13
This commit is contained in:
rusefi 2019-10-16 22:29:19 -04:00
parent 95e51f1399
commit 7eb9947fd4
4 changed files with 13 additions and 3 deletions

View File

@ -368,9 +368,13 @@ void Engine::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engine->m.beforeFuelCalc = getTimeNowLowerNt(); engine->m.beforeFuelCalc = getTimeNowLowerNt();
int rpm = GET_RPM(); 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(injectionDuration) = getInjectionDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX);
engine->m.fuelCalcTime = getTimeNowLowerNt() - engine->m.beforeFuelCalc; engine->m.fuelCalcTime = getTimeNowLowerNt() - engine->m.beforeFuelCalc;
} }
void doScheduleStopEngine(DECLARE_ENGINE_PARAMETER_SIGNATURE) { void doScheduleStopEngine(DECLARE_ENGINE_PARAMETER_SIGNATURE) {

View File

@ -29,7 +29,7 @@
#include "global_execution_queue.h" #include "global_execution_queue.h"
#endif /* EFI_UNIT_TEST */ #endif /* EFI_UNIT_TEST */
#define FAST_CALLBACK_PERIOD_MS 5 #define FAST_CALLBACK_PERIOD_MS 20
class RpmCalculator; class RpmCalculator;

View File

@ -220,7 +220,7 @@ int getNumberOfInjections(injection_mode_e mode DECLARE_ENGINE_PARAMETER_SUFFIX)
* @see getCoilDutyCycle * @see getCoilDutyCycle
*/ */
percent_t getInjectorDutyCycle(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) { percent_t getInjectorDutyCycle(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
floatms_t totalInjectiorAmountPerCycle = ENGINE(injectionDuration) * getNumberOfInjections(engineConfiguration->injectionMode PASS_ENGINE_PARAMETER_SUFFIX); floatms_t totalInjectiorAmountPerCycle = getInjectionDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX) * getNumberOfInjections(engineConfiguration->injectionMode PASS_ENGINE_PARAMETER_SUFFIX);
floatms_t engineCycleDuration = getEngineCycleDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX); floatms_t engineCycleDuration = getEngineCycleDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX);
return 100 * totalInjectiorAmountPerCycle / engineCycleDuration; return 100 * totalInjectiorAmountPerCycle / engineCycleDuration;
} }

View File

@ -389,6 +389,12 @@ static ALWAYS_INLINE void handleFuel(const bool limitedFuel, uint32_t trgEventIn
ENGINE(engineLoadAccelEnrichment.onEngineCycle(PASS_ENGINE_PARAMETER_SIGNATURE)); 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++) { for (int injEventIndex = 0; injEventIndex < CONFIG(specs.cylindersCount); injEventIndex++) {
InjectionEvent *event = &fs->elements[injEventIndex]; InjectionEvent *event = &fs->elements[injEventIndex];
uint32_t eventIndex = event->injectionStart.triggerEventIndex; uint32_t eventIndex = event->injectionStart.triggerEventIndex;