auto-sync

This commit is contained in:
rusEfi 2015-05-12 15:09:38 -04:00
parent 36d6274e0e
commit e627eb960c
14 changed files with 55 additions and 16 deletions

View File

@ -169,7 +169,7 @@ static void printSensors(Logging *log, bool fileFormat) {
reportSensorF(log, fileFormat, "MAP", "kPa", getMap(), 2);
// reportSensorF(log, fileFormat, "map_r", "V", getRawMap(), 2);
}
if (engineConfiguration->hasBaroSensor) {
if (hasBaroSensor()) {
reportSensorF(log, fileFormat, "baro", "kPa", getBaroPressure(), 2);
}
if (engineConfiguration->hasAfrSensor) {

View File

@ -179,6 +179,12 @@ void Engine::periodicFastCallback(DECLARE_ENGINE_PARAMETER_F) {
engine->engineState.iatFuelCorrection = getIatCorrection(engine->engineState.iat PASS_ENGINE_PARAMETER);
engine->engineState.cltFuelCorrection = getCltCorrection(engine->engineState.clt PASS_ENGINE_PARAMETER);
if (hasBaroSensor()) {
engine->engineState.baroCorrection = getBaroCorrection(PASS_ENGINE_PARAMETER_F);
} else {
engine->engineState.baroCorrection = 1;
}
engine->engineState.injectionAngle = getInjectionAngle(rpm PASS_ENGINE_PARAMETER);
engine->engineState.timingAdvance = getAdvance(rpm, engineLoad PASS_ENGINE_PARAMETER);

View File

@ -92,6 +92,8 @@ public:
float cltFuelCorrection;
float injectorLag;
float baroCorrection;
// speed density
float tChargeK;
float currentVE;

View File

@ -1,4 +1,4 @@
// this section was generated by config_definition.jar on Tue May 12 08:48:02 EDT 2015
// this section was generated by config_definition.jar on Tue May 12 14:18:57 EDT 2015
// begin
#include "rusefi_types.h"
typedef struct {
@ -1106,7 +1106,7 @@ typedef struct {
/**
* offset 1652
*/
float baroCorrLoadBins[BARO_CORR_SIZE];
float baroCorrPressureBins[BARO_CORR_SIZE];
/**
* offset 1668
*/
@ -1298,4 +1298,4 @@ typedef struct {
} persistent_config_s;
// end
// this section was generated by config_definition.jar on Tue May 12 08:48:02 EDT 2015
// this section was generated by config_definition.jar on Tue May 12 14:18:57 EDT 2015

View File

@ -48,6 +48,7 @@ static fuel_Map3D_t fuelMap;
static fuel_Map3D_t fuelPhaseMap;
extern fuel_Map3D_t ve2Map;
extern fuel_Map3D_t afrMap;
extern baroCorr_Map3D_t baroCorrMap;
/**
* @return total duration of fuel injection per engine cycle, in milliseconds
@ -187,6 +188,10 @@ floatms_t getBaseTableFuel(engine_configuration_s *engineConfiguration, int rpm,
return fuelMap.getValue(engineLoad, rpm);
}
float getBaroCorrection(DECLARE_ENGINE_PARAMETER_F) {
return baroCorrMap.getValue(getBaroPressure(), getRpm());
}
#if EFI_ENGINE_CONTROL
/**
* @return Duration of fuel injection while craning

View File

@ -25,6 +25,7 @@ floatms_t getRunningFuel(floatms_t baseFuel, int rpm DECLARE_ENGINE_PARAMETER_S)
floatms_t getRealMafFuel(float airMass, int rpm DECLARE_ENGINE_PARAMETER_S);
floatms_t getBaseTableFuel(engine_configuration_s *engineConfiguration, int rpm, float engineLoad);
float getBaroCorrection(DECLARE_ENGINE_PARAMETER_F);
float getInjectionAngle(int rpm DECLARE_ENGINE_PARAMETER_S);
float getIatCorrection(float iat DECLARE_ENGINE_PARAMETER_S);

View File

@ -634,8 +634,8 @@
#define noAccelAfterHardLimitPeriodSecs_offset 1644
#define mapAveragingSchedulingAtIndex_offset 1648
#define mapAveragingSchedulingAtIndex_offset_hex 670
#define baroCorrLoadBins_offset 1652
#define baroCorrLoadBins_offset_hex 674
#define baroCorrPressureBins_offset 1652
#define baroCorrPressureBins_offset_hex 674
#define baroCorrRpmBins_offset 1668
#define baroCorrRpmBins_offset_hex 684
#define baroCorrTable_offset 1684

View File

@ -333,7 +333,7 @@ static void printAnalogInfo(void) {
if (engineConfiguration->hasMapSensor) {
printAnalogChannelInfo("MAP", engineConfiguration->map.sensor.hwChannel);
}
if (engineConfiguration->hasBaroSensor) {
if (hasBaroSensor()) {
printAnalogChannelInfo("BARO", engineConfiguration->baroSensor.hwChannel);
}
if (engineConfiguration->externalKnockSenseAdc != EFI_ADC_NONE) {

View File

@ -232,7 +232,7 @@ static void showLine(lcd_line_e line, int screenY) {
return;
#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__)
case LL_BARO:
if (engineConfiguration->hasBaroSensor) {
if (hasBaroSensor()) {
lcdPrintf("Baro: %f", getBaroPressure());
} else {
lcdPrintf("Baro: none");

View File

@ -93,6 +93,13 @@ float getSpeedDensityFuel(int rpm DECLARE_ENGINE_PARAMETER_S) {
return sdMath(engineConfiguration, ENGINE(engineState.currentVE), adjMap, ENGINE(engineState.targerAFR), tChargeK) * 1000;
}
static const baro_corr_table_t default_baro_corr = {
{1.141, 1.086, 1.039, 1},
{1.141, 1.086, 1.039, 1},
{1.141, 1.086, 1.039, 1},
{1.141, 1.086, 1.039, 1}
};
void setDefaultVETable(DECLARE_ENGINE_PARAMETER_F) {
setRpmTableBin(config->veRpmBins, FUEL_RPM_COUNT);
veMap.setAll(80);
@ -103,11 +110,15 @@ void setDefaultVETable(DECLARE_ENGINE_PARAMETER_F) {
setRpmTableBin(config->afrRpmBins, FUEL_RPM_COUNT);
afrMap.setAll(14.7);
setRpmTableBin(engineConfiguration->baroCorrRpmBins, BARO_CORR_SIZE);
setTableBin2(engineConfiguration->baroCorrPressureBins, BARO_CORR_SIZE, 75, 105, 1);
memcpy(engineConfiguration->baroCorrTable, default_baro_corr, sizeof(default_baro_corr));
}
void initSpeedDensity(DECLARE_ENGINE_PARAMETER_F) {
veMap.init(config->veTable, config->veLoadBins, config->veRpmBins);
// ve2Map.init(engineConfiguration->ve2Table, engineConfiguration->ve2LoadBins, engineConfiguration->ve2RpmBins);
afrMap.init(config->afrTable, config->afrLoadBins, config->afrRpmBins);
baroCorrMap.init(engineConfiguration->baroCorrTable, engineConfiguration->baroCorrLoadBins, engineConfiguration->baroCorrRpmBins);
baroCorrMap.init(engineConfiguration->baroCorrTable, engineConfiguration->baroCorrPressureBins, engineConfiguration->baroCorrRpmBins);
}

View File

@ -80,8 +80,12 @@ float getRawMap(DECLARE_ENGINE_PARAMETER_F) {
return getMapByVoltage(voltage PASS_ENGINE_PARAMETER);
}
bool_t hasBaroSensor(DECLARE_ENGINE_PARAMETER_F) {
return engineConfiguration->hasBaroSensor && engineConfiguration->baroSensor.hwChannel != EFI_ADC_NONE;
}
float getBaroPressure(DECLARE_ENGINE_PARAMETER_F) {
float voltage = getVoltageDivided("map", engineConfiguration->baroSensor.hwChannel);
float voltage = getVoltageDivided("baro", engineConfiguration->baroSensor.hwChannel);
return decodePressure(voltage, &engineConfiguration->baroSensor);
}

View File

@ -11,6 +11,7 @@ void initMapDecoder(DECLARE_ENGINE_PARAMETER_F);
*/
float getRawMap(DECLARE_ENGINE_PARAMETER_F);
float getBaroPressure(DECLARE_ENGINE_PARAMETER_F);
bool_t hasBaroSensor(DECLARE_ENGINE_PARAMETER_F);
/**
* @return MAP value averaged within a window of measurement
*/

View File

@ -16,7 +16,7 @@
<filesize>@@total_config_size@@</filesize>
</romid>
<table type="3D" name="Ignition Advance" storageaddress="@@ignitionTable_offset_hex@@" sizex="16" sizey="16" storagetype="float" endian="big">
<table type="3D" name="Ignition Advance" storageaddress="@@ignitionTable_offset_hex@@" sizex="@@IGN_LOAD_COUNT@@" sizey="@@IGN_RPM_COUNT@@" 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="@@ignitionLoadBins_offset_hex@@" storagetype="float" endian="big" logparam="engine_load">
<scaling units="degree" expression="x" to_byte="x" format="0.00" fineincrement=".1" coarseincrement="1" />
@ -26,7 +26,7 @@
</table>
</table>
<table type="3D" name="Ignition Advance IAT correction" storageaddress="@@ignitionIatCorrTable_offset_hex@@" sizex="16" sizey="16" storagetype="float" endian="big">
<table type="3D" name="Ignition Advance IAT correction" storageaddress="@@ignitionIatCorrTable_offset_hex@@" sizex="@@IGN_LOAD_COUNT@@" sizey="@@IGN_RPM_COUNT@@" 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="@@ignitionIatCorrLoadBins_offset_hex@@" storagetype="float" endian="big" logparam="engine_load">
<scaling units="temperature, C" expression="x" to_byte="x" format="0.00" fineincrement=".1" coarseincrement="1" />
@ -36,7 +36,7 @@
</table>
</table>
<table type="3D" name="Volumetric Efficiency" storageaddress="@@veTable_offset_hex@@" sizex="16" sizey="16" storagetype="float" endian="big">
<table type="3D" name="Volumetric Efficiency" storageaddress="@@veTable_offset_hex@@" sizex="@@FUEL_LOAD_COUNT@@" sizey="@@FUEL_RPM_COUNT@@" 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="@@veLoadBins_offset_hex@@" storagetype="float" endian="big" logparam="engine_load">
<scaling units="degree" expression="x" to_byte="x" format="0.00" fineincrement=".1" coarseincrement="1" />
@ -46,7 +46,7 @@
</table>
</table>
<table type="3D" name="Fuel Table" storageaddress="@@fuelTable_offset_hex@@" sizex="16" sizey="16" storagetype="float" endian="big">
<table type="3D" name="Fuel Table" storageaddress="@@fuelTable_offset_hex@@" sizex="@@FUEL_LOAD_COUNT@@" sizey="@@FUEL_RPM_COUNT@@" 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="@@fuelLoadBins_offset_hex@@" storagetype="float" endian="big" logparam="engine_load">
<scaling units="degree" expression="x" to_byte="x" format="0.00" fineincrement=".1" coarseincrement="1" />
@ -56,7 +56,7 @@
</table>
</table>
<table type="3D" name="Target AFR" storageaddress="@@afrTable_offset_hex@@" sizex="16" sizey="16" storagetype="float" endian="big">
<table type="3D" name="Target AFR" storageaddress="@@afrTable_offset_hex@@" sizex="@@FUEL_LOAD_COUNT@@" sizey="@@FUEL_RPM_COUNT@@" 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="@@afrLoadBins_offset_hex@@" storagetype="float" endian="big">
<scaling units="degree" expression="x" to_byte="x" format="0.00" fineincrement=".1" coarseincrement="1" />
@ -66,6 +66,15 @@
</table>
</table>
<table type="3D" name="Baro Correction" storageaddress="@@baroCorrTable_offset_hex@@" sizex="@@BARO_CORR_SIZE@@" sizey="@@BARO_CORR_SIZE@@" storagetype="float" endian="big">
<scaling units="Pressure" expression="x" to_byte="x" format="0.00" fineincrement=".1" coarseincrement="1" />
<table type="X Axis" storageaddress="@@baroCorrPressureBins_offset_hex@@" storagetype="float" endian="big">
<scaling units="kPa" expression="x" to_byte="x" format="0.00" fineincrement=".1" coarseincrement="1" />
</table>
<table type="Y Axis" storageaddress="@@baroCorrRpmBins_offset_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="@@cltFuelCorr_offset_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" />

View File

@ -519,7 +519,7 @@ float noAccelAfterHardLimitPeriodSecs;;"sec", 1, 0, 0, 60,
int mapAveragingSchedulingAtIndex;
float[BARO_CORR_SIZE] baroCorrLoadBins;
float[BARO_CORR_SIZE] baroCorrPressureBins;
float[BARO_CORR_SIZE] baroCorrRpmBins;
baro_corr_table_t baroCorrTable;