diff --git a/firmware/controllers/algo/fuel_math.cpp b/firmware/controllers/algo/fuel_math.cpp index 07bd6e655a..78f6538598 100644 --- a/firmware/controllers/algo/fuel_math.cpp +++ b/firmware/controllers/algo/fuel_math.cpp @@ -81,7 +81,7 @@ floatms_t getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) { floatms_t baseFuel; if (CONFIG(fuelAlgorithm) == LM_SPEED_DENSITY) { - baseFuel = getSpeedDensityFuel(PASS_ENGINE_PARAMETER_SIGNATURE); + baseFuel = getSpeedDensityFuel(getMap() PASS_ENGINE_PARAMETER_SUFFIX); efiAssert(CUSTOM_ERR_ASSERT, !cisnan(baseFuel), "NaN sd baseFuel", 0); } else if (engineConfiguration->fuelAlgorithm == LM_REAL_MAF) { float maf = getRealMaf(PASS_ENGINE_PARAMETER_SIGNATURE) + engine->engineLoadAccelEnrichment.getEngineLoadEnrichment(PASS_ENGINE_PARAMETER_SIGNATURE); diff --git a/firmware/controllers/math/speed_density.cpp b/firmware/controllers/math/speed_density.cpp index 939a701573..c2ddbf3735 100644 --- a/firmware/controllers/math/speed_density.cpp +++ b/firmware/controllers/math/speed_density.cpp @@ -8,11 +8,11 @@ */ #include "global.h" +#include "globalaccess.h" #include "speed_density.h" #include "interpolation.h" -#include "rpm_calculator.h" +#include "engine.h" #include "engine_math.h" -#include "engine_state.h" #include "maf2map.h" #define rpmMin 500 @@ -117,7 +117,7 @@ EXTERN_ENGINE; /** * @return per cylinder injection time, in Milliseconds */ -floatms_t getSpeedDensityFuel(DECLARE_ENGINE_PARAMETER_SIGNATURE) { +floatms_t getSpeedDensityFuel(float map DECLARE_ENGINE_PARAMETER_SUFFIX) { /** * most of the values are pre-calculated for performance reasons */ @@ -126,7 +126,6 @@ floatms_t getSpeedDensityFuel(DECLARE_ENGINE_PARAMETER_SIGNATURE) { warning(CUSTOM_ERR_TCHARGE_NOT_READY2, "tChargeK not ready"); // this would happen before we have CLT reading for example return 0; } - float map = getMap(); efiAssert(CUSTOM_ERR_ASSERT, !cisnan(map), "NaN map", 0); float adjustedMap = map + engine->engineLoadAccelEnrichment.getEngineLoadEnrichment(PASS_ENGINE_PARAMETER_SIGNATURE); diff --git a/firmware/controllers/math/speed_density.h b/firmware/controllers/math/speed_density.h index 074bd8f8d0..bc74e285b2 100644 --- a/firmware/controllers/math/speed_density.h +++ b/firmware/controllers/math/speed_density.h @@ -7,8 +7,6 @@ #ifndef SPEED_DENSITY_H_ #define SPEED_DENSITY_H_ -#include "engine.h" - #define gramm_second_to_cc_minute(gs) ((gs) / 0.0119997981) #define cc_minute_to_gramm_second(ccm) ((ccm) * 0.0119997981) @@ -18,6 +16,6 @@ float sdMath(float airMass, float AFR DECLARE_ENGINE_PARAMETER_SUFFIX); void setDefaultVETable(DECLARE_ENGINE_PARAMETER_SIGNATURE); void initSpeedDensity(DECLARE_ENGINE_PARAMETER_SIGNATURE); -floatms_t getSpeedDensityFuel(DECLARE_ENGINE_PARAMETER_SIGNATURE); +floatms_t getSpeedDensityFuel(float map DECLARE_ENGINE_PARAMETER_SUFFIX); #endif /* SPEED_DENSITY_H_ */