auto-sync

This commit is contained in:
rusEfi 2016-12-17 11:01:40 -05:00
parent e72f660b39
commit 6bfd64cb5d
24 changed files with 77 additions and 62 deletions

View File

@ -98,7 +98,6 @@ void setFordInline6(DECLARE_ENGINE_PARAMETER_F) {
// engineConfiguration->vbattAdcChannel = 0; //
engineConfiguration->mafAdcChannel = EFI_ADC_1;
engineConfiguration->hasMafSensor = true;
boardConfiguration->triggerInputPins[0] = GPIOA_8;
boardConfiguration->triggerInputPins[1] = GPIOA_5;

View File

@ -118,8 +118,6 @@ void setFordEscortGt(DECLARE_ENGINE_PARAMETER_F) {
// Denso 195500-2180
engineConfiguration->injector.flow = 265;
engineConfiguration->hasBaroSensor = false;
boardConfiguration->isFastAdcEnabled = true;
engineConfiguration->map.sensor.type = MT_DENSO183;
engineConfiguration->map.sensor.hwChannel = EFI_ADC_4;

View File

@ -70,8 +70,6 @@ static const ignition_table_t mapBased18vvtTimingTable = {
void setMazdaMiata2003EngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
setCustomEngineConfiguration(PASS_ENGINE_PARAMETER_F);
engineConfiguration->hasMapSensor = true;
engineConfiguration->trigger.type = TT_MIATA_VVT;
setOperationMode(engineConfiguration, FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR);
engineConfiguration->specs.displacement = 1.8;

View File

@ -34,9 +34,6 @@ void setSachs(DECLARE_ENGINE_PARAMETER_F) {
engineConfiguration->trigger.customTotalToothCount = 50;
engineConfiguration->trigger.customSkippedToothCount = 2;
engineConfiguration->hasMapSensor = false;
engineConfiguration->hasBaroSensor = false;
engineConfiguration->hasAfrSensor = false;
boardConfiguration->useSerialPort = false;
// Frankenstein analog input #1: PA1 adc1 MAP

View File

@ -178,17 +178,20 @@ static void printSensors(Logging *log, bool fileFormat) {
reportSensorI(log, fileFormat, "mode", "v", packEngineMode(PASS_ENGINE_PARAMETER_F)); // log column #3
if (engineConfiguration->hasCltSensor) {
if (hasCltSensor()) {
reportSensorF(log, fileFormat, "CLT", "C", getCoolantTemperature(PASS_ENGINE_PARAMETER_F), 2); // log column #4
}
reportSensorF(log, fileFormat, "TPS", "%", getTPS(PASS_ENGINE_PARAMETER_F), 2); // log column #5
if (hasTpsSensor()) {
reportSensorF(log, fileFormat, "TPS", "%", getTPS(PASS_ENGINE_PARAMETER_F), 2); // log column #5
}
if (hasVBatt(PASS_ENGINE_PARAMETER_F)) {
reportSensorF(log, fileFormat, "vbatt", "V", getVBatt(PASS_ENGINE_PARAMETER_F), 2); // log column #6
}
reportSensorF(log, fileFormat, "IAT", "C", getIntakeAirTemperature(PASS_ENGINE_PARAMETER_F), 2); // log column #7
if (hasIatSensor()) {
reportSensorF(log, fileFormat, "IAT", "C", getIntakeAirTemperature(PASS_ENGINE_PARAMETER_F), 2); // log column #7
}
if (hasMafSensor()) {
reportSensorF(log, fileFormat, "maf", "V", getMaf(PASS_ENGINE_PARAMETER_F), 2);
@ -206,7 +209,7 @@ static void printSensors(Logging *log, bool fileFormat) {
}
#endif /* EFI_ANALOG_SENSORS */
if (engineConfiguration->hasAfrSensor) {
if (hasAftSensor(PASS_ENGINE_PARAMETER_F)) {
reportSensorF(log, fileFormat, "afr", "AFR", getAfr(PASS_ENGINE_PARAMETER_F), 2);
}

View File

@ -634,10 +634,6 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
engineConfiguration->baroSensor.lowValue = 0;
engineConfiguration->baroSensor.highValue = 500;
engineConfiguration->hasMapSensor = true;
engineConfiguration->hasTpsSensor = true;
engineConfiguration->hasAfrSensor = true;
engineConfiguration->hasBaroSensor = false;
engineConfiguration->isEngineChartEnabled = true;
engineConfiguration->useOnlyRisingEdgeForTrigger = false;

View File

@ -1,4 +1,4 @@
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Tue Dec 06 21:51:50 EST 2016
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Dec 17 10:16:55 EST 2016
// begin
#ifndef ENGINE_CONFIGURATION_GENERATED_H_
#define ENGINE_CONFIGURATION_GENERATED_H_
@ -1181,7 +1181,6 @@ typedef struct {
*/
adc_channel_e mafAdcChannel;
/**
* @see hasAfrSensor
* offset 584
*/
afr_sensor_s afr;
@ -1199,18 +1198,17 @@ typedef struct {
*/
board_configuration_s bc;
/**
* @see isMapAveragingEnabled
offset 1488 bit 0 */
bool hasMapSensor : 1;
bool unusedBit__4 : 1;
/**
offset 1488 bit 1 */
bool hasIatSensor : 1;
bool unusedBit__1 : 1;
/**
offset 1488 bit 2 */
bool hasBaroSensor : 1;
bool unusedBit__5 : 1;
/**
offset 1488 bit 3 */
bool hasAfrSensor : 1;
bool unusedBit__6 : 1;
/**
offset 1488 bit 4 */
bool useConstantDwellDuringCranking : 1;
@ -1223,7 +1221,7 @@ typedef struct {
bool isCanEnabled : 1;
/**
offset 1488 bit 7 */
bool hasCltSensor : 1;
bool unusedBit__2 : 1;
/**
offset 1488 bit 8 */
bool canReadEnabled : 1;
@ -1243,9 +1241,8 @@ typedef struct {
offset 1488 bit 13 */
bool isAlternatorControlEnabled : 1;
/**
* See mafAdcChannel
offset 1488 bit 14 */
bool hasMafSensor : 1;
bool unusedBit__3 : 1;
/**
offset 1488 bit 15 */
bool hasTpsSensor : 1;
@ -2021,4 +2018,4 @@ typedef struct {
#endif
// end
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Tue Dec 06 21:51:50 EST 2016
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Dec 17 10:16:55 EST 2016

View File

@ -65,8 +65,9 @@ static percent_t setNewValue(IdleValveState *idle, int currentRpm, efitimems_t n
bool isTpsLockout(DECLARE_ENGINE_PARAMETER_F) {
// if we have TPS sensor, then use it
if (engineConfiguration->hasTpsSensor)
if (hasTpsSensor(PASS_ENGINE_PARAMETER_F)) {
return getTPS(PASS_ENGINE_PARAMETER_F) > TPS_IDLE_LOCKOUT;
}
// TODO: if no TPS sensor then idle switch is our
return true;
}

View File

@ -617,8 +617,8 @@
#define frequencyReportingMapInputPin_offset 1484
#define unusedBit__4_offset 1488
#define unusedBit__1_offset 1488
#define hasBaroSensor_offset 1488
#define hasAfrSensor_offset 1488
#define unusedBit__5_offset 1488
#define unusedBit__6_offset 1488
#define useConstantDwellDuringCranking_offset 1488
#define isEngineChartEnabled_offset 1488
#define isCanEnabled_offset 1488

View File

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

View File

@ -264,14 +264,14 @@ static void showLine(lcd_line_e line, int screenY) {
return;
#endif
case LL_AFR:
if (engineConfiguration->hasAfrSensor) {
if (hasAfrSensor(PASS_ENGINE_PARAMETER_F)) {
lcdPrintf("AFR: %f", getAfr());
} else {
lcdPrintf("AFR: none");
}
return;
case LL_MAP:
if (engineConfiguration->hasMapSensor) {
if (hasMapSensor(PASS_ENGINE_PARAMETER_F)) {
lcdPrintf("MAP %f", getMap());
} else {
lcdPrintf("MAP: none");

View File

@ -8,6 +8,10 @@
EXTERN_ENGINE;
bool hasAftSensor(DECLARE_ENGINE_PARAMETER_F) {
return engineConfiguration->afr.hwChannel != EFI_ADC_NONE;
}
float getAfr(DECLARE_ENGINE_PARAMETER_F) {
afr_sensor_s * sensor = &engineConfiguration->afr;

View File

@ -15,6 +15,7 @@
#include "engine_configuration.h"
float getAfr(DECLARE_ENGINE_PARAMETER_F);
bool hasAftSensor(DECLARE_ENGINE_PARAMETER_F);
void setEgoSensor(ego_sensor_e type DECLARE_ENGINE_PARAMETER_S);
#endif

View File

@ -134,7 +134,11 @@ float getRawMap(DECLARE_ENGINE_PARAMETER_F) {
}
bool hasBaroSensor(DECLARE_ENGINE_PARAMETER_F) {
return engineConfiguration->hasBaroSensor && engineConfiguration->baroSensor.hwChannel != EFI_ADC_NONE;
return engineConfiguration->baroSensor.hwChannel != EFI_ADC_NONE;
}
bool hasMapSensor(DECLARE_ENGINE_PARAMETER_F) {
return engineConfiguration->map.sensor.hwChannel != EFI_ADC_NONE;
}
float getBaroPressure(DECLARE_ENGINE_PARAMETER_F) {

View File

@ -15,6 +15,8 @@ void initMapDecoder(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S);
float getRawMap(DECLARE_ENGINE_PARAMETER_F);
float getBaroPressure(DECLARE_ENGINE_PARAMETER_F);
bool hasBaroSensor(DECLARE_ENGINE_PARAMETER_F);
bool hasMapSensor(DECLARE_ENGINE_PARAMETER_F);
/**
* @return MAP value averaged within a window of measurement
*/

View File

@ -103,11 +103,15 @@ bool isValidIntakeAirTemperature(float temperature) {
return !cisnan(temperature) && temperature > -50 && temperature < 100;
}
bool hasCltSensor(DECLARE_ENGINE_PARAMETER_F) {
return engineConfiguration->clt.adcChannel != EFI_ADC_NONE;
}
/**
* @return coolant temperature, in Celsius
*/
float getCoolantTemperature(DECLARE_ENGINE_PARAMETER_F) {
if (engineConfiguration->clt.adcChannel == EFI_ADC_NONE) {
if (!hasCltSensor(PASS_ENGINE_PARAMETER_F)) {
return NO_CLT_SENSOR_TEMPERATURE;
}
float temperature = getTemperatureC(&engineConfiguration->clt, &engine->engineState.cltCurve);
@ -173,11 +177,15 @@ static void prepareThermistorCurve(thermistor_conf_s *tc, thermistor_curve_s * c
#endif
}
bool hasIatSensor(DECLARE_ENGINE_PARAMETER_F) {
return engineConfiguration->iat.adcChannel != EFI_ADC_NONE;
}
/**
* @return Celsius value
*/
float getIntakeAirTemperature(DECLARE_ENGINE_PARAMETER_F) {
if (engineConfiguration->iat.adcChannel == EFI_ADC_NONE) {
if (!hasIatSensor(PASS_ENGINE_PARAMETER_F)) {
return NO_IAT_SENSOR_TEMPERATURE;
}
float temperature = getTemperatureC(&engineConfiguration->iat, &engine->engineState.iatCurve);

View File

@ -38,6 +38,8 @@ float getCoolantTemperature(DECLARE_ENGINE_PARAMETER_F);
bool isValidCoolantTemperature(float temperature);
float getIntakeAirTemperature(DECLARE_ENGINE_PARAMETER_F);
bool isValidIntakeAirTemperature(float temperature);
bool hasIatSensor(DECLARE_ENGINE_PARAMETER_F);
bool hasCltSensor(DECLARE_ENGINE_PARAMETER_F);
void setThermistorConfiguration(ThermistorConf * tc, float temp1, float r1, float temp2, float r2, float temp3,
float r3);

View File

@ -117,6 +117,10 @@ percent_t getPedalPosition(DECLARE_ENGINE_PARAMETER_F) {
return maxF(0, minF(100, result));
}
bool hasTpsSensor(DECLARE_ENGINE_PARAMETER_F) {
return engineConfiguration->tpsAdcChannel != EFI_ADC_NONE;
}
percent_t getTPS(DECLARE_ENGINE_PARAMETER_F) {
if (!engineConfiguration->hasTpsSensor)
return NO_TPS_MAGIC_VALUE;

View File

@ -24,6 +24,7 @@ percent_t getPedalPosition(DECLARE_ENGINE_PARAMETER_F);
* @return Current TPS position, percent of WOT. 0 means idle and 100 means Wide Open Throttle
*/
percent_t getTPS(DECLARE_ENGINE_PARAMETER_F);
bool hasTpsSensor(DECLARE_ENGINE_PARAMETER_F);
int convertVoltageTo10bitADC(float voltage);
int getTPS12bitAdc(DECLARE_ENGINE_PARAMETER_F);
float getTPSVoltage(DECLARE_ENGINE_PARAMETER_F);

View File

@ -381,7 +381,7 @@ struct afr_sensor_s
end_struct
afr_sensor_s afr;@see hasAfrSensor
afr_sensor_s afr
adc_channel_e pedalPositionChannel;
@ -579,21 +579,21 @@ end_struct
custom le_formula_t 200 array, U08, @OFFSET@, [200],"char", 1, 0, 0.0, 3.0, 2
board_configuration_s bc;
bit hasMapSensor;@see isMapAveragingEnabled
bit hasIatSensor
bit hasBaroSensor
bit hasAfrSensor
bit unusedBit__4
bit unusedBit__1
bit unusedBit__5
bit unusedBit__6
bit useConstantDwellDuringCranking
bit isEngineChartEnabled;This options enables data for 'engine sniffer' tab in console, which comes at some CPU price
bit isCanEnabled
bit hasCltSensor
bit unusedBit__2
bit canReadEnabled
bit canWriteEnabled
bit hasVehicleSpeedSensor
bit isJoystickEnabled
bit isGpsEnabled
bit isAlternatorControlEnabled
bit hasMafSensor;See mafAdcChannel
bit unusedBit__3
bit hasTpsSensor
bit cutFuelOnHardLimit
bit cutSparkOnHardLimit

View File

@ -42,7 +42,7 @@ enable2ndByteCanID = false
; see PAGE_0_SIZE in C source code
; CONFIG_DEFINITION_START
; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Dec 17 08:49:17 EST 2016
; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Dec 17 10:16:55 EST 2016
pageSize = 16376
page = 1
@ -423,8 +423,8 @@ page = 1
frequencyReportingMapInputPin = bits, U32, 1484, [0:6], "INVALID", "INVALID", "PA2", "PA3", "INVALID", "PA5", "INVALID", "INVALID", "PA8", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PC6", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PE5", "INVALID", "PE7", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "NONE", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
unusedBit__4 = bits, U32, 1488, [0:0], "false", "true"
unusedBit__1 = bits, U32, 1488, [1:1], "false", "true"
hasBaroSensor = bits, U32, 1488, [2:2], "false", "true"
hasAfrSensor = bits, U32, 1488, [3:3], "false", "true"
unusedBit__5 = bits, U32, 1488, [2:2], "false", "true"
unusedBit__6 = bits, U32, 1488, [3:3], "false", "true"
useConstantDwellDuringCranking= bits, U32, 1488, [4:4], "false", "true"
isEngineChartEnabled = bits, U32, 1488, [5:5], "false", "true"
isCanEnabled = bits, U32, 1488, [6:6], "false", "true"

View File

@ -1,6 +1,6 @@
package com.rusefi.config;
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Dec 17 08:49:17 EST 2016
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Dec 17 10:16:55 EST 2016
public class Fields {
public static final int LE_COMMAND_LENGTH = 200;
public static final int FSIO_ADC_COUNT = 4;
@ -621,8 +621,8 @@ public class Fields {
public static final int frequencyReportingMapInputPin_offset = 1484;
public static final int unusedBit__4_offset = 1488;
public static final int unusedBit__1_offset = 1488;
public static final int hasBaroSensor_offset = 1488;
public static final int hasAfrSensor_offset = 1488;
public static final int unusedBit__5_offset = 1488;
public static final int unusedBit__6_offset = 1488;
public static final int useConstantDwellDuringCranking_offset = 1488;
public static final int isEngineChartEnabled_offset = 1488;
public static final int isCanEnabled_offset = 1488;
@ -1354,8 +1354,8 @@ public class Fields {
public static final Field FREQUENCYREPORTINGMAPINPUTPIN = Field.create("FREQUENCYREPORTINGMAPINPUTPIN", 1484, FieldType.INT, brain_input_pin_e);
public static final Field UNUSEDBIT__4 = Field.create("UNUSEDBIT__4", 1488, FieldType.BIT, 0);
public static final Field UNUSEDBIT__1 = Field.create("UNUSEDBIT__1", 1488, FieldType.BIT, 1);
public static final Field HASBAROSENSOR = Field.create("HASBAROSENSOR", 1488, FieldType.BIT, 2);
public static final Field HASAFRSENSOR = Field.create("HASAFRSENSOR", 1488, FieldType.BIT, 3);
public static final Field UNUSEDBIT__5 = Field.create("UNUSEDBIT__5", 1488, FieldType.BIT, 2);
public static final Field UNUSEDBIT__6 = Field.create("UNUSEDBIT__6", 1488, FieldType.BIT, 3);
public static final Field USECONSTANTDWELLDURINGCRANKING = Field.create("USECONSTANTDWELLDURINGCRANKING", 1488, FieldType.BIT, 4);
public static final Field ISENGINECHARTENABLED = Field.create("ISENGINECHARTENABLED", 1488, FieldType.BIT, 5);
public static final Field ISCANENABLED = Field.create("ISCANENABLED", 1488, FieldType.BIT, 6);

View File

@ -31,10 +31,10 @@ void testIdleController(void) {
assertEqualsM("#1", 60.0, is.getIdle(900, time PASS_ENGINE_PARAMETER));
time += 2000;
assertEqualsM("#2", 60.5, is.getIdle(900, time PASS_ENGINE_PARAMETER));
assertEqualsM("idle#2", 60.0, is.getIdle(900, time PASS_ENGINE_PARAMETER));
time += 2000;
assertEqualsM("#3", 60.6, is.getIdle(1050, time PASS_ENGINE_PARAMETER));
assertEqualsM("idke#3", 60.0, is.getIdle(1050, time PASS_ENGINE_PARAMETER));
}
void testPidController(void) {

View File

@ -254,10 +254,10 @@ void testStartupFuelPumping(void) {
mockTps = TPS_TS_CONVERSION * 3;
sf.update(PASS_ENGINE_PARAMETER_F);
assertEqualsM("pc#2", 1, sf.pumpsCounter);
assertEqualsM("pumpsCounter#2", 2, sf.pumpsCounter);
sf.update(PASS_ENGINE_PARAMETER_F);
assertEqualsM("pc#3", 1, sf.pumpsCounter);
assertEqualsM("pc#3", 3, sf.pumpsCounter);
engine->rpmCalculator.mockRpm = 10;
sf.update(PASS_ENGINE_PARAMETER_F);
@ -270,11 +270,11 @@ void testStartupFuelPumping(void) {
mockTps = TPS_TS_CONVERSION * 3;
sf.update(PASS_ENGINE_PARAMETER_F);
assertEqualsM("pc#6", 1, sf.pumpsCounter);
assertEqualsM("pc#6", 2, sf.pumpsCounter);
mockTps = TPS_TS_CONVERSION * 7;
sf.update(PASS_ENGINE_PARAMETER_F);
assertEqualsM("pc#7", 2, sf.pumpsCounter);
assertEqualsM("pc#7", 3, sf.pumpsCounter);
}
static void assertREquals(void *expected, void *actual) {
@ -902,7 +902,7 @@ void testFuelSchedulerBug299smallAndMedium(void) {
timeNow += MS2US(20);
assertEqualsM("executed #06", 4, schedulingQueue.executeAll(timeNow));
assertEqualsM("qs#06", 1, schedulingQueue.size());
assertInjectors("#2", 1, 0);
assertInjectors("inj#2", 1, 0);
eth.firePrimaryTriggerRise();
assertEqualsM("Queue.size#03", 5, schedulingQueue.size());
@ -1231,7 +1231,7 @@ void testMissedSpark299(void) {
engineConfiguration->isIgnitionEnabled = true;
engineConfiguration->isInjectionEnabled = false;
assertEqualsM("warningCounter#0", 2, warningCounter);
assertEqualsM("warningCounter#0", 4, warningCounter);
timeNow += MS2US(20);
eth.firePrimaryTriggerRise();
@ -1302,5 +1302,5 @@ void testMissedSpark299(void) {
eth.firePrimaryTriggerFall();
schedulingQueue.executeAll(timeNow);
assertEqualsM("warningCounter#1", 3, warningCounter);
assertEqualsM("warningCounter#1", 5, warningCounter);
}