diff --git a/firmware/controllers/algo/engine_configuration.h b/firmware/controllers/algo/engine_configuration.h index 099434c9de..e149b29d83 100644 --- a/firmware/controllers/algo/engine_configuration.h +++ b/firmware/controllers/algo/engine_configuration.h @@ -99,25 +99,6 @@ typedef struct { #define CRANKING_CURVE_SIZE 8 -/** - * @brief Trigger wheel(s) configuration - */ -typedef struct { - trigger_type_e type; - - int customIsSynchronizationNeeded; - - int customTotalToothCount; - int customSkippedToothCount; - - float customSyncRatioFrom; - float customSyncRatioTo; - - int customUseRiseEdge; - -} trigger_config_s; - - #define HW_MAX_ADC_INDEX 16 typedef struct { @@ -559,21 +540,37 @@ typedef struct { * offset 1020 */ int analogChartFrequency; - - + /** + * offset 1024 + */ trigger_config_s trigger; - + /** + * offset 1052 + */ spi_device_e hip9011SpiDevice; + /** + * offset 1056 + */ adc_channel_e vbattAdcChannel; - - // offset 1060 + /** + * offset 1060 + */ float globalFuelCorrection; - - // todo: merge with channel settings, use full-scale Thermistor! + /** + * todo: merge with channel settings, use full-scale Thermistor! + * offset 1064 + */ adc_channel_e cltAdcChannel; + /** + * offset 1068 + */ adc_channel_e iatAdcChannel; + /** + * offset 1072 + */ adc_channel_e mafAdcChannel; + /** * @see hasAfrSensor */ diff --git a/firmware/controllers/algo/engine_configuration_generated_structures.h b/firmware/controllers/algo/engine_configuration_generated_structures.h index a0326929f2..9d3bb5821e 100644 --- a/firmware/controllers/algo/engine_configuration_generated_structures.h +++ b/firmware/controllers/algo/engine_configuration_generated_structures.h @@ -66,55 +66,91 @@ typedef struct { /** total size 40*/ } ThermistorConf; - typedef struct { /** * kPa value at zero volts * offset 0 - */ + */ float valueAt0; /** * kPa value at 5 volts * offset 4 - */ + */ float valueAt5; /** * offset 8 - */ + */ air_pressure_sensor_type_e type; /** * offset 12 - */ + */ adc_channel_e hwChannel; -/** total size 16*/ + /** total size 16*/ } air_pressure_sensor_config_s; - /** - * @brief MAP averaging configuration +/** + * @brief MAP averaging configuration - */ + */ typedef struct { /** * offset 0 - */ + */ float samplingAngleBins[MAP_ANGLE_SIZE]; /** * @brief MAP averaging sampling start angle, by RPM * offset 32 - */ + */ float samplingAngle[MAP_ANGLE_SIZE]; /** * offset 64 - */ + */ float samplingWindowBins[MAP_WINDOW_SIZE]; /** * @brief MAP averaging angle duration, by RPM * offset 96 - */ + */ float samplingWindow[MAP_WINDOW_SIZE]; /** * offset 128 - */ + */ air_pressure_sensor_config_s sensor; -/** total size 144*/ + /** total size 144*/ } MAP_sensor_config_s; + +/** + * @brief Trigger wheel(s) configuration + + */ +typedef struct { + /** + * offset 0 + */ + trigger_type_e type; + /** + * offset 4 + */ + int customIsSynchronizationNeeded; + /** + * offset 8 + */ + int customTotalToothCount; + /** + * offset 12 + */ + int customSkippedToothCount; + /** + * offset 16 + */ + float customSyncRatioFrom; + /** + * offset 20 + */ + float customSyncRatioTo; + /** + * offset 24 + */ + int customUseRiseEdge; + /** total size 28*/ +} trigger_config_s; + diff --git a/firmware/rusefi_config.ini b/firmware/rusefi_config.ini index 017cf1bf04..b72ce22fda 100644 --- a/firmware/rusefi_config.ini +++ b/firmware/rusefi_config.ini @@ -173,8 +173,34 @@ log_format_e logFormat; int analogChartFrequency; struct trigger_config_s @brief Trigger wheel(s) configuration + trigger_type_e type; + + int customIsSynchronizationNeeded; + + int customTotalToothCount; + int customSkippedToothCount; + + float customSyncRatioFrom; + float customSyncRatioTo; + + int customUseRiseEdge; end_struct +trigger_config_s trigger; + +!bits spi_device_e + spi_device_e hip9011SpiDevice; + adc_channel_e vbattAdcChannel; + + +float globalFuelCorrection; + + + adc_channel_e cltAdcChannel;todo: merge with channel settings, use full-scale Thermistor! + adc_channel_e iatAdcChannel; + adc_channel_e mafAdcChannel; + + !bits analog_chart_e S32 [0:1], "none", "trigger", "MAP", "INVALID" !analog_chart_e analogChartMode; diff --git a/unit_tests/test_speed_density.cpp b/unit_tests/test_speed_density.cpp index f0703c4b47..d5fb1f9332 100644 --- a/unit_tests/test_speed_density.cpp +++ b/unit_tests/test_speed_density.cpp @@ -16,7 +16,7 @@ void testSpeedDensity(void) { Engine *engine = ð.engine; engine_configuration_s *engineConfiguration = engine->engineConfiguration; - eth.ec->triggerConfig.customTotalToothCount = 8; + eth.ec->trigger.customTotalToothCount = 8; eth.initTriggerShapeAndRpmCalculator(); eth.fireTriggerEvents(); diff --git a/unit_tests/test_trigger_decoder.cpp b/unit_tests/test_trigger_decoder.cpp index ecdcc20077..9701bbc81a 100644 --- a/unit_tests/test_trigger_decoder.cpp +++ b/unit_tests/test_trigger_decoder.cpp @@ -49,7 +49,7 @@ int getTheAngle(engine_type_e engineType) { initDataStructures(PASS_ENGINE_PARAMETER_F); TriggerShape * shape = ð.engine.triggerShape; - return findTriggerZeroEventIndex(shape, &engineConfiguration->triggerConfig PASS_ENGINE_PARAMETER); + return findTriggerZeroEventIndex(shape, &engineConfiguration->trigger PASS_ENGINE_PARAMETER); } static void testDodgeNeonDecoder(void) { @@ -402,7 +402,7 @@ static void testRpmCalculator(void) { engine_configuration2_s *ec2 = ð.ec2; - engineConfiguration->triggerConfig.customTotalToothCount = 8; + engineConfiguration->trigger.customTotalToothCount = 8; engineConfiguration->globalFuelCorrection = 3; eth.initTriggerShapeAndRpmCalculator();