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
/**
* @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
*/

View File

@ -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;

View File

@ -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;

View File

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

View File

@ -49,7 +49,7 @@ int getTheAngle(engine_type_e engineType) {
initDataStructures(PASS_ENGINE_PARAMETER_F);
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) {
@ -402,7 +402,7 @@ static void testRpmCalculator(void) {
engine_configuration2_s *ec2 = &eth.ec2;
engineConfiguration->triggerConfig.customTotalToothCount = 8;
engineConfiguration->trigger.customTotalToothCount = 8;
engineConfiguration->globalFuelCorrection = 3;
eth.initTriggerShapeAndRpmCalculator();