auto-sync

This commit is contained in:
rusEfi 2015-04-05 16:04:54 -05:00
parent 6e92407341
commit f5d5552f10
21 changed files with 398 additions and 400 deletions

View File

@ -212,7 +212,7 @@ void setCitroenBerlingoTU3JPConfiguration(DECLARE_ENGINE_PARAMETER_F) {
*/
// engineConfiguration->mafAdcChannel = GPIO_UNASSIGNED;
copyFuelTable(tps_fuel_table, engineConfiguration->fuelTable);
copyTimingTable(tps_advance_table, engineConfiguration->ignitionTable);
copyFuelTable(tps_fuel_table, config->fuelTable);
copyTimingTable(tps_advance_table, config->ignitionTable);
}

View File

@ -217,9 +217,9 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
* set_whole_fuel_map 12
*/
//setWholeFuelMap(12 PASS_ENGINE_PARAMETER);
copyFuelTable(alphaNfuel, engineConfiguration->fuelTable);
copyFuelTable(alphaNfuel, config->fuelTable);
//setWholeTimingTable(12 PASS_ENGINE_PARAMETER);
copyTimingTable(fromDyno, engineConfiguration->ignitionTable);
copyTimingTable(fromDyno, config->ignitionTable);
// set_cranking_charge_angle 70
engineConfiguration->crankingChargeAngle = 70;

View File

@ -74,8 +74,8 @@ static void setDefaultAspireMaps(DECLARE_ENGINE_PARAMETER_F) {
setTimingLoadBin(1.2, 4.4 PASS_ENGINE_PARAMETER);
setTimingRpmBin(800, 7000 PASS_ENGINE_PARAMETER);
copyFuelTable(default_aspire_fuel_table, engineConfiguration->fuelTable);
copyTimingTable(default_aspire_timing_table, engineConfiguration->ignitionTable);
copyFuelTable(default_aspire_fuel_table, config->fuelTable);
copyTimingTable(default_aspire_timing_table, config->ignitionTable);
}
void setFordAspireEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {

View File

@ -372,9 +372,9 @@ static void setMiata1994_common(DECLARE_ENGINE_PARAMETER_F) {
engineConfiguration->crankingChargeAngle = 70;
copyFuelTable(miata_maf_fuel_table, engineConfiguration->fuelTable);
copyFuelTable(miata_maf_fuel_table, config->fuelTable);
copyTimingTable(miata_maf_advance_table, engineConfiguration->ignitionTable);
copyTimingTable(miata_maf_advance_table, config->ignitionTable);
// boardConfiguration->triggerSimulatorPins[0] = GPIOD_2; // 2G - YEL/BLU
// boardConfiguration->triggerSimulatorPins[1] = GPIOB_3; // 2E - WHT - four times
@ -505,8 +505,8 @@ void setMiata1996(DECLARE_ENGINE_PARAMETER_F) {
commonMiataNa(PASS_ENGINE_PARAMETER_F);
engineConfiguration->specs.displacement = 1.839;
copyFuelTable(miata_maf_fuel_table, engineConfiguration->fuelTable);
copyTimingTable(miata_maf_advance_table, engineConfiguration->ignitionTable);
copyFuelTable(miata_maf_fuel_table, config->fuelTable);
copyTimingTable(miata_maf_advance_table, config->ignitionTable);
// upside down
boardConfiguration->triggerInputPins[0] = GPIOA_5;

View File

@ -58,6 +58,6 @@ float getAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_S) {
}
void prepareTimingMap(DECLARE_ENGINE_PARAMETER_F) {
advanceMap.init(engineConfiguration->ignitionTable, engineConfiguration->ignitionLoadBins,
engineConfiguration->ignitionRpmBins);
advanceMap.init(config->ignitionTable, config->ignitionLoadBins,
config->ignitionRpmBins);
}

View File

@ -67,6 +67,7 @@ Engine::Engine(persistent_config_s *config) {
engineConfiguration2 = NULL;
engineState.iat = engineState.clt = NAN;
memset(&ignitionPin, 0, sizeof(ignitionPin));
memset(config, 0, sizeof(persistent_config_s));
knockNow = false;
knockEver = false;

View File

@ -113,24 +113,24 @@ void setMap(fuel_table_t table, float value) {
}
static void setWholeVEMap(float value DECLARE_ENGINE_PARAMETER_S) {
setMap(engineConfiguration->veTable, value);
setMap(config->veTable, value);
}
void setWholeFuelMap(float value DECLARE_ENGINE_PARAMETER_S) {
setMap(engineConfiguration->fuelTable, value);
setMap(config->fuelTable, value);
}
void setFuelTablesLoadBin(float minValue, float maxValue DECLARE_ENGINE_PARAMETER_S) {
setTableBin2(config->injPhaseLoadBins, FUEL_LOAD_COUNT, minValue, maxValue, 1);
setTableBin2(engineConfiguration->veLoadBins, FUEL_LOAD_COUNT, minValue, maxValue, 1);
setTableBin2(engineConfiguration->afrLoadBins, FUEL_LOAD_COUNT, minValue, maxValue, 1);
setTableBin2(config->veLoadBins, FUEL_LOAD_COUNT, minValue, maxValue, 1);
setTableBin2(config->afrLoadBins, FUEL_LOAD_COUNT, minValue, maxValue, 1);
}
void setWholeTimingTable(float value DECLARE_ENGINE_PARAMETER_S) {
// todo: table helper?
for (int l = 0; l < IGN_LOAD_COUNT; l++) {
for (int r = 0; r < IGN_RPM_COUNT; r++) {
engineConfiguration->ignitionTable[l][r] = value;
config->ignitionTable[l][r] = value;
}
}
}
@ -164,8 +164,8 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
engineConfiguration->acCutoffLowRpm = 700;
engineConfiguration->acCutoffHighRpm = 5000;
initTemperatureCurve(IAT_CURVE_SIZE, engineConfiguration->iatFuelCorrBins, engineConfiguration->iatFuelCorr);
initTemperatureCurve(CLT_CURVE_SIZE, engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr);
initTemperatureCurve(IAT_CURVE_SIZE, config->iatFuelCorrBins, config->iatFuelCorr);
initTemperatureCurve(CLT_CURVE_SIZE, config->cltFuelCorrBins, config->cltFuelCorr);
initTemperatureCurve(IAT_CURVE_SIZE, config->iatIdleCorrBins, config->iatIdleCorr);
// initTemperatureCurve(CLT_CURVE_SIZE, engineConfiguration->cltIdleCorrBins, engineConfiguration->cltIdleCorr);
@ -185,18 +185,18 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
setTableValue(config->iatIdleCorrBins, config->iatIdleCorr, CLT_CURVE_SIZE, 70, 1.01);
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, -40, 1.5);
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, -30, 1.5);
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, -20, 1.42);
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, -10, 1.36);
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, 0, 1.28);
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, 10, 1.19);
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, 20, 1.12);
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, 30, 1.10);
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, 40, 1.06);
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, 50, 1.06);
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, 60, 1.03);
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, 70, 1.01);
setTableValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, -40, 1.5);
setTableValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, -30, 1.5);
setTableValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, -20, 1.42);
setTableValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, -10, 1.36);
setTableValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, 0, 1.28);
setTableValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, 10, 1.19);
setTableValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, 20, 1.12);
setTableValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, 30, 1.10);
setTableValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, 40, 1.06);
setTableValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, 50, 1.06);
setTableValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, 60, 1.03);
setTableValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, 70, 1.01);
for (int i = 0; i < VBAT_INJECTOR_CURVE_SIZE; i++) {
engineConfiguration->injector.battLagCorrBins[i] = 12 - VBAT_INJECTOR_CURVE_SIZE / 2 + i;
@ -218,7 +218,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
// set_whole_timing_map 3
setWholeFuelMap(3 PASS_ENGINE_PARAMETER);
setMap(engineConfiguration->afrTable, 14.7);
setMap(config->afrTable, 14.7);
setDefaultVETable(PASS_ENGINE_PARAMETER_F);
@ -236,39 +236,39 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
engineConfiguration->rpmHardLimit = 7000;
engineConfiguration->cranking.rpm = 550;
engineConfiguration->crankingFuelCoef[0] = 5; // base cranking fuel adjustment coefficient
engineConfiguration->crankingFuelBins[0] = -20; // temperature in C
engineConfiguration->crankingFuelCoef[1] = 3.7;
engineConfiguration->crankingFuelBins[1] = -10;
engineConfiguration->crankingFuelCoef[2] = 2.6;
engineConfiguration->crankingFuelBins[2] = 5;
engineConfiguration->crankingFuelCoef[3] = 2.4;
engineConfiguration->crankingFuelBins[3] = 20;
engineConfiguration->crankingFuelCoef[4] = 2.1;
engineConfiguration->crankingFuelBins[4] = 35;
engineConfiguration->crankingFuelCoef[5] = 1.8;
engineConfiguration->crankingFuelBins[5] = 50;
engineConfiguration->crankingFuelCoef[6] = 1.5;
engineConfiguration->crankingFuelBins[6] = 65;
engineConfiguration->crankingFuelCoef[7] = 1;
engineConfiguration->crankingFuelBins[7] = 90;
config->crankingFuelCoef[0] = 5; // base cranking fuel adjustment coefficient
config->crankingFuelBins[0] = -20; // temperature in C
config->crankingFuelCoef[1] = 3.7;
config->crankingFuelBins[1] = -10;
config->crankingFuelCoef[2] = 2.6;
config->crankingFuelBins[2] = 5;
config->crankingFuelCoef[3] = 2.4;
config->crankingFuelBins[3] = 20;
config->crankingFuelCoef[4] = 2.1;
config->crankingFuelBins[4] = 35;
config->crankingFuelCoef[5] = 1.8;
config->crankingFuelBins[5] = 50;
config->crankingFuelCoef[6] = 1.5;
config->crankingFuelBins[6] = 65;
config->crankingFuelCoef[7] = 1;
config->crankingFuelBins[7] = 90;
engineConfiguration->crankingCycleCoef[0] = 2;
engineConfiguration->crankingCycleBins[0] = 10;
engineConfiguration->crankingCycleCoef[1] = 1;
engineConfiguration->crankingCycleBins[1] = 31;
engineConfiguration->crankingCycleCoef[2] = 1;
engineConfiguration->crankingCycleBins[2] = 52;
engineConfiguration->crankingCycleCoef[3] = 0.5;
engineConfiguration->crankingCycleBins[3] = 73;
engineConfiguration->crankingCycleCoef[4] = 0.5;
engineConfiguration->crankingCycleBins[4] = 74;
engineConfiguration->crankingCycleCoef[5] = 0.5;
engineConfiguration->crankingCycleBins[5] = 75;
engineConfiguration->crankingCycleCoef[6] = 0.5;
engineConfiguration->crankingCycleBins[6] = 76;
engineConfiguration->crankingCycleCoef[7] = 0.5;
engineConfiguration->crankingCycleBins[7] = 77;
config->crankingCycleCoef[0] = 2;
config->crankingCycleBins[0] = 10;
config->crankingCycleCoef[1] = 1;
config->crankingCycleBins[1] = 31;
config->crankingCycleCoef[2] = 1;
config->crankingCycleBins[2] = 52;
config->crankingCycleCoef[3] = 0.5;
config->crankingCycleBins[3] = 73;
config->crankingCycleCoef[4] = 0.5;
config->crankingCycleBins[4] = 74;
config->crankingCycleCoef[5] = 0.5;
config->crankingCycleBins[5] = 75;
config->crankingCycleCoef[6] = 0.5;
config->crankingCycleBins[6] = 76;
config->crankingCycleCoef[7] = 0.5;
config->crankingCycleBins[7] = 77;
engineConfiguration->cranking.baseFuel = 5;
@ -424,7 +424,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
}
for (int i = 0; i < LE_COMMAND_COUNT; i++) {
boardConfiguration->fsioPins[i] = GPIO_UNASSIGNED;
engineConfiguration->le_formulas[i][0] = 0;
config->le_formulas[i][0] = 0;
boardConfiguration->fsioInputs[i] = GPIO_UNASSIGNED;
engineConfiguration->fsioInputModes[i] = PI_DEFAULT;
}
@ -491,8 +491,8 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
setFrankenstein_01_LCD(boardConfiguration);
strcpy(engineConfiguration->timingMultiplier, "1");
strcpy(engineConfiguration->timingAdditive, "0");
strcpy(config->timingMultiplier, "1");
strcpy(config->timingAdditive, "0");
engineConfiguration->hip9011SpiDevice = SPI_DEVICE_2;

View File

@ -1,4 +1,4 @@
// this section was generated by config_definition.jar on Sun Apr 05 10:16:43 EDT 2015
// this section was generated by config_definition.jar on Sun Apr 05 16:35:24 EDT 2015
// begin
#include "rusefi_types.h"
typedef struct {
@ -648,556 +648,463 @@ typedef struct {
* offset 8
*/
injector_s injector;
/**
* offset 80
*/
float cltFuelCorrBins[CLT_CURVE_SIZE];
/**
* offset 144
*/
float cltFuelCorr[CLT_CURVE_SIZE];
/**
* offset 208
*/
float iatFuelCorrBins[IAT_CURVE_SIZE];
/**
* offset 272
*/
float iatFuelCorr[IAT_CURVE_SIZE];
/**
* Should the trigger emulator push data right into trigger input, eliminating the need for physical jumper wires?
* PS: Funny name, right? :)
* todo: make this a bit on some bit field
* offset 336
* offset 80
*/
int16_t directSelfStimulation;
/**
* todo: extract these two fields into a structure
* todo: we need two sets of TPS parameters - modern ETBs have two sensors
* offset 338
* offset 82
*/
int16_t tpsMin;
/**
* tpsMax value as 10 bit ADC value. Not Voltage!
* offset 340
* offset 84
*/
int16_t tpsMax;
/**
* offset 342
* offset 86
*/
uint16_t unused334;
/**
* todo: finish implementation. These values are used for TPS disconnect detection
* offset 344
* offset 88
*/
int16_t tpsErrorLowValue;
/**
* offset 346
* offset 90
*/
int16_t tpsErrorHighValue;
/**
* offset 348
* offset 92
*/
float primingSquirtDurationMs;
/**
* 360 for two-stroke
* 720 for four-stroke
* offset 352
* offset 96
*/
int engineCycle;
/**
* offset 356
* offset 100
*/
cranking_parameters_s cranking;
/**
* @see hasMapSensor
* @see isMapAveragingEnabled
* offset 364
* offset 108
*/
MAP_sensor_config_s map;
/**
* todo: merge with channel settings, use full-scale Thermistor here!
* offset 508
* offset 252
*/
ThermistorConf clt;
/**
* offset 548
* offset 292
*/
ThermistorConf iat;
/**
* offset 588
* offset 332
*/
float sparkDwellBins[DWELL_COUNT];
/**
* offset 620
* offset 364
*/
float sparkDwell[DWELL_COUNT];
/**
* this value could be used to offset the whole ignition timing table by a constant
* offset 652
* offset 396
*/
float ignitionBaseAngle;
/**
* While cranking (which causes battery voltage to drop) we can calculate dwell time in shaft
* degrees, not in absolute time as in running mode.
* offset 656
* offset 400
*/
float crankingChargeAngle;
/**
* offset 660
* offset 404
*/
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 664
* offset 408
*/
float fixedModeTiming;
/**
* offset 668
* offset 412
*/
specs_s specs;
/**
* offset 680
* offset 424
*/
int rpmHardLimit;
/**
* offset 684
* offset 428
*/
injection_mode_e crankingInjectionMode;
/**
* offset 688
* offset 432
*/
injection_mode_e injectionMode;
/**
* This field is the angle between Top Dead Center (TDC) and the first trigger event.
* Knowing this angle allows us to control timing and other angles in reference to TDC.
* offset 692
* offset 436
*/
float globalTriggerAngleOffset;
/**
* This parameter holds the coefficient of input voltage dividers
* offset 696
* offset 440
*/
float analogInputDividerCoefficient;
/**
* This setting controls which algorithm is used for ENGINE LOAD
* offset 700
* offset 444
*/
engine_load_mode_e algorithm;
/**
* offset 704
* offset 448
*/
float vbattDividerCoeff;
/**
* Cooling fan turn-on temperature threshold, in Celsuis
* offset 708
* offset 452
*/
float fanOnTemperature;
/**
* Cooling fan turn-off temperature threshold, in Celsuis
* offset 712
* offset 456
*/
float fanOffTemperature;
/**
* offset 716
* offset 460
*/
int ususedBla;
/**
* This coefficient translates vehicle speed input frequency (in Hz) into vehicle speed, km/h
* offset 720
* offset 464
*/
float vehicleSpeedCoef;
/**
* offset 724
* offset 468
*/
can_nbc_e canNbcType;
/**
* offset 728
* offset 472
*/
int canSleepPeriod;
/**
* offset 732
* offset 476
*/
ignition_mode_e ignitionMode;
/**
* offset 736
* offset 480
*/
operation_mode_e operationMode;
/**
* offset 740
* offset 484
*/
display_mode_e displayMode;
/**
* offset 744
* offset 488
*/
log_format_e logFormat;
/**
* offset 748
* offset 492
*/
int firmwareVersion;
/**
* offset 752
* offset 496
*/
int HD44780width;
/**
* offset 756
* offset 500
*/
int HD44780height;
/**
* offset 760
* offset 504
*/
adc_channel_e tpsAdcChannel;
/**
* offset 764
* offset 508
*/
int overrideCrankingIgnition;
/**
* offset 768
* offset 512
*/
int analogChartFrequency;
/**
* offset 772
* offset 516
*/
trigger_config_s trigger;
/**
* offset 800
* offset 544
*/
spi_device_e hip9011SpiDevice;
/**
* offset 804
* offset 548
*/
adc_channel_e vbattAdcChannel;
/**
* offset 808
* offset 552
*/
float globalFuelCorrection;
/**
* todo: merge with channel settings, use full-scale Thermistor!
* offset 812
* offset 556
*/
adc_channel_e cltAdcChannel;
/**
* offset 816
* offset 560
*/
adc_channel_e iatAdcChannel;
/**
* offset 820
* offset 564
*/
adc_channel_e mafAdcChannel;
/**
* @see hasAfrSensor
* offset 824
* offset 568
*/
afr_sensor_s afr;
/**
* this is about deciding when the injector starts it's squirt
* offset 844
* offset 588
*/
float injectionAngle;
/**
* offset 848
* offset 592
*/
float crankingTimingAngle;
/**
* offset 852
* offset 596
*/
float diffLoadEnrichmentCoef;
/**
* @see hasBaroSensor
* offset 856
* offset 600
*/
air_pressure_sensor_config_s baroSensor;
/**
* offset 872
* offset 616
*/
board_configuration_s bc;
/**
* offset 1744
*/
le_formula_t le_formulas[LE_COMMAND_COUNT];
/**
* @see isMapAveragingEnabled
offset 4944 bit 0 */
offset 1488 bit 0 */
bool_t hasMapSensor : 1;
/**
offset 4944 bit 1 */
offset 1488 bit 1 */
bool_t hasIatSensor : 1;
/**
offset 4944 bit 2 */
offset 1488 bit 2 */
bool_t hasBaroSensor : 1;
/**
offset 4944 bit 3 */
offset 1488 bit 3 */
bool_t hasAfrSensor : 1;
/**
offset 4944 bit 4 */
offset 1488 bit 4 */
bool_t useConstantDwellDuringCranking : 1;
/**
offset 4944 bit 5 */
offset 1488 bit 5 */
bool_t isDigitalChartEnabled : 1;
/**
offset 4944 bit 6 */
offset 1488 bit 6 */
bool_t isCanEnabled : 1;
/**
offset 4944 bit 7 */
offset 1488 bit 7 */
bool_t hasCltSensor : 1;
/**
offset 4944 bit 8 */
offset 1488 bit 8 */
bool_t canReadEnabled : 1;
/**
offset 4944 bit 9 */
offset 1488 bit 9 */
bool_t canWriteEnabled : 1;
/**
offset 4944 bit 10 */
offset 1488 bit 10 */
bool_t hasVehicleSpeedSensor : 1;
/**
offset 4944 bit 11 */
offset 1488 bit 11 */
bool_t isJoystickEnabled : 1;
/**
offset 4944 bit 12 */
offset 1488 bit 12 */
bool_t isGpsEnabled : 1;
/**
offset 4944 bit 13 */
offset 1488 bit 13 */
bool_t isAlternatorControlEnabled : 1;
/**
offset 4944 bit 14 */
offset 1488 bit 14 */
bool_t hasMafSensor : 1;
/**
offset 4944 bit 15 */
offset 1488 bit 15 */
bool_t hasTpsSensor : 1;
/**
* offset 4948
* offset 1492
*/
adc_channel_e hipOutputChannel;
/**
* offset 4952
* offset 1496
*/
idle_mode_e idleMode;
/**
offset 4956 bit 0 */
offset 1500 bit 0 */
bool_t isInjectionEnabled : 1;
/**
offset 4956 bit 1 */
offset 1500 bit 1 */
bool_t isIgnitionEnabled : 1;
/**
offset 4956 bit 2 */
offset 1500 bit 2 */
bool_t isCylinderCleanupEnabled : 1;
/**
offset 4956 bit 3 */
offset 1500 bit 3 */
bool_t secondTriggerChannelEnabled : 1;
/**
offset 4956 bit 4 */
offset 1500 bit 4 */
bool_t needSecondTriggerInputDeprecated : 1;
/**
offset 4956 bit 5 */
offset 1500 bit 5 */
bool_t isMapAveragingEnabled : 1;
/**
offset 4956 bit 6 */
offset 1500 bit 6 */
bool_t isMilEnabled : 1;
/**
offset 4956 bit 7 */
offset 1500 bit 7 */
bool_t isFuelPumpEnabled : 1;
/**
offset 4956 bit 8 */
offset 1500 bit 8 */
bool_t isTunerStudioEnabled : 1;
/**
offset 4956 bit 9 */
offset 1500 bit 9 */
bool_t isWaveAnalyzerEnabled : 1;
/**
offset 4956 bit 10 */
offset 1500 bit 10 */
bool_t isIdleThreadEnabled : 1;
/**
offset 4956 bit 11 */
offset 1500 bit 11 */
bool_t isPrintTriggerSynchDetails : 1;
/**
* Usually if we have no trigger events that means engine is stopped
* Unless we are troubleshooting and spinning the engine by hand - this case a longer
* delay is needed
offset 4956 bit 12 */
offset 1500 bit 12 */
bool_t isManualSpinningMode : 1;
/**
offset 4956 bit 13 */
offset 1500 bit 13 */
bool_t twoWireBatch : 1;
/**
* offset 4960
* offset 1504
*/
uint32_t digitalChartSize;
/**
* offset 4964
*/
float crankingFuelCoef[CRANKING_CURVE_SIZE];
/**
* offset 4996
*/
float crankingFuelBins[CRANKING_CURVE_SIZE];
/**
* offset 5028
*/
float crankingCycleCoef[CRANKING_CURVE_SIZE];
/**
* offset 5060
*/
float crankingCycleBins[CRANKING_CURVE_SIZE];
/**
* offset 5092
* offset 1508
*/
float ignitionDwellForCrankingMs;
/**
* offset 5096
* offset 1512
*/
int targetIdleRpm;
/**
* A/C button input handled as analog input
* offset 5100
* offset 1516
*/
adc_channel_e acSwitchAdc;
/**
* offset 5104
* offset 1520
*/
int ignMathCalculateAtIndex;
/**
* offset 5108
* offset 1524
*/
int16_t acCutoffLowRpm;
/**
* offset 5110
* offset 1526
*/
int16_t acCutoffHighRpm;
/**
* offset 5112
* offset 1528
*/
int16_t acIdleRpmBump;
/**
* offset 5114
* offset 1530
*/
int16_t unusedShort;
/**
* offset 5116
* offset 1532
*/
adc_channel_e vRefAdcChannel;
/**
* offset 5120
* offset 1536
*/
float knockDetectionWindowStart;
/**
* offset 5124
* offset 1540
*/
float knockDetectionWindowEnd;
/**
* Cylinder diameter, in mm.
* offset 5128
* offset 1544
*/
float cylinderBore;
/**
* offset 5132
* offset 1548
*/
int unusedCP;
/**
* offset 5136
* offset 1552
*/
float hipThreshold;
/**
* offset 5140
* offset 1556
*/
pin_input_mode_e fsioInputModes[LE_COMMAND_COUNT];
/**
* offset 5204
* offset 1620
*/
adc_channel_e externalKnockSenseAdc;
/**
* offset 5208
* offset 1624
*/
float alternatorControlPFactor;
/**
* offset 5212
* offset 1628
*/
float alternatorControlIFactor;
/**
* offset 5216
* offset 1632
*/
float alternatorControlDFactor;
/**
* offset 5220
* offset 1636
*/
int unused3[140];
/**
* offset 5780
* offset 2196
*/
int accelLength;
/**
* offset 5784
* offset 2200
*/
float decelEnrichmentThreshold;
/**
* offset 5788
* offset 2204
*/
float decelEnrichmentMultiplier;
/**
* offset 5792
* offset 2208
*/
float accelEnrichmentThreshold;
/**
* offset 5796
* offset 2212
*/
float accelEnrichmentMultiplier;
/**
* offset 5800
*/
le_formula_t timingMultiplier;
/**
* offset 6000
*/
le_formula_t timingAdditive;
/**
* offset 6200
*/
fuel_table_t fuelTable;
/**
* offset 7224
*/
float fuelLoadBins[FUEL_LOAD_COUNT];
/**
* RPM is float and not integer in order to use unified methods for interpolation
* offset 7288
*/
float fuelRpmBins[FUEL_RPM_COUNT];
/**
* offset 7352
*/
ignition_table_t ignitionTable;
/**
* offset 8376
*/
float ignitionLoadBins[IGN_LOAD_COUNT];
/**
* offset 8440
*/
float ignitionRpmBins[IGN_RPM_COUNT];
/**
* offset 8504
*/
ve_table_t veTable;
/**
* offset 9528
*/
float veLoadBins[FUEL_LOAD_COUNT];
/**
* offset 9592
*/
float veRpmBins[FUEL_RPM_COUNT];
/**
* offset 9656
*/
afr_table_t afrTable;
/**
* offset 10680
*/
float afrLoadBins[FUEL_LOAD_COUNT];
/**
* offset 10744
*/
float afrRpmBins[FUEL_RPM_COUNT];
/** total size 10808*/
/** total size 2216*/
} engine_configuration_s;
typedef struct {
@ -1206,49 +1113,142 @@ typedef struct {
*/
engine_configuration_s engineConfiguration;
/**
* offset 10808
* offset 2216
*/
le_formula_t le_formulas[LE_COMMAND_COUNT];
/**
* offset 5416
*/
le_formula_t timingMultiplier;
/**
* offset 5616
*/
le_formula_t timingAdditive;
/**
* offset 5816
*/
float cltFuelCorrBins[CLT_CURVE_SIZE];
/**
* offset 5880
*/
float cltFuelCorr[CLT_CURVE_SIZE];
/**
* offset 5944
*/
float iatFuelCorrBins[IAT_CURVE_SIZE];
/**
* offset 6008
*/
float iatFuelCorr[IAT_CURVE_SIZE];
/**
* offset 6072
*/
float crankingFuelCoef[CRANKING_CURVE_SIZE];
/**
* offset 6104
*/
float crankingFuelBins[CRANKING_CURVE_SIZE];
/**
* offset 6136
*/
float crankingCycleCoef[CRANKING_CURVE_SIZE];
/**
* offset 6168
*/
float crankingCycleBins[CRANKING_CURVE_SIZE];
/**
* offset 6200
*/
float iatIdleCorrBins[IAT_CURVE_SIZE];
/**
* offset 10872
* offset 6264
*/
float iatIdleCorr[IAT_CURVE_SIZE];
/**
* kg/hour value.
* By the way 2.081989116 kg/h = 1 ft³/m
* offset 10936
* offset 6328
*/
float mafDecoding[MAF_DECODING_COUNT];
/**
* offset 11960
* offset 7352
*/
float mafDecodingBins[MAF_DECODING_COUNT];
/**
* offset 12984
* offset 8376
*/
ignition_table_t ignitionIatCorrTable;
/**
* offset 14008
* offset 9400
*/
float ignitionIatCorrLoadBins[IGN_LOAD_COUNT];
/**
* offset 14072
* offset 9464
*/
float ignitionIatCorrRpmBins[IGN_RPM_COUNT];
/**
* offset 14136
* offset 9528
*/
fuel_table_t injectionPhase;
/**
* offset 15160
* offset 10552
*/
float injPhaseLoadBins[FUEL_LOAD_COUNT];
/**
* offset 15224
* offset 10616
*/
float injPhaseRpmBins[FUEL_RPM_COUNT];
/**
* offset 10680
*/
fuel_table_t fuelTable;
/**
* offset 11704
*/
float fuelLoadBins[FUEL_LOAD_COUNT];
/**
* RPM is float and not integer in order to use unified methods for interpolation
* offset 11768
*/
float fuelRpmBins[FUEL_RPM_COUNT];
/**
* offset 11832
*/
ignition_table_t ignitionTable;
/**
* offset 12856
*/
float ignitionLoadBins[IGN_LOAD_COUNT];
/**
* offset 12920
*/
float ignitionRpmBins[IGN_RPM_COUNT];
/**
* offset 12984
*/
ve_table_t veTable;
/**
* offset 14008
*/
float veLoadBins[FUEL_LOAD_COUNT];
/**
* offset 14072
*/
float veRpmBins[FUEL_RPM_COUNT];
/**
* offset 14136
*/
afr_table_t afrTable;
/**
* offset 15160
*/
float afrLoadBins[FUEL_LOAD_COUNT];
/**
* offset 15224
*/
float afrRpmBins[FUEL_RPM_COUNT];
/** total size 15288*/
} persistent_config_s;
// end
// this section was generated by config_definition.jar on Sun Apr 05 10:16:43 EDT 2015
// this section was generated by config_definition.jar on Sun Apr 05 16:35:24 EDT 2015

View File

@ -156,7 +156,7 @@ float getInjectorLag(float vBatt DECLARE_ENGINE_PARAMETER_S) {
* is to prepare the fuel map data structure for 3d interpolation
*/
void prepareFuelMap(DECLARE_ENGINE_PARAMETER_F) {
fuelMap.init(engineConfiguration->fuelTable, engineConfiguration->fuelLoadBins, engineConfiguration->fuelRpmBins);
fuelMap.init(config->fuelTable, config->fuelLoadBins, config->fuelRpmBins);
fuelPhaseMap.init(config->injectionPhase, config->injPhaseLoadBins, config->injPhaseRpmBins);
}
@ -166,13 +166,13 @@ void prepareFuelMap(DECLARE_ENGINE_PARAMETER_F) {
float getCltCorrection(float clt DECLARE_ENGINE_PARAMETER_S) {
if (cisnan(clt))
return 1; // this error should be already reported somewhere else, let's just handle it
return interpolate2d(clt, engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE);
return interpolate2d(clt, config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE);
}
float getIatCorrection(float iat DECLARE_ENGINE_PARAMETER_S) {
if (cisnan(iat))
return 1; // this error should be already reported somewhere else, let's just handle it
return interpolate2d(iat, engineConfiguration->iatFuelCorrBins, engineConfiguration->iatFuelCorr, IAT_CURVE_SIZE);
return interpolate2d(iat, config->iatFuelCorrBins, config->iatFuelCorr, IAT_CURVE_SIZE);
}
/**
@ -202,9 +202,9 @@ float getCrankingFuel3(float coolantTemperature,
float baseCrankingFuel = engineConfiguration->cranking.baseFuel;
if (cisnan(coolantTemperature))
return baseCrankingFuel;
float durationCoef = interpolate2d(revolutionCounterSinceStart, engineConfiguration->crankingCycleBins,
engineConfiguration->crankingCycleCoef, CRANKING_CURVE_SIZE);
float durationCoef = interpolate2d(revolutionCounterSinceStart, config->crankingCycleBins,
config->crankingCycleCoef, CRANKING_CURVE_SIZE);
return interpolate2d(coolantTemperature, engineConfiguration->crankingFuelBins,
engineConfiguration->crankingFuelCoef, CRANKING_CURVE_SIZE) * baseCrankingFuel * durationCoef;
return interpolate2d(coolantTemperature, config->crankingFuelBins,
config->crankingFuelCoef, CRANKING_CURVE_SIZE) * baseCrankingFuel * durationCoef;
}

View File

@ -123,7 +123,7 @@ void setFsioExt(int index, brain_pin_e pin, const char * exp, int freq DECLARE_E
if (len >= LE_COMMAND_LENGTH) {
return;
}
strcpy(engineConfiguration->le_formulas[index], exp);
strcpy(config->le_formulas[index], exp);
boardConfiguration->fsioFrequency[index] = freq;
}
@ -137,7 +137,7 @@ void applyFsioConfiguration(DECLARE_ENGINE_PARAMETER_F) {
brain_pin_e brainPin = boardConfiguration->fsioPins[i];
if (brainPin != GPIO_UNASSIGNED) {
const char *formula = engineConfiguration->le_formulas[i];
const char *formula = config->le_formulas[i];
LEElement *logic = userPool.parseExpression(formula);
if (logic == NULL) {
warning(OBD_PCM_Processor_Fault, "parsing [%s]", formula);
@ -248,7 +248,7 @@ static void showFsioInfo(void) {
showFsio("alt", alternatorLogic);
for (int i = 0; i < LE_COMMAND_COUNT; i++) {
char * exp = engineConfiguration->le_formulas[i];
char * exp = config->le_formulas[i];
if (exp[0] != 0) {
/**
* in case of FSIO user interface indexes are starting with 0, the argument for that
@ -305,7 +305,7 @@ static void setUserOutput(const char *indexStr, const char *quotedLine, Engine *
}
scheduleMsg(logger, "setting user out #%d to [%s]", index + 1, l);
strcpy(engine->engineConfiguration->le_formulas[index], l);
strcpy(engine->config->le_formulas[index], l);
// this would apply the changes
applyFsioConfiguration(PASS_ENGINE_PARAMETER_F);
showFsioInfo();

View File

@ -12,7 +12,7 @@
#include "engine_configuration.h"
#include "engine.h"
#define FLASH_DATA_VERSION 7615
#define FLASH_DATA_VERSION 7617
void readFromFlash(void);
void initFlash(Logging *sharedLogger, Engine *engine);

View File

@ -377,19 +377,19 @@ void prepareOutputSignals(DECLARE_ENGINE_PARAMETER_F) {
#endif
void setFuelRpmBin(float from, float to DECLARE_ENGINE_PARAMETER_S) {
setTableBin(engineConfiguration->fuelRpmBins, FUEL_RPM_COUNT, from, to);
setTableBin(config->fuelRpmBins, FUEL_RPM_COUNT, from, to);
}
void setFuelLoadBin(float from, float to DECLARE_ENGINE_PARAMETER_S) {
setTableBin(engineConfiguration->fuelLoadBins, FUEL_LOAD_COUNT, from, to);
setTableBin(config->fuelLoadBins, FUEL_LOAD_COUNT, from, to);
}
void setTimingRpmBin(float from, float to DECLARE_ENGINE_PARAMETER_S) {
setTableBin(engineConfiguration->ignitionRpmBins, IGN_RPM_COUNT, from, to);
setTableBin(config->ignitionRpmBins, IGN_RPM_COUNT, from, to);
}
void setTimingLoadBin(float from, float to DECLARE_ENGINE_PARAMETER_S) {
setTableBin(engineConfiguration->ignitionLoadBins, IGN_LOAD_COUNT, from, to);
setTableBin(config->ignitionLoadBins, IGN_LOAD_COUNT, from, to);
}
int isInjectionEnabled(engine_configuration_s *engineConfiguration) {

View File

@ -96,20 +96,19 @@ float getSpeedDensityFuel(int rpm DECLARE_ENGINE_PARAMETER_S) {
}
void setDefaultVETable(DECLARE_ENGINE_PARAMETER_F) {
setRpmTableBin(engineConfiguration->veRpmBins, FUEL_RPM_COUNT);
setRpmTableBin(config->veRpmBins, FUEL_RPM_COUNT);
veMap.setAll(80);
// setRpmTableBin(engineConfiguration->ve2RpmBins, FUEL_RPM_COUNT);
// setTableBin2(engineConfiguration->ve2LoadBins, FUEL_LOAD_COUNT, 10, 300, 1);
// ve2Map.setAll(0.81);
setRpmTableBin(engineConfiguration->afrRpmBins, FUEL_RPM_COUNT);
setRpmTableBin(config->afrRpmBins, FUEL_RPM_COUNT);
afrMap.setAll(14.7);
}
void initSpeedDensity(DECLARE_ENGINE_PARAMETER_F) {
engine_configuration_s *e = engineConfiguration;
veMap.init(e->veTable, e->veLoadBins, e->veRpmBins);
veMap.init(config->veTable, config->veLoadBins, config->veRpmBins);
// ve2Map.init(engineConfiguration->ve2Table, engineConfiguration->ve2LoadBins, engineConfiguration->ve2RpmBins);
afrMap.init(e->afrTable, e->afrLoadBins, e->afrRpmBins);
afrMap.init(config->afrTable, config->afrLoadBins, config->afrRpmBins);
}

View File

@ -199,15 +199,15 @@ void printConfiguration(engine_configuration_s *engineConfiguration) {
// print("\r\n");
}
printFloatArray("RPM bin: ", engineConfiguration->fuelRpmBins, FUEL_RPM_COUNT);
printFloatArray("RPM bin: ", config->fuelRpmBins, FUEL_RPM_COUNT);
printFloatArray("Y bin: ", engineConfiguration->fuelLoadBins, FUEL_LOAD_COUNT);
printFloatArray("Y bin: ", config->fuelLoadBins, FUEL_LOAD_COUNT);
printFloatArray("CLT: ", engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE);
printFloatArray("CLT bins: ", engineConfiguration->cltFuelCorrBins, CLT_CURVE_SIZE);
printFloatArray("CLT: ", config->cltFuelCorr, CLT_CURVE_SIZE);
printFloatArray("CLT bins: ", config->cltFuelCorrBins, CLT_CURVE_SIZE);
printFloatArray("IAT: ", engineConfiguration->iatFuelCorr, IAT_CURVE_SIZE);
printFloatArray("IAT bins: ", engineConfiguration->iatFuelCorrBins, IAT_CURVE_SIZE);
printFloatArray("IAT: ", config->iatFuelCorr, IAT_CURVE_SIZE);
printFloatArray("IAT bins: ", config->iatFuelCorrBins, IAT_CURVE_SIZE);
printFloatArray("vBatt: ", engineConfiguration->injector.battLagCorr, VBAT_INJECTOR_CURVE_SIZE);
printFloatArray("vBatt bins: ", engineConfiguration->injector.battLagCorrBins, VBAT_INJECTOR_CURVE_SIZE);
@ -540,7 +540,7 @@ static void setWholeTimingMap(float value) {
scheduleMsg(&logger, "Setting whole timing map to %f", value);
for (int l = 0; l < IGN_LOAD_COUNT; l++) {
for (int r = 0; r < IGN_RPM_COUNT; r++) {
engineConfiguration->ignitionTable[l][r] = value;
config->ignitionTable[l][r] = value;
}
}
}
@ -734,12 +734,12 @@ static void setTimingMap(const char * rpmStr, const char *loadStr, const char *v
float engineLoad = atoff(loadStr);
float value = atoff(valueStr);
int rpmIndex = findIndex(engineConfiguration->ignitionRpmBins, IGN_RPM_COUNT, rpm);
int rpmIndex = findIndex(config->ignitionRpmBins, IGN_RPM_COUNT, rpm);
rpmIndex = rpmIndex < 0 ? 0 : rpmIndex;
int loadIndex = findIndex(engineConfiguration->ignitionLoadBins, IGN_LOAD_COUNT, engineLoad);
int loadIndex = findIndex(config->ignitionLoadBins, IGN_LOAD_COUNT, engineLoad);
loadIndex = loadIndex < 0 ? 0 : loadIndex;
engineConfiguration->ignitionTable[loadIndex][rpmIndex] = value;
config->ignitionTable[loadIndex][rpmIndex] = value;
scheduleMsg(&logger, "Setting timing map entry %d:%d to %f", rpmIndex, loadIndex, value);
}
@ -748,12 +748,12 @@ static void setFuelMap(const char * rpmStr, const char *loadStr, const char *val
float engineLoad = atoff(loadStr);
float value = atoff(valueStr);
int rpmIndex = findIndex(engineConfiguration->fuelRpmBins, FUEL_RPM_COUNT, rpm);
int rpmIndex = findIndex(config->fuelRpmBins, FUEL_RPM_COUNT, rpm);
rpmIndex = rpmIndex < 0 ? 0 : rpmIndex;
int loadIndex = findIndex(engineConfiguration->fuelLoadBins, FUEL_LOAD_COUNT, engineLoad);
int loadIndex = findIndex(config->fuelLoadBins, FUEL_LOAD_COUNT, engineLoad);
loadIndex = loadIndex < 0 ? 0 : loadIndex;
engineConfiguration->fuelTable[loadIndex][rpmIndex] = value;
config->fuelTable[loadIndex][rpmIndex] = value;
scheduleMsg(&logger, "Setting fuel map entry %d:%d to %f", rpmIndex, loadIndex, value);
}

View File

@ -16,50 +16,50 @@
<filesize>15288</filesize>
</romid>
<table type="3D" name="Ignition Advance" storageaddress="24B8" sizex="16" sizey="16" storagetype="float" endian="big">
<table type="3D" name="Ignition Advance" storageaddress="@@ignitionTable_hex@@" sizex="16" sizey="16" storagetype="float" endian="big">
<scaling units="Engine Load" expression="x" to_byte="x" format="0.00" fineincrement=".1" coarseincrement="1" />
<table type="X Axis" storageaddress="28B8" storagetype="float" endian="big" logparam="engine_load">
<table type="X Axis" storageaddress="@@ignitionLoadBins_hex@@" storagetype="float" endian="big" logparam="engine_load">
<scaling units="degree" expression="x" to_byte="x" format="0.00" fineincrement=".1" coarseincrement="1" />
</table>
<table type="Y Axis" storageaddress="28F8" storagetype="float" endian="big" logparam="rpm">
<table type="Y Axis" storageaddress="@@ignitionRpmBins_hex@@" storagetype="float" endian="big" logparam="rpm">
<scaling units="RPM" expression="x" to_byte="x" format="0.00" fineincrement=".1" coarseincrement="1" />
</table>
</table>
<table type="3D" name="Volumetric Efficiency" storageaddress="2938" sizex="16" sizey="16" storagetype="float" endian="big">
<table type="3D" name="Volumetric Efficiency" storageaddress="@@veTable_hex@@" sizex="16" sizey="16" storagetype="float" endian="big">
<scaling units="Engine Load" expression="x" to_byte="x" format="0.00" fineincrement=".1" coarseincrement="1" />
<table type="X Axis" storageaddress="2D38" storagetype="float" endian="big" logparam="engine_load">
<table type="X Axis" storageaddress="@@veLoadBins_hex@@" storagetype="float" endian="big" logparam="engine_load">
<scaling units="degree" expression="x" to_byte="x" format="0.00" fineincrement=".1" coarseincrement="1" />
</table>
<table type="Y Axis" storageaddress="2D78" storagetype="float" endian="big" logparam="rpm">
<table type="Y Axis" storageaddress="@@veRpmBins_hex@@" storagetype="float" endian="big" logparam="rpm">
<scaling units="RPM" expression="x" to_byte="x" format="0.00" fineincrement=".1" coarseincrement="1" />
</table>
</table>
<table type="3D" name="Fuel Table" storageaddress="2038" sizex="16" sizey="16" storagetype="float" endian="big">
<table type="3D" name="Fuel Table" storageaddress="@@fuelTable_hex@@" sizex="16" sizey="16" storagetype="float" endian="big">
<scaling units="Engine Load" expression="x" to_byte="x" format="0.00" fineincrement=".1" coarseincrement="1" />
<table type="X Axis" storageaddress="2438" storagetype="float" endian="big" logparam="engine_load">
<table type="X Axis" storageaddress="@@fuelLoadBins_hex@@" storagetype="float" endian="big" logparam="engine_load">
<scaling units="degree" expression="x" to_byte="x" format="0.00" fineincrement=".1" coarseincrement="1" />
</table>
<table type="Y Axis" storageaddress="2478" storagetype="float" endian="big" logparam="rpm">
<table type="Y Axis" storageaddress="@@fuelRpmBins_hex@@" storagetype="float" endian="big" logparam="rpm">
<scaling units="RPM" expression="x" to_byte="x" format="0.00" fineincrement=".1" coarseincrement="1" />
</table>
</table>
<table type="3D" name="Target AFR" storageaddress="2DB8" sizex="16" sizey="16" storagetype="float" endian="big">
<table type="3D" name="Target AFR" storageaddress="@@afrTable_hex@@" sizex="16" sizey="16" storagetype="float" endian="big">
<scaling units="Engine Load" expression="x" to_byte="x" format="0.00" fineincrement=".1" coarseincrement="1" />
<table type="X Axis" storageaddress="31B8" storagetype="float" endian="big">
<table type="X Axis" storageaddress="@@afrLoadBins_hex@@" storagetype="float" endian="big">
<scaling units="degree" expression="x" to_byte="x" format="0.00" fineincrement=".1" coarseincrement="1" />
</table>
<table type="Y Axis" storageaddress="31F8" storagetype="float" endian="big">
<table type="Y Axis" storageaddress="@@afrRpmBins_hex@@" storagetype="float" endian="big">
<scaling units="RPM" expression="x" to_byte="x" format="0.00" fineincrement=".1" coarseincrement="1" />
</table>
</table>
<table type="2D" name="Coolant-based Warnup Enrichment" storageaddress="90" sizex="16" storagetype="float" endian="big">
<table type="2D" name="Coolant-based Warnup Enrichment" storageaddress="@@cltFuelCorr_hex@@" sizex="16" storagetype="float" endian="big">
<scaling units="Target Boost (psia) Compensation (%)" expression="x" to_byte="x" format="0.00" fineincrement=".01" coarseincrement="0.1" />
<table type="X Axis" storageaddress="50" storagetype="float" endian="big">
<table type="X Axis" storageaddress="@@cltFuelCorrBins_hex@@" storagetype="float" endian="big">
<scaling units="uni" expression="x" to_byte="x" format="0.00" fineincrement=".1" coarseincrement="1" />
</table>
</table>

View File

@ -109,13 +109,6 @@ end_struct
injector_s injector
float[CLT_CURVE_SIZE] cltFuelCorrBins;;"C", 1, 0, -100.0, 250.0, 2
float[CLT_CURVE_SIZE] cltFuelCorr;;"%", 1, 0, 0.0, 500.0, 2
float[IAT_CURVE_SIZE] iatFuelCorrBins;;"C", 1, 0, -100.0, 250.0, 2
float[IAT_CURVE_SIZE] iatFuelCorr;;"%", 1, 0, 0.0, 500.0, 2
int16_t directSelfStimulation;Should the trigger emulator push data right into trigger input, eliminating the need for physical jumper wires?\nPS: Funny name, right? :)\ntodo: make this a bit on some bit field
int16_t tpsMin;todo: extract these two fields into a structure\ntodo: we need two sets of TPS parameters - modern ETBs have two sensors;"ADC", 1, 0, 0, 1023, 0
@ -415,7 +408,6 @@ end_struct
custom le_formula_t 200 array, U08, @OFFSET@, [200],"char", 1, 0, 0.0, 3.0, 2
board_configuration_s bc;
le_formula_t[LE_COMMAND_COUNT iterate] le_formulas;
bit hasMapSensor;@see isMapAveragingEnabled
bit hasIatSensor
bit hasBaroSensor
@ -456,13 +448,6 @@ bit hasMapSensor;@see isMapAveragingEnabled
uint32_t digitalChartSize;;"count", 1, 0, 0, 300, 0
float[CRANKING_CURVE_SIZE] crankingFuelCoef;;"%", 1, 0, 0.0, 700.0, 2
float[CRANKING_CURVE_SIZE] crankingFuelBins;;"C", 1, 0, -80.0, 170.0, 2
float[CRANKING_CURVE_SIZE] crankingCycleCoef;;"%", 1, 0, 0.0, 500.0, 2
float[CRANKING_CURVE_SIZE] crankingCycleBins;;"C", 1, 0, -80.0, 170.0, 2
float ignitionDwellForCrankingMs;;"ms", 1, 0, 0, 200, 1
int targetIdleRpm;
@ -503,9 +488,39 @@ custom pin_input_mode_e 4 scalar, F32, @OFFSET@, "ms", 1, 0, 0, 200, 1
float accelEnrichmentThreshold;;"roc", 1, 0, 0, 200, 3
float accelEnrichmentMultiplier;;"coeff", 1, 0, 0, 200, 3
end_struct
engine_configuration_s engineConfiguration;
le_formula_t[LE_COMMAND_COUNT iterate] le_formulas;
le_formula_t timingMultiplier;
le_formula_t timingAdditive;
float[CLT_CURVE_SIZE] cltFuelCorrBins;;"C", 1, 0, -100.0, 250.0, 2
float[CLT_CURVE_SIZE] cltFuelCorr;;"%", 1, 0, 0.0, 500.0, 2
float[IAT_CURVE_SIZE] iatFuelCorrBins;;"C", 1, 0, -100.0, 250.0, 2
float[IAT_CURVE_SIZE] iatFuelCorr;;"%", 1, 0, 0.0, 500.0, 2
float[CRANKING_CURVE_SIZE] crankingFuelCoef;;"%", 1, 0, 0.0, 700.0, 2
float[CRANKING_CURVE_SIZE] crankingFuelBins;;"C", 1, 0, -80.0, 170.0, 2
float[CRANKING_CURVE_SIZE] crankingCycleCoef;;"%", 1, 0, 0.0, 500.0, 2
float[CRANKING_CURVE_SIZE] crankingCycleBins;;"C", 1, 0, -80.0, 170.0, 2
float[IAT_CURVE_SIZE] iatIdleCorrBins;;"C", 1, 0, -100.0, 250.0, 2
float[IAT_CURVE_SIZE] iatIdleCorr;;"%", 1, 0, 0.0, 500.0, 2
float[MAF_DECODING_COUNT] mafDecoding;kg/hour value.\nBy the way 2.081989116 kg/h = 1 ft³/m;"kg/hour", 1, 0, -500.0, 4000.0, 2
float[MAF_DECODING_COUNT] mafDecodingBins;; "V", 1, 0, -5.0, 150.0, 2
ignition_table_t ignitionIatCorrTable;
float[IGN_LOAD_COUNT] ignitionIatCorrLoadBins;;"Load", 1, 0.0, 0, 300.0, 2
float[IGN_RPM_COUNT] ignitionIatCorrRpmBins;;"RPM", 1, 0.0, 0, 18000.0, 2
fuel_table_t injectionPhase;
float[FUEL_LOAD_COUNT] injPhaseLoadBins;;"Load", 1, 0.0, 0, 300.0, 2
float[FUEL_RPM_COUNT] injPhaseRpmBins;;"RPM", 1, 0.0, 0, 18000.0, 2
fuel_table_t fuelTable;
float[FUEL_LOAD_COUNT] fuelLoadBins;;"V", 1, 0, 0.0, 300.0, 2
@ -523,24 +538,6 @@ afr_table_t afrTable;
float[FUEL_LOAD_COUNT] afrLoadBins;;"%", 1, 0.0, 0, 300.0, 2
float[FUEL_RPM_COUNT] afrRpmBins;;"RPM", 1, 0.0, 0, 18000.0, 2
end_struct
engine_configuration_s engineConfiguration;
float[IAT_CURVE_SIZE] iatIdleCorrBins;;"C", 1, 0, -100.0, 250.0, 2
float[IAT_CURVE_SIZE] iatIdleCorr;;"%", 1, 0, 0.0, 500.0, 2
float[MAF_DECODING_COUNT] mafDecoding;kg/hour value.\nBy the way 2.081989116 kg/h = 1 ft³/m;"kg/hour", 1, 0, -500.0, 4000.0, 2
float[MAF_DECODING_COUNT] mafDecodingBins;; "V", 1, 0, -5.0, 150.0, 2
ignition_table_t ignitionIatCorrTable;
float[IGN_LOAD_COUNT] ignitionIatCorrLoadBins;;"Load", 1, 0.0, 0, 300.0, 2
float[IGN_RPM_COUNT] ignitionIatCorrRpmBins;;"RPM", 1, 0.0, 0, 18000.0, 2
fuel_table_t injectionPhase;
float[FUEL_LOAD_COUNT] injPhaseLoadBins;;"Load", 1, 0.0, 0, 300.0, 2
float[FUEL_RPM_COUNT] injPhaseRpmBins;;"RPM", 1, 0.0, 0, 18000.0, 2
! ve_table_t ve2Table;
! float[FUEL_LOAD_COUNT] ve2LoadBins;;"%", 1, 0.0, 0, 300.0, 2
! float[FUEL_RPM_COUNT] ve2RpmBins;;"RPM", 1, 0.0, 0, 18000.0, 2

View File

@ -276,5 +276,5 @@ int getRusEfiVersion(void) {
return 1; // this is here to make the compiler happy about the unused array
if (UNUSED_CCM_SIZE[0] == 0)
return 1; // this is here to make the compiler happy about the unused array
return 20150404;
return 20150405;
}

View File

@ -19,18 +19,18 @@ EngineTestHelper::EngineTestHelper(engine_type_e engineType) : engine (&persiste
engineConfiguration = ec;
persistent_config_s *config = &persistentConfig;
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, -40, 1.5);
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, -30, 1.5);
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, -20, 1.42);
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, -10, 1.36);
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, 0, 1.28);
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, 10, 1.19);
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, 20, 1.12);
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, 30, 1.10);
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, 40, 1.06);
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, 50, 1.06);
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, 60, 1.03);
setTableValue(engineConfiguration->cltFuelCorrBins, engineConfiguration->cltFuelCorr, CLT_CURVE_SIZE, 70, 1.01);
setTableValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, -40, 1.5);
setTableValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, -30, 1.5);
setTableValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, -20, 1.42);
setTableValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, -10, 1.36);
setTableValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, 0, 1.28);
setTableValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, 10, 1.19);
setTableValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, 20, 1.12);
setTableValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, 30, 1.10);
setTableValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, 40, 1.06);
setTableValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, 50, 1.06);
setTableValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, 60, 1.03);
setTableValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, 70, 1.01);
engine.engineConfiguration2 = &ec2;

View File

@ -97,22 +97,23 @@ void testInterpolate2d(void) {
assertEquals(215, result);
}
static engine_configuration_s engineConfiguration;
void testSetTableValue(void) {
printf("*************************************************** testSetTableValue\r\n");
persistent_config_s config;
// memset()
for (int i = 0; i < CLT_CURVE_SIZE; i++) {
engineConfiguration.cltFuelCorrBins[i] = -40 + i * 10;
engineConfiguration.cltFuelCorr[i] = 1;
config.cltFuelCorrBins[i] = -40 + i * 10;
config.cltFuelCorr[i] = 1;
}
assertEquals(1, engineConfiguration.cltFuelCorr[0]);
assertEquals(1, config.cltFuelCorr[0]);
setTableValue(engineConfiguration.cltFuelCorrBins, engineConfiguration.cltFuelCorr, CLT_CURVE_SIZE, -40, 1.5);
assertEquals(1.5, engineConfiguration.cltFuelCorr[0]);
setTableValue(config.cltFuelCorrBins, config.cltFuelCorr, CLT_CURVE_SIZE, -40, 1.5);
assertEquals(1.5, config.cltFuelCorr[0]);
setTableValue(engineConfiguration.cltFuelCorrBins, engineConfiguration.cltFuelCorr, CLT_CURVE_SIZE, -50, 1.4);
assertEquals(1.4, engineConfiguration.cltFuelCorr[0]);
setTableValue(config.cltFuelCorrBins, config.cltFuelCorr, CLT_CURVE_SIZE, -50, 1.4);
assertEquals(1.4, config.cltFuelCorr[0]);
}

View File

@ -26,7 +26,7 @@ void testMafFuelMath(void) {
engineConfiguration->algorithm = LM_REAL_MAF;
engineConfiguration->injector.flow = 200;
setMap(engineConfiguration->afrTable, 13);
setMap(config->afrTable, 13);
float fuelMs = getRealMafFuel(300, 6000 PASS_ENGINE_PARAMETER);
assertEquals(26.7099, fuelMs);
@ -42,13 +42,13 @@ void testFuelMap(void) {
printf("Filling fuel map\r\n");
for (int k = 0; k < FUEL_LOAD_COUNT; k++) {
for (int r = 0; r < FUEL_RPM_COUNT; r++) {
eth.engine.engineConfiguration->fuelTable[k][r] = k * 200 + r;
eth.engine.config->fuelTable[k][r] = k * 200 + r;
}
}
for (int i = 0; i < FUEL_LOAD_COUNT; i++)
eth.engine.engineConfiguration->fuelLoadBins[i] = i;
eth.engine.config->fuelLoadBins[i] = i;
for (int i = 0; i < FUEL_RPM_COUNT; i++)
eth.engine.engineConfiguration->fuelRpmBins[i] = i;
eth.engine.config->fuelRpmBins[i] = i;
assertEqualsM("base fuel table", 1005, getBaseTableFuel(eth.engine.engineConfiguration, 5, 5));
@ -75,15 +75,15 @@ void testFuelMap(void) {
printf("*************************************************** setting IAT table\r\n");
for (int i = 0; i < IAT_CURVE_SIZE; i++) {
eth.engine.engineConfiguration->iatFuelCorrBins[i] = i;
eth.engine.engineConfiguration->iatFuelCorr[i] = 2 * i;
eth.engine.config->iatFuelCorrBins[i] = i;
eth.engine.config->iatFuelCorr[i] = 2 * i;
}
eth.engine.engineConfiguration->iatFuelCorr[0] = 2;
eth.engine.config->iatFuelCorr[0] = 2;
printf("*************************************************** setting CLT table\r\n");
for (int i = 0; i < CLT_CURVE_SIZE; i++) {
eth.engine.engineConfiguration->cltFuelCorrBins[i] = i;
eth.engine.engineConfiguration->cltFuelCorr[i] = 1;
eth.engine.config->cltFuelCorrBins[i] = i;
eth.engine.config->cltFuelCorr[i] = 1;
}
eth.engine.engineConfiguration->injector.lag = 0;

View File

@ -182,8 +182,8 @@ void testFordAspire(void) {
assertEquals(4, eth.engine.triggerShape.getTriggerShapeSynchPointIndex());
assertEquals(800, engineConfiguration->fuelRpmBins[0]);
assertEquals(7000, engineConfiguration->fuelRpmBins[15]);
assertEquals(800, config->fuelRpmBins[0]);
assertEquals(7000, config->fuelRpmBins[15]);
engineConfiguration->crankingChargeAngle = 65;
engineConfiguration->crankingTimingAngle = 31;