All base work on EMAP sensor configuration and reading
This commit is contained in:
parent
d473e00ce4
commit
4b5f580649
|
@ -251,7 +251,9 @@ page = 2
|
|||
|
||||
baroMin = scalar, S08, 64, "kpa", 1.0, 0.0, -100, 127.0, 0
|
||||
baroMax = scalar, U16, 65, "kpa", 1.0, 0.0, 0.0, 25500, 0
|
||||
unused2-67 = array, U08, 67, [60], "%", 1.0, 0.0, 0.0, 255, 0
|
||||
EMAPMin = scalar, S08, 67, "kpa", 1.0, 0.0, -100, 127.0, 0
|
||||
EMAPMax = scalar, U16, 68, "kpa", 1.0, 0.0, 0.0, 25500, 0
|
||||
unused2-67 = array, U08, 70, [57], "%", 1.0, 0.0, 0.0, 255, 0
|
||||
|
||||
|
||||
;--------------------------------------------------
|
||||
|
@ -398,7 +400,7 @@ page = 6
|
|||
boostMode = bits, U08, 13, [7:7], "Simple", "Full"
|
||||
boostPin = bits, U08, 14, [0:5], "Board Default", "INVALID", "INVALID", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
|
||||
VVTasOnOff = bits, U08, 14, [6:6], "No", "Yes"
|
||||
unused6-14f = bits, U08, 14, [7:7], "ONE", "INVALID"
|
||||
useEMAP = bits, U08, 14, [7:7], "No", "Yes"
|
||||
brvBins = array, U08, 15, [6], "V", 0.1, 0, 6, 24, 1 ; Bins for the battery reference voltage
|
||||
injBatRates = array, U08, 21, [6], "%", 1, 0, 0, 255, 0 ;Values for injector pulsewidth vs voltage
|
||||
#if CELSIUS
|
||||
|
@ -713,10 +715,7 @@ page = 10
|
|||
rotaryType = bits , U08, 8, [0:1], "FC", "FD", "RX8", "INVALID"
|
||||
stagingEnabled = bits , U08, 8, [2:2], "Off","On"
|
||||
stagingMode = bits , U08, 8, [3:3], "Table","Automatic"
|
||||
unused11-8e = bits , U08, 8, [4:4], "Off","On"
|
||||
unused11-8f = bits , U08, 8, [5:5], "Off","On"
|
||||
unused11-8g = bits , U08, 8, [6:6], "Off","On"
|
||||
unused11-8h = bits , U08, 8, [7:7], "Off","On"
|
||||
EMAPPin = bits, U08, 8, [4:7], "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A8", "A10", "A11", "A12", "A13", "A14", "A15"
|
||||
|
||||
rotarySplitValues = array, U08, 9, [8], "degrees", 1.0, 0.0, 0.0, 40, 0
|
||||
#if SPEED_DENSITY
|
||||
|
@ -770,6 +769,7 @@ page = 10
|
|||
requiresPowerCycle = iacCLminDuty
|
||||
requiresPowerCycle = iacCLmaxDuty
|
||||
requiresPowerCycle = useExtBaro
|
||||
requiresPowerCycle = useEMAP
|
||||
requiresPowerCycle = baroPin
|
||||
requiresPowerCycle = rotaryType
|
||||
requiresPowerCycle = stagedInjSizePri
|
||||
|
@ -792,8 +792,11 @@ page = 10
|
|||
defaultValue = dutyLim, 100
|
||||
defaultValue = mapMin, 10
|
||||
defaultValue = mapMax, 260
|
||||
defaultValue = baroMin, 10
|
||||
defaultValue = baroMin 10
|
||||
defaultValue = baroMax, 260
|
||||
defaultValue = useEMAP, 0
|
||||
defaultValue = EMAPMin, 10
|
||||
defaultValue = EMAPMax, 260
|
||||
defaultValue = fpPrime, 3
|
||||
defaultValue = TrigFilter, 0
|
||||
defaultValue = ignCranklock,0
|
||||
|
@ -932,8 +935,8 @@ menuDialog = main
|
|||
#endif
|
||||
|
||||
menuDialog = main
|
||||
menu = "T&ools"
|
||||
subMenu = mapCal, "Calibrate MAP"
|
||||
menu = "Tools"
|
||||
subMenu = mapCal, "Calibrate Pressure Sensors"
|
||||
subMenu = std_ms2gentherm, "Calibrate Temperature Sensors", 0
|
||||
subMenu = std_ms2geno2, "Calibrate AFR Sensor", 0
|
||||
|
||||
|
@ -1465,6 +1468,25 @@ menuDialog = main
|
|||
field = "kPa At 0.0 Volts", baroMin, { useExtBaro }
|
||||
field = "kPa At 5.0 Volts", baroMax, { useExtBaro }
|
||||
|
||||
field = "#EMAP Sensor"
|
||||
field = "Use EMAP sensor", useEMAP
|
||||
field = "Analog pin to use for ext. Baro sensor", EMAPPin, { useEMAP }
|
||||
|
||||
settingSelector = "Common Pressure Sensors", { useEMAP }
|
||||
settingOption = "MPX4115", EMAPMin=10, EMAPMax=118 ; https://www.nxp.com/docs/en/data-sheet/MPX4115.pdf
|
||||
settingOption = "MPX4250", EMAPMin=10, EMAPMax=260 ; https://www.nxp.com/docs/en/data-sheet/MPX4250A.pdf Vout = VCC x (P x 0.004 – 0.04)
|
||||
settingOption = "GM 1-BAR", EMAPMin=10, EMAPMax=105 ; https://speeduino.com/wiki/index.php/File:GM_Table.gif
|
||||
settingOption = "GM 2-BAR", EMAPMin=9, EMAPMax=208 ; https://speeduino.com/wiki/index.php/File:GM_Table.gif
|
||||
settingOption = "GM 3-BAR", EMAPMin=1, EMAPMax=315 ; VOUT = VS*(.00318*P-.00353)
|
||||
settingOption = "MPXH6300", EMAPMin=1, EMAPMax=315 ; https://www.nxp.com/docs/en/data-sheet/MPXH6300A.pdf VOUT = VS*(.00318*P-.00353)
|
||||
settingOption = "MPX5700", EMAPMin=-31, EMAPMax=746 ; https://www.nxp.com/docs/en/data-sheet/MPX5700.pdf Vout = VS*(0.0012858*P+0.04)
|
||||
settingOption = "MPX6400", EMAPMin=3, EMAPMax=416 ; https://www.nxp.com/docs/en/data-sheet/MPXH6400A.pdf VOUT = VS x (0.002421xP–0.00842)
|
||||
settingOption = "Denso 079800", EMAPMin=0, EMAPMax=173 ; http://speeduino.com/forum/viewtopic.php?f=18&t=510&p=7023#p7021
|
||||
settingOption = "VW/Audi/Porsche 250kPa", EMAPMin=26, EMAPMax=250 ; http://speeduino.com/forum/viewtopic.php?p=17502#p17502
|
||||
|
||||
field = "kPa At 0.0 Volts", EMAPMin, { useEMAP }
|
||||
field = "kPa At 5.0 Volts", EMAPMax, { useEMAP }
|
||||
|
||||
dialog = boostSettings, "Boost Control"
|
||||
topicHelp = "http://speeduino.com/wiki/index.php/Boost_Control"
|
||||
field = "Boost Control Enabled", boostEnabled
|
||||
|
|
|
@ -310,10 +310,7 @@ static inline byte correctionAFRClosedLoop()
|
|||
currentStatus.afrTarget = currentStatus.O2; //Catch all incase the below doesn't run. This prevents the Include AFR option from doing crazy things if the AFR target conditions aren't met. This value is changed again below if all conditions are met.
|
||||
|
||||
//Determine whether the Y axis of the AFR target table tshould be MAP (Speed-Density) or TPS (Alpha-N)
|
||||
byte yValue;
|
||||
if (configPage2.algorithm == 0) { yValue = currentStatus.MAP; }
|
||||
else { yValue = currentStatus.TPS; }
|
||||
currentStatus.afrTarget = get3DTableValue(&afrTable, yValue, currentStatus.RPM); //Perform the target lookup
|
||||
currentStatus.afrTarget = get3DTableValue(&afrTable, currentStatus.fuelLoad, currentStatus.RPM); //Perform the target lookup
|
||||
|
||||
//Check all other requirements for closed loop adjustments
|
||||
if( (currentStatus.coolant > (int)(configPage6.egoTemp - CALIBRATION_TEMPERATURE_OFFSET)) && (currentStatus.RPM > (unsigned int)(configPage6.egoRPM * 100)) && (currentStatus.TPS < configPage6.egoTPSMax) && (currentStatus.O2 < configPage6.ego_max) && (currentStatus.O2 > configPage6.ego_min) && (currentStatus.runSecs > configPage6.ego_sdelay) )
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
//Define the load algorithm
|
||||
#define LOAD_SOURCE_MAP 0
|
||||
#define LOAD_SOURCE_TPS 1
|
||||
#define LOAD_SOURCE_IMAPEMAP 2
|
||||
|
||||
//Define bit positions within engine virable
|
||||
#define BIT_ENGINE_RUN 0 // Engine running
|
||||
|
@ -294,6 +295,8 @@ struct statuses {
|
|||
int mapADC;
|
||||
int baroADC;
|
||||
long MAP; //Has to be a long for PID calcs (Boost control)
|
||||
int16_t EMAP;
|
||||
int16_t EMAPADC;
|
||||
byte baro; //Barometric pressure is simply the inital MAP reading, taken before the engine is running. Alternatively, can be taken from an external sensor
|
||||
byte TPS; //The current TPS reading (0% - 100%)
|
||||
byte TPSlast; //The previous TPS reading
|
||||
|
@ -363,6 +366,7 @@ struct statuses {
|
|||
int16_t flexBoostCorrection; //Amount of boost added based on flex
|
||||
byte nSquirts;
|
||||
byte nChannels; //Number of fuel and ignition channels
|
||||
int16_t fuelLoad;
|
||||
|
||||
//Helpful bitwise operations:
|
||||
//Useful reference: http://playground.arduino.cc/Code/BitMath
|
||||
|
@ -465,7 +469,9 @@ struct config2 {
|
|||
int8_t baroMin; //Must be signed
|
||||
uint16_t baroMax;
|
||||
|
||||
byte unused1_64[61];
|
||||
int8_t EMAPMin; //Must be signed
|
||||
uint16_t EMAPMax;
|
||||
byte unused1_70[58];
|
||||
|
||||
#if defined(CORE_AVR)
|
||||
};
|
||||
|
@ -566,7 +572,7 @@ struct config6 {
|
|||
byte boostMode : 1; //Simple of full boost contrl
|
||||
byte boostPin : 6;
|
||||
byte VVTasOnOff : 1; //Whether or not to use the VVT table as an on/off map
|
||||
byte unused6_14 : 1;
|
||||
byte useEMAP : 1;
|
||||
byte voltageCorrectionBins[6]; //X axis bins for voltage correction tables
|
||||
byte injVoltageCorrectionValues[6]; //Correction table for injector PW vs battery voltage
|
||||
byte airDenBins[9];
|
||||
|
@ -696,7 +702,7 @@ struct config10 {
|
|||
byte rotaryType : 2;
|
||||
byte stagingEnabled : 1;
|
||||
byte stagingMode : 1;
|
||||
byte unused11_8e : 4;
|
||||
byte EMAPPin : 4;
|
||||
|
||||
byte rotarySplitValues[8];
|
||||
byte rotarySplitBins[8];
|
||||
|
@ -744,6 +750,7 @@ byte pinTrigger2; //The Cam Sensor pin
|
|||
byte pinTrigger3; //the 2nd cam sensor pin
|
||||
byte pinTPS;//TPS input pin
|
||||
byte pinMAP; //MAP sensor pin
|
||||
byte pinEMAP; //EMAP sensor pin
|
||||
byte pinMAP2; //2nd MAP sensor (Currently unused)
|
||||
byte pinIAT; //IAT sensor pin
|
||||
byte pinCLT; //CLS sensor pin
|
||||
|
|
|
@ -27,6 +27,7 @@ volatile byte flexCounter = 0;
|
|||
volatile int AnChannel[15];
|
||||
|
||||
unsigned long MAPrunningValue; //Used for tracking either the total of all MAP readings in this cycle (Event average) or the lowest value detected in this cycle (event minimum)
|
||||
unsigned long EMAPrunningValue; //As above but for EMAP
|
||||
unsigned int MAPcount; //Number of samples taken in the current MAP cycle
|
||||
uint16_t MAPcurRev; //Tracks which revolution we're sampling on
|
||||
|
||||
|
|
|
@ -103,11 +103,24 @@ static inline void readMAP()
|
|||
{
|
||||
currentStatus.mapADC = ADC_FILTER(tempReading, ADCFILTER_MAP, currentStatus.mapADC);
|
||||
MAPrunningValue += currentStatus.mapADC; //Add the current reading onto the total
|
||||
//Old method (No filter)
|
||||
//MAPrunningValue = MAPrunningValue + (unsigned long)tempReading;
|
||||
MAPcount++;
|
||||
}
|
||||
else { mapErrorCount += 1; }
|
||||
|
||||
//Repeat for EMAP if it's enabled
|
||||
if(configPage6.useEMAP == true)
|
||||
{
|
||||
tempReading = analogRead(pinEMAP);
|
||||
tempReading = analogRead(pinEMAP);
|
||||
|
||||
//Error check
|
||||
if( (tempReading < VALID_MAP_MAX) && (tempReading > VALID_MAP_MIN) )
|
||||
{
|
||||
currentStatus.EMAPADC = ADC_FILTER(tempReading, ADCFILTER_MAP, currentStatus.EMAPADC);
|
||||
EMAPrunningValue += currentStatus.EMAPADC; //Add the current reading onto the total
|
||||
}
|
||||
else { mapErrorCount += 1; }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -117,12 +130,20 @@ static inline void readMAP()
|
|||
{
|
||||
currentStatus.mapADC = ldiv(MAPrunningValue, MAPcount).quot;
|
||||
currentStatus.MAP = fastMap10Bit(currentStatus.mapADC, configPage2.mapMin, configPage2.mapMax); //Get the current MAP value
|
||||
//currentStatus.MAP = fastMap1023toX(currentStatus.mapADC, configPage2.mapMax);
|
||||
if(currentStatus.MAP < 0) { currentStatus.MAP = 0; } //Sanity check
|
||||
|
||||
//If EMAP is enabled, the process is identical to the above
|
||||
if(configPage6.useEMAP == true)
|
||||
{
|
||||
currentStatus.EMAPADC = ldiv(EMAPrunningValue, MAPcount).quot; //Note that the MAP count can be reused here as it will always be the same count.
|
||||
currentStatus.EMAP = fastMap10Bit(currentStatus.EMAPADC, configPage2.EMAPMin, configPage2.EMAPMax);
|
||||
if(currentStatus.EMAP < 0) { currentStatus.EMAP = 0; } //Sanity check
|
||||
}
|
||||
}
|
||||
else { instanteneousMAPReading(); }
|
||||
MAPcurRev = currentStatus.startRevolutions; //Reset the current rev count
|
||||
MAPrunningValue = 0;
|
||||
EMAPrunningValue = 0; //Can reset this even if EMAP not used
|
||||
MAPcount = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1871,13 +1871,20 @@ static inline byte getVE()
|
|||
if (configPage2.algorithm == LOAD_SOURCE_MAP) //Check which fuelling algorithm is being used
|
||||
{
|
||||
//Speed Density
|
||||
tempVE = get3DTableValue(&fuelTable, currentStatus.MAP, currentStatus.RPM); //Perform lookup into fuel map for RPM vs MAP value
|
||||
currentStatus.fuelLoad = currentStatus.MAP;
|
||||
}
|
||||
else
|
||||
else if (configPage2.algorithm == LOAD_SOURCE_TPS)
|
||||
{
|
||||
//Alpha-N
|
||||
tempVE = get3DTableValue(&fuelTable, currentStatus.TPS, currentStatus.RPM); //Perform lookup into fuel map for RPM vs TPS value
|
||||
currentStatus.fuelLoad = currentStatus.TPS;
|
||||
}
|
||||
else if (configPage2.algorithm == LOAD_SOURCE_IMAPEMAP)
|
||||
{
|
||||
//IMAP / EMAP
|
||||
currentStatus.fuelLoad = (currentStatus.MAP * 100) / currentStatus.EMAP;
|
||||
}
|
||||
else { currentStatus.fuelLoad = currentStatus.MAP; } //Fallback position
|
||||
tempVE = get3DTableValue(&fuelTable, currentStatus.fuelLoad, currentStatus.RPM); //Perform lookup into fuel map for RPM vs MAP value
|
||||
|
||||
return tempVE;
|
||||
}
|
||||
|
|
|
@ -659,6 +659,7 @@ void setPinMapping(byte boardID)
|
|||
if ( (configPage6.boostPin != 0) && (configPage6.boostPin < BOARD_NR_GPIO_PINS) ) { pinBoost = pinTranslate(configPage6.boostPin); }
|
||||
if ( (configPage6.vvtPin != 0) && (configPage6.vvtPin < BOARD_NR_GPIO_PINS) ) { pinVVT_1 = pinTranslate(configPage6.vvtPin); }
|
||||
if ( (configPage6.useExtBaro != 0) && (configPage6.baroPin < BOARD_NR_GPIO_PINS) ) { pinBaro = configPage6.baroPin + A0; }
|
||||
if ( (configPage6.useEMAP != 0) && (configPage10.EMAPPin < BOARD_NR_GPIO_PINS) ) { pinEMAP = configPage10.EMAPPin + A0; }
|
||||
|
||||
/* Reset control is a special case. If reset control is enabled, it needs its initial state set BEFORE its pinMode.
|
||||
If that doesn't happen and reset control is in "Serial Command" mode, the Arduino will end up in a reset loop
|
||||
|
|
Loading…
Reference in New Issue