From 8f5895321caa54f4a477db47250a02b4c53069e8 Mon Sep 17 00:00:00 2001 From: rusefi Date: Tue, 5 Nov 2019 23:17:44 -0500 Subject: [PATCH] refactoring --- firmware/config/engines/ford_aspire.cpp | 2 +- firmware/config/engines/ford_festiva.cpp | 2 +- firmware/controllers/algo/engine_configuration.cpp | 1 + firmware/controllers/math/engine_math.cpp | 5 ++++- firmware/controllers/math/engine_math.h | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/firmware/config/engines/ford_aspire.cpp b/firmware/config/engines/ford_aspire.cpp index a09b78d73a..f3bbe29921 100644 --- a/firmware/config/engines/ford_aspire.cpp +++ b/firmware/config/engines/ford_aspire.cpp @@ -123,7 +123,7 @@ void setFordAspireEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) { // set cranking_timing_angle 37 engineConfiguration->crankingTimingAngle = -37; - setSingleCoilDwell(engineConfiguration); + setSingleCoilDwell(PASS_CONFIG_PARAMETER_SIGNATURE); engineConfiguration->ignitionMode = IM_ONE_COIL; setOperationMode(engineConfiguration, FOUR_STROKE_CAM_SENSOR); engineConfiguration->useOnlyRisingEdgeForTrigger = true; diff --git a/firmware/config/engines/ford_festiva.cpp b/firmware/config/engines/ford_festiva.cpp index 577311f3ec..d2fb46d52f 100644 --- a/firmware/config/engines/ford_festiva.cpp +++ b/firmware/config/engines/ford_festiva.cpp @@ -155,7 +155,7 @@ void setFordEscortGt(DECLARE_CONFIG_PARAMETER_SIGNATURE) { setWholeFuelMap(5 PASS_CONFIG_PARAMETER_SUFFIX); setAfrMap(config->afrTable, 13.5); - setSingleCoilDwell(engineConfiguration); + setSingleCoilDwell(PASS_CONFIG_PARAMETER_SIGNATURE); engineConfiguration->ignitionMode = IM_ONE_COIL; boardConfiguration->triggerSimulatorPinModes[0] = OM_OPENDRAIN; diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index cc232a73ff..15ead130d0 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -202,6 +202,7 @@ void incrementGlobalConfigurationVersion(DECLARE_ENGINE_PARAMETER_SIGNATURE) { /** * @brief Sets the same dwell time across the whole getRpm() range + * set dwell X */ void setConstantDwell(floatms_t dwellMs DECLARE_CONFIG_PARAMETER_SUFFIX) { for (int i = 0; i < DWELL_CURVE_SIZE; i++) { diff --git a/firmware/controllers/math/engine_math.cpp b/firmware/controllers/math/engine_math.cpp index bd08322804..b2af84c93e 100644 --- a/firmware/controllers/math/engine_math.cpp +++ b/firmware/controllers/math/engine_math.cpp @@ -80,7 +80,10 @@ float getEngineLoadT(DECLARE_ENGINE_PARAMETER_SIGNATURE) { } } -void setSingleCoilDwell(engine_configuration_s *engineConfiguration) { +/** + * see also setConstantDwell + */ +void setSingleCoilDwell(DECLARE_CONFIG_PARAMETER_SIGNATURE) { for (int i = 0; i < DWELL_CURVE_SIZE; i++) { engineConfiguration->sparkDwellRpmBins[i] = i + 1; engineConfiguration->sparkDwellValues[i] = 4; diff --git a/firmware/controllers/math/engine_math.h b/firmware/controllers/math/engine_math.h index be87d84adc..e66f7521ea 100644 --- a/firmware/controllers/math/engine_math.h +++ b/firmware/controllers/math/engine_math.h @@ -61,7 +61,7 @@ void setFuelLoadBin(float from, float to DECLARE_CONFIG_PARAMETER_SUFFIX); void setTimingRpmBin(float from, float to DECLARE_CONFIG_PARAMETER_SUFFIX); void setTimingLoadBin(float from, float to DECLARE_CONFIG_PARAMETER_SUFFIX); -void setSingleCoilDwell(engine_configuration_s *engineConfiguration); +void setSingleCoilDwell(DECLARE_CONFIG_PARAMETER_SIGNATURE); // we combine trigger-defined triggerShape.tdcPosition with user-defined CONFIG(globalTriggerAngleOffset) // expectation is that for well-known triggers CONFIG(globalTriggerAngleOffset) would usually be zero