From a3b29f9011d6e938f145909fe2710e332c0ed485 Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Mon, 20 Jul 2020 23:11:48 -0700 Subject: [PATCH] use ign load for ign --- firmware/console/status_loop.cpp | 2 +- firmware/controllers/algo/engine2.cpp | 12 +++++++----- firmware/controllers/algo/fuel_math.cpp | 8 +++----- firmware/controllers/algo/fuel_math.h | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index c6539cd435..1d63ea8d7e 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -297,7 +297,7 @@ static void showFuelInfo2(float rpm, float engineLoad) { scheduleMsg(&logger2, "algo=%s/pump=%s", getEngine_load_mode_e(engineConfiguration->fuelAlgorithm), boolToString(enginePins.fuelPumpRelay.getLogicValue())); - scheduleMsg(&logger2, "injection phase=%.2f/global fuel correction=%.2f", getInjectionOffset(rpm), engineConfiguration->globalFuelCorrection); + scheduleMsg(&logger2, "injection phase=%.2f/global fuel correction=%.2f", getInjectionOffset(rpm, getFuelingLoad()), engineConfiguration->globalFuelCorrection); scheduleMsg(&logger2, "baro correction=%.2f", engine->engineState.baroCorrection); diff --git a/firmware/controllers/algo/engine2.cpp b/firmware/controllers/algo/engine2.cpp index 477b536dc3..838dc931d6 100644 --- a/firmware/controllers/algo/engine2.cpp +++ b/firmware/controllers/algo/engine2.cpp @@ -174,10 +174,6 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) { baroCorrection = getBaroCorrection(PASS_ENGINE_PARAMETER_SIGNATURE); - injectionOffset = getInjectionOffset(rpm PASS_ENGINE_PARAMETER_SUFFIX); - float engineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE); - timingAdvance = getAdvance(rpm, engineLoad PASS_ENGINE_PARAMETER_SUFFIX); - multispark.count = getMultiSparkCount(rpm PASS_ENGINE_PARAMETER_SUFFIX); if (engineConfiguration->fuelAlgorithm == LM_SPEED_DENSITY) { @@ -203,10 +199,16 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) { } currentBaroCorrectedVE = baroCorrection * currentRawVE * PERCENT_DIV; } else { - baseTableFuel = getBaseTableFuel(rpm, engineLoad); + baseTableFuel = getBaseTableFuel(rpm, getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE)); } ENGINE(injectionDuration) = getInjectionDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX); + + float fuelLoad = getFuelingLoad(PASS_ENGINE_PARAMETER_SIGNATURE); + injectionOffset = getInjectionOffset(rpm, fuelLoad PASS_ENGINE_PARAMETER_SUFFIX); + + float ignitionLoad = getIgnitionLoad(PASS_ENGINE_PARAMETER_SIGNATURE); + timingAdvance = getAdvance(rpm, ignitionLoad PASS_ENGINE_PARAMETER_SUFFIX); #endif // EFI_ENGINE_CONTROL } diff --git a/firmware/controllers/algo/fuel_math.cpp b/firmware/controllers/algo/fuel_math.cpp index c744702a62..5900d0c6c7 100644 --- a/firmware/controllers/algo/fuel_math.cpp +++ b/firmware/controllers/algo/fuel_math.cpp @@ -260,18 +260,16 @@ floatms_t getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) { return tpsAccelEnrich + baseFuel; } -angle_t getInjectionOffset(float rpm DECLARE_ENGINE_PARAMETER_SUFFIX) { +angle_t getInjectionOffset(float rpm, float load DECLARE_ENGINE_PARAMETER_SUFFIX) { if (cisnan(rpm)) { return 0; // error already reported } - float engineLoad = getFuelingLoad(PASS_ENGINE_PARAMETER_SIGNATURE); - - if (cisnan(engineLoad)) { + if (cisnan(load)) { return 0; // error already reported } - angle_t value = fuelPhaseMap.getValue(rpm, engineLoad); + angle_t value = fuelPhaseMap.getValue(rpm, load); if (cisnan(value)) { // we could be here while resetting configuration for example diff --git a/firmware/controllers/algo/fuel_math.h b/firmware/controllers/algo/fuel_math.h index 4bd979900a..d0b52aebff 100644 --- a/firmware/controllers/algo/fuel_math.h +++ b/firmware/controllers/algo/fuel_math.h @@ -27,7 +27,7 @@ AirmassResult getRealMafAirmass(float airMass, int rpm DECLARE_ENGINE_PARAMETER_ floatms_t getBaseTableFuel(int rpm, float engineLoad); float getBaroCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE); int getNumberOfInjections(injection_mode_e mode DECLARE_ENGINE_PARAMETER_SUFFIX); -angle_t getInjectionOffset(float rpm DECLARE_ENGINE_PARAMETER_SUFFIX); +angle_t getInjectionOffset(float rpm, float load DECLARE_ENGINE_PARAMETER_SUFFIX); float getIatFuelCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE); floatms_t getInjectorLag(float vBatt DECLARE_ENGINE_PARAMETER_SUFFIX); float getCltFuelCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE);