The Big Refactoring of 2019: DECLARE_ENGINE_PARAMETER_SUFFIX consistency and simplification #657
This commit is contained in:
parent
e383cabfbe
commit
6682a7def2
|
@ -143,9 +143,9 @@ static const fuel_table_t veDodgeNeon2003Table = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
EXTERN_ENGINE;
|
EXTERN_CONFIG;
|
||||||
|
|
||||||
void setDodgeNeon1995EngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
void setDodgeNeon1995EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||||
engineConfiguration->trigger.type = TT_DODGE_NEON_1995;
|
engineConfiguration->trigger.type = TT_DODGE_NEON_1995;
|
||||||
|
|
||||||
engineConfiguration->fuelAlgorithm = LM_ALPHA_N;
|
engineConfiguration->fuelAlgorithm = LM_ALPHA_N;
|
||||||
|
@ -177,8 +177,8 @@ void setDodgeNeon1995EngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// set_whole_fuel_map 9
|
// set_whole_fuel_map 9
|
||||||
setWholeFuelMap(9 PASS_ENGINE_PARAMETER_SUFFIX);
|
setWholeFuelMap(9 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||||
setWholeTimingTable(12 PASS_ENGINE_PARAMETER_SUFFIX);
|
setWholeTimingTable(12 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
// set cranking_injection_mode 0
|
// set cranking_injection_mode 0
|
||||||
engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS;
|
engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS;
|
||||||
|
@ -252,7 +252,7 @@ void setDodgeNeon1995EngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
engineConfiguration->sensorChartFrequency = 7;
|
engineConfiguration->sensorChartFrequency = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setDodgeNeonNGCEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
void setDodgeNeonNGCEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||||
engineConfiguration->trigger.type = TT_DODGE_NEON_2003_CAM;
|
engineConfiguration->trigger.type = TT_DODGE_NEON_2003_CAM;
|
||||||
setFrankenso_01_LCD(boardConfiguration);
|
setFrankenso_01_LCD(boardConfiguration);
|
||||||
setFrankenso0_1_joystick(engineConfiguration);
|
setFrankenso0_1_joystick(engineConfiguration);
|
||||||
|
@ -518,8 +518,8 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
// end of setDodgeNeonNGCEngineConfiguration
|
// end of setDodgeNeonNGCEngineConfiguration
|
||||||
}
|
}
|
||||||
|
|
||||||
void setDodgeNeonNGCEngineConfigurationCrankBased(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
void setDodgeNeonNGCEngineConfigurationCrankBased(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||||
setDodgeNeonNGCEngineConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
|
setDodgeNeonNGCEngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* EFI_SUPPORT_DODGE_NEON */
|
#endif /* EFI_SUPPORT_DODGE_NEON */
|
||||||
|
|
|
@ -13,14 +13,14 @@
|
||||||
|
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
|
|
||||||
void setDodgeNeon1995EngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
void setDodgeNeon1995EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
void setDodgeNeonNGCEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
void setDodgeNeonNGCEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testing or broken CAM sensor option
|
* testing or broken CAM sensor option
|
||||||
*/
|
*/
|
||||||
void setDodgeNeonNGCEngineConfigurationCrankBased(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
void setDodgeNeonNGCEngineConfigurationCrankBased(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
|
|
||||||
#endif /* EFI_SUPPORT_DODGE_NEON */
|
#endif /* EFI_SUPPORT_DODGE_NEON */
|
||||||
|
|
|
@ -29,7 +29,7 @@ void setDodgeRam1996(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
engineConfiguration->crankingChargeAngle = 30;
|
engineConfiguration->crankingChargeAngle = 30;
|
||||||
|
|
||||||
// set_whole_fuel_map 6
|
// set_whole_fuel_map 6
|
||||||
setWholeFuelMap(6 PASS_ENGINE_PARAMETER_SUFFIX);
|
setWholeFuelMap(6 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
//Base engine setting
|
//Base engine setting
|
||||||
engineConfiguration->specs.cylindersCount = 8;
|
engineConfiguration->specs.cylindersCount = 8;
|
||||||
|
|
|
@ -147,9 +147,9 @@ void setFordEscortGt(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
engineConfiguration->cranking.baseFuel = 9;
|
engineConfiguration->cranking.baseFuel = 9;
|
||||||
|
|
||||||
setLinearCurve(config->ignitionLoadBins, IGN_LOAD_COUNT, 20, 105, 5);
|
setLinearCurve(config->ignitionLoadBins, IGN_LOAD_COUNT, 20, 105, 5);
|
||||||
setWholeTimingTable(10 PASS_ENGINE_PARAMETER_SUFFIX);
|
setWholeTimingTable(10 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||||
// set_whole_fuel_map 5
|
// set_whole_fuel_map 5
|
||||||
setWholeFuelMap(5 PASS_ENGINE_PARAMETER_SUFFIX);
|
setWholeFuelMap(5 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||||
setAfrMap(config->afrTable, 13.5);
|
setAfrMap(config->afrTable, 13.5);
|
||||||
|
|
||||||
setSingleCoilDwell(engineConfiguration);
|
setSingleCoilDwell(engineConfiguration);
|
||||||
|
|
|
@ -66,10 +66,10 @@ void setMazda626EngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
setFuelLoadBin(0, 100 PASS_ENGINE_PARAMETER_SUFFIX);
|
setFuelLoadBin(0, 100 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
// set_whole_fuel_map 9
|
// set_whole_fuel_map 9
|
||||||
setWholeFuelMap(9 PASS_ENGINE_PARAMETER_SUFFIX);
|
setWholeFuelMap(9 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
// set_whole_timing_map 10
|
// set_whole_timing_map 10
|
||||||
setWholeTimingTable(10 PASS_ENGINE_PARAMETER_SUFFIX);
|
setWholeTimingTable(10 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
// http://s1.micp.ru/tOb0U.png
|
// http://s1.micp.ru/tOb0U.png
|
||||||
setThermistorConfiguration(&engineConfiguration->clt, -15, 5900, 23, 1750, 97, 165);
|
setThermistorConfiguration(&engineConfiguration->clt, -15, 5900, 23, 1750, 97, 165);
|
||||||
|
|
|
@ -132,7 +132,7 @@ void setMiataNA_1_6_Configuration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
// Frankenso analog #7 pin 3J, W48 top <>W48 bottom jumper, not OEM
|
// Frankenso analog #7 pin 3J, W48 top <>W48 bottom jumper, not OEM
|
||||||
engineConfiguration->afr.hwChannel = EFI_ADC_3; // PA3
|
engineConfiguration->afr.hwChannel = EFI_ADC_3; // PA3
|
||||||
|
|
||||||
setWholeFuelMap(6 PASS_ENGINE_PARAMETER_SUFFIX);
|
setWholeFuelMap(6 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* http://miataturbo.wikidot.com/fuel-injectors
|
* http://miataturbo.wikidot.com/fuel-injectors
|
||||||
|
|
|
@ -75,7 +75,7 @@ void setMazdaMiataNb1EngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
boardConfiguration->clutchDownPin = GPIO_UNASSIGNED;
|
boardConfiguration->clutchDownPin = GPIO_UNASSIGNED;
|
||||||
|
|
||||||
// set_whole_fuel_map 3
|
// set_whole_fuel_map 3
|
||||||
setWholeFuelMap(3 PASS_ENGINE_PARAMETER_SUFFIX);
|
setWholeFuelMap(3 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
|
|
||||||
// 10 deg before TDC is default timing
|
// 10 deg before TDC is default timing
|
||||||
|
|
|
@ -38,7 +38,7 @@ void setMitsubishiConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
engineConfiguration->crankingTimingAngle = -715;
|
engineConfiguration->crankingTimingAngle = -715;
|
||||||
|
|
||||||
// set_whole_fuel_map 3
|
// set_whole_fuel_map 3
|
||||||
setWholeFuelMap(3 PASS_ENGINE_PARAMETER_SUFFIX);
|
setWholeFuelMap(3 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
// set cranking_fuel 4
|
// set cranking_fuel 4
|
||||||
engineConfiguration->cranking.baseFuel = 4;
|
engineConfiguration->cranking.baseFuel = 4;
|
||||||
|
|
|
@ -48,7 +48,7 @@ void setRoverv8(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
engineConfiguration->cranking.rpm = 350;
|
engineConfiguration->cranking.rpm = 350;
|
||||||
|
|
||||||
// set_whole_fuel_map 3
|
// set_whole_fuel_map 3
|
||||||
setWholeFuelMap(3 PASS_ENGINE_PARAMETER_SUFFIX);
|
setWholeFuelMap(3 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
// set cranking_injection_mode 0
|
// set cranking_injection_mode 0
|
||||||
engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS;
|
engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS;
|
||||||
|
|
|
@ -26,7 +26,7 @@ void setVwAba(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
engineConfiguration->isCylinderCleanupEnabled = true;
|
engineConfiguration->isCylinderCleanupEnabled = true;
|
||||||
|
|
||||||
// set_whole_fuel_map 12
|
// set_whole_fuel_map 12
|
||||||
setWholeFuelMap(12 PASS_ENGINE_PARAMETER_SUFFIX);
|
setWholeFuelMap(12 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
// set global_trigger_offset_angle 93
|
// set global_trigger_offset_angle 93
|
||||||
engineConfiguration->globalTriggerAngleOffset = 93;
|
engineConfiguration->globalTriggerAngleOffset = 93;
|
||||||
|
|
|
@ -228,11 +228,11 @@ void setMap(fuel_table_t table, float value) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setWholeVEMap(float value DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
static void setWholeVEMap(float value DECLARE_CONFIG_PARAMETER_SUFFIX) {
|
||||||
setMap(config->veTable, value);
|
setMap(config->veTable, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setWholeFuelMap(float value DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
void setWholeFuelMap(float value DECLARE_CONFIG_PARAMETER_SUFFIX) {
|
||||||
setMap(config->fuelTable, value);
|
setMap(config->fuelTable, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -708,7 +708,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
setLinearCurve(engineConfiguration->map.samplingWindow, MAP_ANGLE_SIZE, 50, 50, 1);
|
setLinearCurve(engineConfiguration->map.samplingWindow, MAP_ANGLE_SIZE, 50, 50, 1);
|
||||||
|
|
||||||
// set_whole_timing_map 3
|
// set_whole_timing_map 3
|
||||||
setWholeFuelMap(3 PASS_ENGINE_PARAMETER_SUFFIX);
|
setWholeFuelMap(3 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||||
setAfrMap(config->afrTable, 14.7);
|
setAfrMap(config->afrTable, 14.7);
|
||||||
|
|
||||||
setDefaultVETable(PASS_ENGINE_PARAMETER_SIGNATURE);
|
setDefaultVETable(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
@ -1121,13 +1121,13 @@ void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_EN
|
||||||
break;
|
break;
|
||||||
#if EFI_SUPPORT_DODGE_NEON || defined(__DOXYGEN__)
|
#if EFI_SUPPORT_DODGE_NEON || defined(__DOXYGEN__)
|
||||||
case DODGE_NEON_1995:
|
case DODGE_NEON_1995:
|
||||||
setDodgeNeon1995EngineConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
|
setDodgeNeon1995EngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||||
break;
|
break;
|
||||||
case DODGE_NEON_2003_CAM:
|
case DODGE_NEON_2003_CAM:
|
||||||
setDodgeNeonNGCEngineConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
|
setDodgeNeonNGCEngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||||
break;
|
break;
|
||||||
case DODGE_NEON_2003_CRANK:
|
case DODGE_NEON_2003_CRANK:
|
||||||
setDodgeNeonNGCEngineConfigurationCrankBased(PASS_ENGINE_PARAMETER_SIGNATURE);
|
setDodgeNeonNGCEngineConfigurationCrankBased(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||||
break;
|
break;
|
||||||
case LADA_KALINA:
|
case LADA_KALINA:
|
||||||
setLadaKalina(PASS_ENGINE_PARAMETER_SIGNATURE);
|
setLadaKalina(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
|
@ -55,7 +55,7 @@ void setAfrMap(afr_table_t table, float value);
|
||||||
* See also setLinearCurve()
|
* See also setLinearCurve()
|
||||||
*/
|
*/
|
||||||
void setMap(fuel_table_t table, float value);
|
void setMap(fuel_table_t table, float value);
|
||||||
void setWholeFuelMap(float value DECLARE_ENGINE_PARAMETER_SUFFIX);
|
void setWholeFuelMap(float value DECLARE_CONFIG_PARAMETER_SUFFIX);
|
||||||
void setWholeIgnitionIatCorr(float value DECLARE_ENGINE_PARAMETER_SUFFIX);
|
void setWholeIgnitionIatCorr(float value DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
void setFuelTablesLoadBin(float minValue, float maxValue DECLARE_ENGINE_PARAMETER_SUFFIX);
|
void setFuelTablesLoadBin(float minValue, float maxValue DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
void setWholeIatCorrTimingTable(float value DECLARE_ENGINE_PARAMETER_SUFFIX);
|
void setWholeIatCorrTimingTable(float value DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
|
@ -25,11 +25,14 @@
|
||||||
* On the other hand, in order to have a meaningful unit test we are passing Engine * engine as a parameter
|
* On the other hand, in order to have a meaningful unit test we are passing Engine * engine as a parameter
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define COMMON_EXTERN_ENGINE extern Engine *engine; \
|
#define EXTERN_CONFIG \
|
||||||
extern engine_configuration_s *engineConfiguration; \
|
extern engine_configuration_s *engineConfiguration; \
|
||||||
extern board_configuration_s *boardConfiguration; \
|
extern board_configuration_s *boardConfiguration; \
|
||||||
extern persistent_config_s *config; \
|
extern persistent_config_s *config;
|
||||||
|
|
||||||
|
#define COMMON_EXTERN_ENGINE extern Engine *engine; \
|
||||||
extern persistent_config_container_s persistentState; \
|
extern persistent_config_container_s persistentState; \
|
||||||
|
EXTERN_CONFIG \
|
||||||
extern engine_configuration_s activeConfiguration; \
|
extern engine_configuration_s activeConfiguration; \
|
||||||
extern EnginePins enginePins
|
extern EnginePins enginePins
|
||||||
|
|
||||||
|
@ -43,6 +46,12 @@
|
||||||
// Pass this after some other parameters are passed
|
// Pass this after some other parameters are passed
|
||||||
#define PASS_ENGINE_PARAMETER_SUFFIX
|
#define PASS_ENGINE_PARAMETER_SUFFIX
|
||||||
|
|
||||||
|
// these macro are used when we should not have visibiliy to 'engine'
|
||||||
|
#define DECLARE_CONFIG_PARAMETER_SIGNATURE void
|
||||||
|
#define DECLARE_CONFIG_PARAMETER_SUFFIX
|
||||||
|
#define PASS_CONFIG_PARAMETER_SIGNATURE
|
||||||
|
#define PASS_CONFIG_PARAMETER_SUFFIX
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this macro allows the compiled to figure out the complete static address, that's a performance
|
* this macro allows the compiled to figure out the complete static address, that's a performance
|
||||||
* optimization which is hopefully useful at least for anything trigger-related
|
* optimization which is hopefully useful at least for anything trigger-related
|
||||||
|
|
|
@ -630,7 +630,7 @@ static void setWholeFuelMapCmd(float value) {
|
||||||
if (engineConfiguration->fuelAlgorithm == LM_SPEED_DENSITY) {
|
if (engineConfiguration->fuelAlgorithm == LM_SPEED_DENSITY) {
|
||||||
scheduleMsg(&logger, "WARNING: setting fuel map in SD mode is pointless");
|
scheduleMsg(&logger, "WARNING: setting fuel map in SD mode is pointless");
|
||||||
}
|
}
|
||||||
setWholeFuelMap(value PASS_ENGINE_PARAMETER_SUFFIX);
|
setWholeFuelMap(value PASS_CONFIG_PARAMETER_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
|
|
|
@ -69,6 +69,10 @@ class Engine;
|
||||||
#define PASS_ENGINE_PARAMETER_SIGNATURE engine, engineConfiguration, config, boardConfiguration
|
#define PASS_ENGINE_PARAMETER_SIGNATURE engine, engineConfiguration, config, boardConfiguration
|
||||||
#define PASS_ENGINE_PARAMETER_SUFFIX , engine, engineConfiguration, config, boardConfiguration
|
#define PASS_ENGINE_PARAMETER_SUFFIX , engine, engineConfiguration, config, boardConfiguration
|
||||||
|
|
||||||
|
#define DECLARE_CONFIG_PARAMETER_SIGNATURE engine_configuration_s *engineConfiguration, persistent_config_s *config, board_configuration_s *boardConfiguration
|
||||||
|
#define DECLARE_CONFIG_PARAMETER_SUFFIX , engine_configuration_s *engineConfiguration, persistent_config_s *config, board_configuration_s *boardConfiguration
|
||||||
|
#define PASS_CONFIG_PARAMETER_SIGNATURE engineConfiguration, config, boardConfiguration
|
||||||
|
#define PASS_CONFIG_PARAMETER_SUFFIX , engineConfiguration, config, boardConfiguration
|
||||||
|
|
||||||
#define DEFINE_CONFIG_PARAM(x, y) , x y
|
#define DEFINE_CONFIG_PARAM(x, y) , x y
|
||||||
#define PASS_CONFIG_PARAM(x) , x
|
#define PASS_CONFIG_PARAM(x) , x
|
||||||
|
|
Loading…
Reference in New Issue