auto-sync

This commit is contained in:
rusEfi 2015-01-22 20:04:47 -06:00
parent f88f43d789
commit c3c9e7e687
13 changed files with 106 additions and 77 deletions

View File

@ -159,14 +159,14 @@ void setCitroenBerlingoTU3JPConfiguration(engine_configuration_s *engineConfigur
* IAT <OEM ECU>
*/
engineConfiguration->iatAdcChannel = EFI_ADC_13;
setThermistorConfiguration(&engineConfiguration->iatThermistorConf, -20.0, 15600.0, 23.0, 2250.0, 92.0, 240.0);
engineConfiguration->iatThermistorConf.bias_resistor = 2660;
setThermistorConfiguration(&engineConfiguration->iat, -20.0, 15600.0, 23.0, 2250.0, 92.0, 240.0);
engineConfiguration->iat.bias_resistor = 2660;
/**
* CLT <LADA Samara>
*/
engineConfiguration->cltAdcChannel = EFI_ADC_11;
setThermistorConfiguration(&engineConfiguration->cltThermistorConf, -20.0, 28680.0, 25.0, 2796.0, 100.0, 177.0);
engineConfiguration->cltThermistorConf.bias_resistor = 2660;
setThermistorConfiguration(&engineConfiguration->clt, -20.0, 28680.0, 25.0, 2796.0, 100.0, 177.0);
engineConfiguration->clt.bias_resistor = 2660;
/**
* vBatt
*/

View File

@ -175,8 +175,8 @@ void setDodgeNeon1995EngineConfiguration(engine_configuration_s *engineConfigura
// set_ignition_pin_mode 0
boardConfiguration->ignitionPinMode = OM_DEFAULT;
setThermistorConfiguration(&engineConfiguration->cltThermistorConf, 0, 32500, 30, 7550, 100, 700);
engineConfiguration->cltThermistorConf.bias_resistor = 2700;
setThermistorConfiguration(&engineConfiguration->clt, 0, 32500, 30, 7550, 100, 700);
engineConfiguration->clt.bias_resistor = 2700;
engineConfiguration->analogChartFrequency = 7;
}
@ -301,11 +301,11 @@ void setDodgeNeonNGCEngineConfiguration(engine_configuration_s *engineConfigurat
*/
setThermistorConfiguration(&engineConfiguration->cltThermistorConf, 0, 32500, 30, 7550, 100, 700);
engineConfiguration->cltThermistorConf.bias_resistor = 10000;
setThermistorConfiguration(&engineConfiguration->clt, 0, 32500, 30, 7550, 100, 700);
engineConfiguration->clt.bias_resistor = 10000;
setThermistorConfiguration(&engineConfiguration->iatThermistorConf, 0, 32500, 30, 7550, 100, 700);
engineConfiguration->iatThermistorConf.bias_resistor = 10000;
setThermistorConfiguration(&engineConfiguration->iat, 0, 32500, 30, 7550, 100, 700);
engineConfiguration->iat.bias_resistor = 10000;
/**
* MAP PA6

View File

@ -48,11 +48,11 @@ void setFordInline6(engine_configuration_s *engineConfiguration, board_configura
engineConfiguration->globalTriggerAngleOffset = 0;
engineConfiguration->ignitionBaseAngle = 13;
setThermistorConfiguration(&engineConfiguration->cltThermistorConf, -10.0, 160310.0, 60.0, 7700.0, 120.0, 1180.0);
engineConfiguration->cltThermistorConf.bias_resistor = 2700;
setThermistorConfiguration(&engineConfiguration->clt, -10.0, 160310.0, 60.0, 7700.0, 120.0, 1180.0);
engineConfiguration->clt.bias_resistor = 2700;
setThermistorConfiguration(&engineConfiguration->iatThermistorConf, -10.0, 160310.0, 60.0, 7700.0, 120.0, 1180.0);
engineConfiguration->iatThermistorConf.bias_resistor = 2700;
setThermistorConfiguration(&engineConfiguration->iat, -10.0, 160310.0, 60.0, 7700.0, 120.0, 1180.0);
engineConfiguration->iat.bias_resistor = 2700;
// 12ch analog board pinout:
// input channel 3 is PA7, that's ADC7

View File

@ -86,8 +86,8 @@ void setFordAspireEngineConfiguration(engine_configuration_s *engineConfiguratio
* 2.1K Ohm @ 24C
* 1K Ohm @ 49C
*/
setThermistorConfiguration(&engineConfiguration->cltThermistorConf, -20, 18000, 23.8889, 2100, 48.8889, 1000);
engineConfiguration->cltThermistorConf.bias_resistor = 3300; // that's my custom resistor value!
setThermistorConfiguration(&engineConfiguration->clt, -20, 18000, 23.8889, 2100, 48.8889, 1000);
engineConfiguration->clt.bias_resistor = 3300; // that's my custom resistor value!
engineConfiguration->cranking.baseFuel = 3;

View File

@ -56,11 +56,11 @@ static void setHondaAccordConfigurationCommon(engine_configuration_s *engineConf
* 2.1K Ohm @ 24C
* 100 Ohm @ 120C
*/
setCommonNTCSensor(&engineConfiguration->cltThermistorConf);
engineConfiguration->cltThermistorConf.bias_resistor = 1500; // same as OEM ECU
setCommonNTCSensor(&engineConfiguration->clt);
engineConfiguration->clt.bias_resistor = 1500; // same as OEM ECU
setCommonNTCSensor(&engineConfiguration->iatThermistorConf);
engineConfiguration->iatThermistorConf.bias_resistor = 1500; // same as OEM ECU
setCommonNTCSensor(&engineConfiguration->iat);
engineConfiguration->iat.bias_resistor = 1500; // same as OEM ECU
// set_cranking_charge_angle 35
engineConfiguration->crankingChargeAngle = 70;

View File

@ -152,10 +152,10 @@ static void commonMiataNa(engine_configuration_s *engineConfiguration, board_con
boardConfiguration->triggerSimulatorPinModes[0] = OM_OPENDRAIN;
boardConfiguration->triggerSimulatorPinModes[1] = OM_OPENDRAIN;
setCommonNTCSensor(&engineConfiguration->cltThermistorConf);
engineConfiguration->cltThermistorConf.bias_resistor = 2700;
setCommonNTCSensor(&engineConfiguration->iatThermistorConf);
engineConfiguration->iatThermistorConf.bias_resistor = 2700;
setCommonNTCSensor(&engineConfiguration->clt);
engineConfiguration->clt.bias_resistor = 2700;
setCommonNTCSensor(&engineConfiguration->iat);
engineConfiguration->iat.bias_resistor = 2700;
}

View File

@ -28,11 +28,11 @@ void setMazdaMiataNbEngineConfiguration(engine_configuration_s *engineConfigurat
// set_firing_order 2
engineConfiguration->firingOrder = FO_1_THEN_3_THEN_4_THEN2;
setThermistorConfiguration(&engineConfiguration->cltThermistorConf, 0, 32500, 30, 7550, 100, 700);
engineConfiguration->cltThermistorConf.bias_resistor = 2700;
setThermistorConfiguration(&engineConfiguration->clt, 0, 32500, 30, 7550, 100, 700);
engineConfiguration->clt.bias_resistor = 2700;
setThermistorConfiguration(&engineConfiguration->iatThermistorConf, -10, 160310, 60, 7700, 120.00, 1180);
engineConfiguration->iatThermistorConf.bias_resistor = 2700;
setThermistorConfiguration(&engineConfiguration->iat, -10, 160310, 60, 7700, 120.00, 1180);
engineConfiguration->iat.bias_resistor = 2700;
engineConfiguration->tpsAdcChannel = EFI_ADC_3; // 15 is the old value
engineConfiguration->vbattAdcChannel = EFI_ADC_0; // 1 is the old value

View File

@ -46,12 +46,12 @@ void setMitsubishiConfiguration(engine_configuration_s *engineConfiguration, boa
// * 10160 Ohm @ 70C
// * 1270 Ohm @ 150C
// */
// setThermistorConfiguration(&engineConfiguration->cltThermistorConf, 40, 29150, 70, 10160, 150, 1270);
// setThermistorConfiguration(&engineConfiguration->clt, 40, 29150, 70, 10160, 150, 1270);
setCommonNTCSensor(&engineConfiguration->cltThermistorConf);
setCommonNTCSensor(&engineConfiguration->clt);
engineConfiguration->cltThermistorConf.bias_resistor = 2700;
engineConfiguration->clt.bias_resistor = 2700;
// Frankenstein: low side - out #1: PC14
// Frankenstein: low side - out #2: PC15

View File

@ -190,12 +190,12 @@ void setDefaultConfiguration(engine_configuration_s *engineConfiguration, board_
setMap(engineConfiguration->afrTable, 14.7);
setMap(engineConfiguration->injectionPhase, 0);
setThermistorConfiguration(&engineConfiguration->cltThermistorConf, 0, 9500, 23.8889, 2100, 48.8889, 1000);
engineConfiguration->cltThermistorConf.bias_resistor = 1500;
setThermistorConfiguration(&engineConfiguration->clt, 0, 9500, 23.8889, 2100, 48.8889, 1000);
engineConfiguration->clt.bias_resistor = 1500;
setThermistorConfiguration(&engineConfiguration->iatThermistorConf, 32, 9500, 75, 2100, 120, 1000);
setThermistorConfiguration(&engineConfiguration->iat, 32, 9500, 75, 2100, 120, 1000);
// todo: this value is way off! I am pretty sure temp coeffs are off also
engineConfiguration->iatThermistorConf.bias_resistor = 2700;
engineConfiguration->iat.bias_resistor = 2700;
engineConfiguration->rpmHardLimit = 7000;
engineConfiguration->cranking.rpm = 550;

View File

@ -390,11 +390,11 @@ typedef struct {
* todo: merge with channel settings, use full-scale Thermistor here!
* offset 500
*/
ThermistorConf cltThermistorConf;
ThermistorConf clt;
/**
* offset 540
*/
ThermistorConf iatThermistorConf;
ThermistorConf iat;
/**
* offset 580
*/
@ -426,30 +426,45 @@ typedef struct {
* offset 780
*/
timing_mode_e timingMode;
/**
* This value is used in 'fixed timing' mode, i.e. constant timing
* This mode is useful for instance while adjusting distributor location
*/
* offset 784
*/
float fixedModeTiming;
/**
* offset 788
*/
float injectorLag;
/**
* offset 792
*/
float fuelLoadBins[FUEL_LOAD_COUNT];
// RPM is float and not integer in order to use unified methods for interpolation
float fuelRpmBins[FUEL_RPM_COUNT]; //
/**
* RPM is float and not integer in order to use unified methods for interpolation
* offset 856
*/
float fuelRpmBins[FUEL_RPM_COUNT];
/**
* Engine displacement, in liters
* see also cylindersCount
*/
* offset 920
*/
float displacement;
/**
* offset 924
*/
int rpmHardLimit;
/**
* offset 928
*/
injection_mode_e crankingInjectionMode;
/**
* offset 932
*/
injection_mode_e injectionMode;
/**
* Inside rusEfi all the angles are handled in relation to the trigger synchronization event
* which depends on the trigger shape and has nothing to do wit Top Dead Center (TDC)

View File

@ -185,9 +185,9 @@ void setCommonNTCSensor(ThermistorConf *thermistorConf) {
void initThermistors(Engine *engine) {
efiAssertVoid(engine!=NULL, "e NULL initThermistors");
efiAssertVoid(engine->engineConfiguration2!=NULL, "e2 NULL initThermistors");
initThermistorCurve(&engine->clt, &engine->engineConfiguration->cltThermistorConf,
initThermistorCurve(&engine->clt, &engine->engineConfiguration->clt,
engine->engineConfiguration->cltAdcChannel);
initThermistorCurve(&engine->iat, &engine->engineConfiguration->iatThermistorConf,
initThermistorCurve(&engine->iat, &engine->engineConfiguration->iat,
engine->engineConfiguration->iatAdcChannel);
initialized = true;
}

View File

@ -494,7 +494,7 @@ static void setGlobalFuelCorrection(float value) {
}
static void setCltBias(float value) {
engineConfiguration->cltThermistorConf.bias_resistor = value;
engineConfiguration->clt.bias_resistor = value;
}
static void setFanSetting(float onTempC, float offTempC) {
@ -507,7 +507,7 @@ static void setFanSetting(float onTempC, float offTempC) {
}
static void setIatBias(float value) {
engineConfiguration->iatThermistorConf.bias_resistor = value;
engineConfiguration->iat.bias_resistor = value;
}
static void setVBattDivider(float value) {

View File

@ -12,17 +12,21 @@
! needed to get a proper TunerStudio file
struct engine_configuration_s
#define FUEL_RPM_COUNT 16
#define FUEL_LOAD_COUNT 16
struct cranking_parameters_s
float baseCrankingFuel;
int16_t crankingRpm;This value controls what RPM values we consider 'cranking' (any RPM below 'crankingRpm')\nAnything above 'crankingRpm' would be 'running'
float baseFuel;;"ms", 1, 0, 0, 200, 1
int16_t rpm;This value controls what RPM values we consider 'cranking' (any RPM below 'crankingRpm')\nAnything above 'crankingRpm' would be 'running';"RPM", 1, 0, 0, 3000, 0
end_struct
bits air_pressure_sensor_type_e U32 [0:1] "Custom", "DENSO183", "MPX4250", "INVALID"
bits adc_channel_e U32 [0:3] "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PB0", "PB1", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5"
struct air_pressure_sensor_config_s
float customValueAt0;kPa value at zero volts
float customValueAt5;kPa value at 5 volts
air_pressure_sensor_type_e sensorType;
float valueAt0;kPa value at zero volts;"kpa", 1, 0, 0, 450, 2
float valueAt5;kPa value at 5 volts;"kpa", 1, 0, 0, 450, 2
air_pressure_sensor_type_e type;
adc_channel_e hwChannel;
end_struct
@ -31,22 +35,22 @@ end_struct
#define MAP_WINDOW_SIZE 8
struct MAP_sensor_config_s @brief MAP averaging configuration
float[MAP_ANGLE_SIZE] samplingAngleBins
float[MAP_ANGLE_SIZE] samplingAngle;@brief MAP averaging sampling start angle, by RPM
float[MAP_WINDOW_SIZE] samplingWindowBins;
float[MAP_WINDOW_SIZE] samplingWindow;@brief MAP averaging angle duration, by RPM
float[MAP_ANGLE_SIZE] samplingAngleBins;;"RPM", 1, 0, 0.0, 18000, 2
float[MAP_ANGLE_SIZE] samplingAngle;@brief MAP averaging sampling start angle, by RPM;"deg", 1, 0, 0.0, 90, 2
float[MAP_WINDOW_SIZE] samplingWindowBins;;"RPM", 1, 0, 0.0, 18000, 2
float[MAP_WINDOW_SIZE] samplingWindow;@brief MAP averaging angle duration, by RPM;"deg", 1, 0, 0.0, 90, 2
air_pressure_sensor_config_s sensor
end_struct
struct ThermistorConf @brief Thermistor curve parameters
float tempC_1;these values are in Celcuus
float tempC_2
float tempC_3
float resistance_1
float resistance_2
float resistance_3
float tempC_1;these values are in Celcuus;"*C", 1, 0, -40, 200, 1
float tempC_2;;"*C", 1, 0, -40, 200, 1
float tempC_3;;"*C", 1, 0, -40, 200, 1
float resistance_1;;"Ohm", 1, 0, 0, 200000, 1
float resistance_2;;"Ohm", 1, 0, 0, 200000, 1
float resistance_3;;"Ohm", 1, 0, 0, 200000, 1
float bias_resistor;
float bias_resistor;;"Ohm", 1, 0, 0, 200000, 1
float s_h_a;
float s_h_b;
@ -94,12 +98,12 @@ int16_t tpsErrorHighValue;;"*C", 1, 0, -40, 200, 1
float primingSquirtDurationMs;;"*C", 1, 0, -40, 200, 1
int engineCycle;360 for two-stroke\n720 for four-stroke;"engine cycle", 1, 0, 0, 1000, 0
cranking_parameters_s crankingSettings
cranking_parameters_s cranking
MAP_sensor_config_s map;@see hasMapSensor\n@see isMapAveragingEnabled
ThermistorConf cltThermistorConf;todo: merge with channel settings, use full-scale Thermistor here!
ThermistorConf iatThermistorConf;
ThermistorConf clt;todo: merge with channel settings, use full-scale Thermistor here!
ThermistorConf iat;
#define DWELL_COUNT 8
@ -109,26 +113,36 @@ ThermistorConf iatThermistorConf;
#define IGN_RPM_COUNT 16
float[DWELL_COUNT] sparkDwellBins;
float[DWELL_COUNT] sparkDwell;
float[DWELL_COUNT] sparkDwellBins;;"RPM", 1, 0.0, 0.0, 18000, 2
float[DWELL_COUNT] sparkDwell;;"ms", 1, 0.0, 0.0, 30.0, 2
float[IGN_LOAD_COUNT] ignitionLoadBins;
float[IGN_RPM_COUNT] ignitionRpmBins;
float[IGN_LOAD_COUNT] ignitionLoadBins;;"Load", 1, 0.0, 0, 300.0, 2
float[IGN_RPM_COUNT] ignitionRpmBins;;"RPM", 1, 0.0, 0, 18000.0, 2
float ignitionBaseAngle;this value could be used to offset the whole ignition timing table by a constant
float ignitionBaseAngle;this value could be used to offset the whole ignition timing table by a constant;"RPM", 1, 0, 0, 3000.0, 0
float crankingChargeAngle;While cranking (which causes battery voltage to drop) we can calculate dwell time in shaft\ndegrees, not in absolute time as in running mode.
float crankingChargeAngle;While cranking (which causes battery voltage to drop) we can calculate dwell time in shaft\ndegrees, not in absolute time as in running mode.;"deg", 1, 0, 0, 3000.0, 0
bits timing_mode_e U32 [0:0], "dynamic", "fixed"
timing_mode_e timingMode;
float fixedModeTiming;This value is used in 'fixed timing' mode, i.e. constant timing\nThis mode is useful for instance while adjusting distributor location;"RPM", 1, 0, 0, 3000.0, 0
float injectorLag;;"msec", 1, 0, -10, 25.50, 2
float[FUEL_LOAD_COUNT] fuelLoadBins;;"V", 1, 0, 0.0, 300.0, 2
float[FUEL_RPM_COUNT] fuelRpmBins;RPM is float and not integer in order to use unified methods for interpolation;"RPM", 1, 0, 0.0, 25500.0, 2
float displacement;Engine displacement, in liters\nsee also cylindersCount;"L", 1, 0, 0, 1000.0, 2
int rpmHardLimit;;"rpm", 1, 0, 0, 10000.0, 2
injection_mode_e crankingInjectionMode;
injection_mode_e injectionMode;
float globalTriggerAngleOffset;
bits analog_chart_e S32 [0:1], "none", "trigger", "MAP", "INVALID"
analog_chart_e analogChartMode;