This commit is contained in:
Josh Stewart 2020-04-03 14:51:34 +11:00
commit 2a32600936
7 changed files with 34 additions and 15 deletions

View File

@ -335,7 +335,8 @@ page = 1
injAngRPM = array, U08, 95, [4], "RPM" 100, 0.0, 100, 10000, 0
idleTaperTime = scalar, U08, 99, "S", 0.1, 0.0, 0.0, 25.5, 1
unused2-95 = array, U08, 100, [28], "%", 1.0, 0.0, 0.0, 255, 0
dfcoDelay = scalar, U08, 100, "S", 0.1, 0.0, 0.0, 25.5, 1
unused2-95 = array, U08, 101, [27], "%", 1.0, 0.0, 0.0, 255, 0
;Page 2 is the fuel map and axis bins only
page = 2
@ -1128,9 +1129,9 @@ page = 11
defaultValue = sparkDur, 1.0
defaultValue = fixAngEnable,0
defaultValue = n2o_enable, 0
defaultValue = speeduino_tsCanId, 0
defaultValue = true_address, 256
defaultValue = realtime_base_address, 336
defaultValue = speeduino_tsCanId, 0
defaultValue = true_address, 256
defaultValue = realtime_base_address, 336
defaultValue = VVTasOnOff, 0
defaultValue = stagingEnabled, 0
defaultValue = lnchCtrlTPS, 0
@ -1139,11 +1140,12 @@ page = 11
defaultValue = aeTaperMin, 1000
defaultValue = aeTaperMax, 5000
defaultValue = aeMode, 0 ;Set aeMode to TPS
defaultValue = batVoltCorrect, 0
defaultValue = batVoltCorrect, 0
defaultValue = legacyMAP, 0
defaultValue = battVCorMode, 1
defaultValue = idleAdvEnabled, 0 ;Idle advance control turned off
defaultValue = aseTsnDelay, 0.0
defaultValue = dfcoDelay, 0.1
defaultValue = idleTaperTime, 1.0
;Default pins
@ -1399,6 +1401,7 @@ menuDialog = main
FixAng = "Timing will be locked at this value if the above is enabled"
crankRPM = "The cranking RPM threshold. When RPM is lower than this value (and above 0) the system will be considered to be cranking"
tpsflood = "Keep throttle over this value to disable the priming pulse and cranking fuel. Used to prevent flood or clear already flooded engine"
fanInv = ""
fanHyster = "The number of degrees of hysteresis to be used in controlling the fan. Recommended values are between 2 and 5"
@ -1432,6 +1435,7 @@ menuDialog = main
dfcoRPM = "The RPM above which DFCO will be active. Typically set a few hundred RPM above maximum idle speed"
dfcoHyster = "Hysteresis for DFCO RPM. 200-300 RPM is typical for this, however a higher value may be needed if the RPM is fluctuating around the cutout speed"
dfcoTPSThresh= "The TPS value below which DFCO will be active. Typical value is 5%-10%, but higher may be needed if TPS signal is noisy"
dfcoDelay = "Delay for activate DFCO."
launchPin = "The ARDUINO pin that the clutch switch is connected to. This is NOT the pin on the connector, but the pin it relates to on the arduino"
launchHiLo = "Whether the signal is High or Low when the clutch pedal is engaged. For a ground switching input (Most clutch switches), this should be LOW"
@ -1737,9 +1741,10 @@ menuDialog = main
dialog = accelEnrichments_south, "Decelleration Fuel Cutoff (DFCO)"
field = "Enabled", dfcoEnabled
field = "TPS Threshold", dfcoTPSThresh, { dfcoEnabled }
field = "Cutoff RPM", dfcoRPM, { dfcoEnabled }
field = "RPM Hysteresis", dfcoHyster, { dfcoEnabled }
field = "TPS Threshold", dfcoTPSThresh, { dfcoEnabled }
field = "Cutoff delay", dfcoDelay, { dfcoEnabled }
field = "Cutoff RPM", dfcoRPM, { dfcoEnabled }
field = "RPM Hysteresis", dfcoHyster, { dfcoEnabled }
dialog = accelEnrichments_north_south, ""
liveGraph = pump_ae_Graph, "AE Graph"

View File

@ -42,5 +42,6 @@ extern byte lastKnockCount;
extern int16_t knockWindowMin; //The current minimum crank angle for a knock pulse to be valid
extern int16_t knockWindowMax;//The current maximum crank angle for a knock pulse to be valid
extern byte aseTsnStart;
extern uint16_t dfcoStart;
#endif // CORRECTIONS_H

View File

@ -30,6 +30,7 @@ byte lastKnockCount;
int16_t knockWindowMin; //The current minimum crank angle for a knock pulse to be valid
int16_t knockWindowMax;//The current maximum crank angle for a knock pulse to be valid
byte aseTsnStart;
uint16_t dfcoStart;
void initialiseCorrections()
{
@ -428,8 +429,16 @@ bool correctionDFCO()
bool DFCOValue = false;
if ( configPage2.dfcoEnabled == 1 )
{
if ( bitRead(currentStatus.status1, BIT_STATUS1_DFCO) == 1 ) { DFCOValue = ( currentStatus.RPM > ( configPage4.dfcoRPM * 10) ) && ( currentStatus.TPS < configPage4.dfcoTPSThresh ); }
else { DFCOValue = ( currentStatus.RPM > (unsigned int)( (configPage4.dfcoRPM * 10) + configPage4.dfcoHyster) ) && ( currentStatus.TPS < configPage4.dfcoTPSThresh ); }
if ( bitRead(currentStatus.status1, BIT_STATUS1_DFCO) == 1 ) {
DFCOValue = ( currentStatus.RPM > ( configPage4.dfcoRPM * 10) ) && ( currentStatus.TPS < configPage4.dfcoTPSThresh );
if ( DFCOValue == false) { dfcoStart = 0; }
}
else {
if ( dfcoStart == 0 ) { dfcoStart = runSecsX10; }
if ( ( currentStatus.RPM > (unsigned int)( (configPage4.dfcoRPM * 10) + configPage4.dfcoHyster) ) && ( currentStatus.TPS < configPage4.dfcoTPSThresh ) && ( (runSecsX10 - dfcoStart) > configPage2.dfcoDelay ) ){
DFCOValue = true;
}
}
}
return DFCOValue;
}

View File

@ -642,8 +642,9 @@ struct config2 {
byte injAngRPM[4];
byte idleTaperTime;
byte dfcoDelay;
byte unused2_95[28];
byte unused2_95[27];
#if defined(CORE_AVR)
};

View File

@ -1094,8 +1094,9 @@ void initialiseAll()
interrupts();
//Perform the priming pulses. Set these to run at an arbitrary time in the future (100us). The prime pulse value is in ms*10, so need to multiple by 100 to get to uS
readCLT(false); // Need to read coolant temp to make priming pulsewidth work correctly. The false here disables use of the filter
readTPS(false); // Need to read tps to detect flood clear state
unsigned long primingValue = table2D_getValue(&PrimingPulseTable, currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET);
if(primingValue > 0)
if((primingValue > 0) && (currentStatus.TPS < configPage4.floodClear))
{
if(channel1InjEnabled == true) { setFuelSchedule1(100, (primingValue * 100 * 5)); } //to achieve long enough priming pulses, the values in tunerstudio are divided by 0.5 instead of 0.1, so multiplier of 5 is required.
if(channel2InjEnabled == true) { setFuelSchedule2(100, (primingValue * 100 * 5)); }

View File

@ -58,7 +58,7 @@ byte cltErrorCount = 0;
static inline void instanteneousMAPReading() __attribute__((always_inline));
static inline void readMAP() __attribute__((always_inline));
void initialiseADC();
void readTPS();
void readTPS(bool=true); //Allows the option to override the use of the filter
void readO2_2();
void flexPulse();
uint16_t readAuxanalog(uint8_t analogPin);

View File

@ -321,7 +321,7 @@ static inline void readMAP()
}
}
void readTPS()
void readTPS(bool useFilter)
{
TPSlast = currentStatus.TPS;
TPSlast_time = TPS_time;
@ -331,7 +331,9 @@ void readTPS()
analogRead(pinTPS);
byte tempTPS = fastMap1023toX(analogRead(pinTPS), 255); //Get the current raw TPS ADC value and map it into a byte
#endif
currentStatus.tpsADC = ADC_FILTER(tempTPS, configPage4.ADCFILTER_TPS, currentStatus.tpsADC);
//The use of the filter can be overridden if required. This is used on startup to disable priming pulse if flood clear is wanted
if(useFilter == true) { currentStatus.tpsADC = ADC_FILTER(tempTPS, configPage4.ADCFILTER_TPS, currentStatus.tpsADC); }
else { currentStatus.tpsADC = tempTPS; }
//currentStatus.tpsADC = ADC_FILTER(tempTPS, 128, currentStatus.tpsADC);
byte tempADC = currentStatus.tpsADC; //The tempADC value is used in order to allow TunerStudio to recover and redo the TPS calibration if this somehow gets corrupted