auto-sync

This commit is contained in:
rusEfi 2015-01-23 12:06:12 -06:00
parent 083790116d
commit dc2a3c0110
5 changed files with 103 additions and 44 deletions

View File

@ -99,25 +99,6 @@ typedef struct {
#define CRANKING_CURVE_SIZE 8 #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 #define HW_MAX_ADC_INDEX 16
typedef struct { typedef struct {
@ -559,21 +540,37 @@ typedef struct {
* offset 1020 * offset 1020
*/ */
int analogChartFrequency; int analogChartFrequency;
/**
* offset 1024
*/
trigger_config_s trigger; trigger_config_s trigger;
/**
* offset 1052
*/
spi_device_e hip9011SpiDevice; spi_device_e hip9011SpiDevice;
/**
* offset 1056
*/
adc_channel_e vbattAdcChannel; adc_channel_e vbattAdcChannel;
/**
// offset 1060 * offset 1060
*/
float globalFuelCorrection; 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; adc_channel_e cltAdcChannel;
/**
* offset 1068
*/
adc_channel_e iatAdcChannel; adc_channel_e iatAdcChannel;
/**
* offset 1072
*/
adc_channel_e mafAdcChannel; adc_channel_e mafAdcChannel;
/** /**
* @see hasAfrSensor * @see hasAfrSensor
*/ */

View File

@ -66,7 +66,6 @@ typedef struct {
/** total size 40*/ /** total size 40*/
} ThermistorConf; } ThermistorConf;
typedef struct { typedef struct {
/** /**
* kPa value at zero volts * kPa value at zero volts
@ -86,10 +85,10 @@ typedef struct {
* offset 12 * offset 12
*/ */
adc_channel_e hwChannel; adc_channel_e hwChannel;
/** total size 16*/ /** total size 16*/
} air_pressure_sensor_config_s; } air_pressure_sensor_config_s;
/** /**
* @brief MAP averaging configuration * @brief MAP averaging configuration
*/ */
@ -116,5 +115,42 @@ typedef struct {
* offset 128 * offset 128
*/ */
air_pressure_sensor_config_s sensor; air_pressure_sensor_config_s sensor;
/** total size 144*/ /** total size 144*/
} MAP_sensor_config_s; } 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;

View File

@ -173,8 +173,34 @@ log_format_e logFormat;
int analogChartFrequency; int analogChartFrequency;
struct trigger_config_s @brief Trigger wheel(s) configuration 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 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" !bits analog_chart_e S32 [0:1], "none", "trigger", "MAP", "INVALID"
!analog_chart_e analogChartMode; !analog_chart_e analogChartMode;

View File

@ -16,7 +16,7 @@ void testSpeedDensity(void) {
Engine *engine = &eth.engine; Engine *engine = &eth.engine;
engine_configuration_s *engineConfiguration = engine->engineConfiguration; engine_configuration_s *engineConfiguration = engine->engineConfiguration;
eth.ec->triggerConfig.customTotalToothCount = 8; eth.ec->trigger.customTotalToothCount = 8;
eth.initTriggerShapeAndRpmCalculator(); eth.initTriggerShapeAndRpmCalculator();
eth.fireTriggerEvents(); eth.fireTriggerEvents();

View File

@ -49,7 +49,7 @@ int getTheAngle(engine_type_e engineType) {
initDataStructures(PASS_ENGINE_PARAMETER_F); initDataStructures(PASS_ENGINE_PARAMETER_F);
TriggerShape * shape = &eth.engine.triggerShape; TriggerShape * shape = &eth.engine.triggerShape;
return findTriggerZeroEventIndex(shape, &engineConfiguration->triggerConfig PASS_ENGINE_PARAMETER); return findTriggerZeroEventIndex(shape, &engineConfiguration->trigger PASS_ENGINE_PARAMETER);
} }
static void testDodgeNeonDecoder(void) { static void testDodgeNeonDecoder(void) {
@ -402,7 +402,7 @@ static void testRpmCalculator(void) {
engine_configuration2_s *ec2 = &eth.ec2; engine_configuration2_s *ec2 = &eth.ec2;
engineConfiguration->triggerConfig.customTotalToothCount = 8; engineConfiguration->trigger.customTotalToothCount = 8;
engineConfiguration->globalFuelCorrection = 3; engineConfiguration->globalFuelCorrection = 3;
eth.initTriggerShapeAndRpmCalculator(); eth.initTriggerShapeAndRpmCalculator();