Fixes and performance improvements to TAE
This commit is contained in:
parent
524c7f94f2
commit
a8e7066b41
|
@ -5,8 +5,6 @@ All functions in the gamma file return
|
||||||
#ifndef CORRECTIONS_H
|
#ifndef CORRECTIONS_H
|
||||||
#define CORRECTIONS_H
|
#define CORRECTIONS_H
|
||||||
|
|
||||||
//static byte numCorrections = 2;
|
|
||||||
|
|
||||||
byte correctionsTotal();
|
byte correctionsTotal();
|
||||||
byte correctionWUE(); //Warmup enrichment
|
byte correctionWUE(); //Warmup enrichment
|
||||||
byte correctionASE(); //After Start Enrichment
|
byte correctionASE(); //After Start Enrichment
|
||||||
|
|
|
@ -97,17 +97,21 @@ byte correctionAccel()
|
||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
//Enrichment still needs to keep running. Simply return the total TAE amount
|
//Enrichment still needs to keep running. Simply return the total TAE amount
|
||||||
return 100 + currentStatus.TAEamount;
|
return currentStatus.TAEamount;
|
||||||
}
|
}
|
||||||
|
|
||||||
//If TAE isn't currently turned on, need to check whether it needs to be turned on
|
//Check for deceleration (Deceleration adjustment not yet supported)
|
||||||
int rateOfChange = ldiv(1000000, (currentLoopTime - previousLoopTime)).quot * (currentStatus.TPS - currentStatus.TPSlast); //This is the % per second that the TPS has moved
|
if (currentStatus.TPS < currentStatus.TPSlast) { return 100; }
|
||||||
currentStatus.tpsDOT = divs10(rateOfChange); //The TAE bins are divided by 10 in order to allow them to be stored in a byte.
|
|
||||||
|
|
||||||
if (currentStatus.tpsDOT > (configPage1.tpsThresh * 10))
|
//If TAE isn't currently turned on, need to check whether it needs to be turned on
|
||||||
|
int rateOfChange = ldiv(1000000, (currentStatus.TPS_time - currentStatus.TPSlast_time)).quot * (currentStatus.TPS - currentStatus.TPSlast); //This is the % per second that the TPS has moved
|
||||||
|
//currentStatus.tpsDOT = divs10(rateOfChange); //The TAE bins are divided by 10 in order to allow them to be stored in a byte.
|
||||||
|
currentStatus.tpsDOT = rateOfChange / 10;
|
||||||
|
|
||||||
|
if (rateOfChange > configPage1.tpsThresh)
|
||||||
{
|
{
|
||||||
BIT_SET(currentStatus.engine, BIT_ENGINE_ACC); //Mark accleration enrichment as active.
|
BIT_SET(currentStatus.engine, BIT_ENGINE_ACC); //Mark accleration enrichment as active.
|
||||||
currentStatus.TAEEndTime = micros() + (configPage1.taeTime * 100); //Set the time in the future where the enrichment will be turned off. taeTime is stored as mS * 10, so multiply it by 100 to get it in uS
|
currentStatus.TAEEndTime = micros() + ((unsigned long)configPage1.taeTime * 10000); //Set the time in the future where the enrichment will be turned off. taeTime is stored as mS / 10, so multiply it by 100 to get it in uS
|
||||||
return 100 + table2D_getValue(taeTable, currentStatus.tpsDOT);
|
return 100 + table2D_getValue(taeTable, currentStatus.tpsDOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,8 @@ struct statuses {
|
||||||
byte MAP;
|
byte MAP;
|
||||||
byte TPS; //The current TPS reading (0% - 100%)
|
byte TPS; //The current TPS reading (0% - 100%)
|
||||||
byte TPSlast; //The previous TPS reading
|
byte TPSlast; //The previous TPS reading
|
||||||
|
unsigned long TPS_time; //The time the TPS sample was taken
|
||||||
|
unsigned long TPSlast_time; //The time the previous TPS sample was taken
|
||||||
byte tpsADC; //0-255 byte representation of the TPS
|
byte tpsADC; //0-255 byte representation of the TPS
|
||||||
byte tpsDOT;
|
byte tpsDOT;
|
||||||
byte VE;
|
byte VE;
|
||||||
|
|
|
@ -96,7 +96,7 @@ page = 1
|
||||||
unused97 = scalar, U08, 97, "ms", 0.1, 0.0, 0.0, 25.5, 1
|
unused97 = scalar, U08, 97, "ms", 0.1, 0.0, 0.0, 25.5, 1
|
||||||
taeColdA = scalar, U08, 98, "ms", 0.1, 0.0, 0.0, 25.5, 1
|
taeColdA = scalar, U08, 98, "ms", 0.1, 0.0, 0.0, 25.5, 1
|
||||||
tpsThresh = scalar, U08, 99, "%/s", 1.0, 0.0, 0.0, 255, 0
|
tpsThresh = scalar, U08, 99, "%/s", 1.0, 0.0, 0.0, 255, 0
|
||||||
taeTime = scalar, U08, 100, "ms", 0.1, 0.0, 0.0, 25.5, 1
|
taeTime = scalar, U08, 100, "ms", 10, 0.0, 0.0, 2550, 0
|
||||||
tdePct = scalar, U08, 101, "%", 1.0, 0.0, 0.0, 255, 0
|
tdePct = scalar, U08, 101, "%", 1.0, 0.0, 0.0, 255, 0
|
||||||
unused102 = scalar, U08, 102, "ms", 0.1, 0.0, 0.0, 25.5, 1
|
unused102 = scalar, U08, 102, "ms", 0.1, 0.0, 0.0, 25.5, 1
|
||||||
unused103 = scalar, U08, 103, "ms", 0.1, 0.0, 0.0, 25.5, 1
|
unused103 = scalar, U08, 103, "ms", 0.1, 0.0, 0.0, 25.5, 1
|
||||||
|
@ -902,7 +902,7 @@ help = helpEnrichments, "Enrichments Help"
|
||||||
afrTarget = scalar, U08, 19 "O2", 0.100, 0.000
|
afrTarget = scalar, U08, 19 "O2", 0.100, 0.000
|
||||||
#blank2 = scalar, U08, 20
|
#blank2 = scalar, U08, 20
|
||||||
pulseWidth = scalar, U08, 20, "ms", 0.2, 0.000
|
pulseWidth = scalar, U08, 20, "ms", 0.2, 0.000
|
||||||
TPSdot = scalar, U08, 21, "%/s", 0.100, 0.000
|
TPSdot = scalar, U08, 21, "%/s", 10.00, 0.000
|
||||||
advance = scalar, U08, 22, "deg", 1.000, 0.000
|
advance = scalar, U08, 22, "deg", 1.000, 0.000
|
||||||
tps = scalar, U08, 23, "%", 1.000, 0.000
|
tps = scalar, U08, 23, "%", 1.000, 0.000
|
||||||
loopsPerSecond = scalar, S16, 24, "loops", 1.000, 0.000
|
loopsPerSecond = scalar, S16, 24, "loops", 1.000, 0.000
|
||||||
|
@ -998,7 +998,7 @@ help = helpEnrichments, "Enrichments Help"
|
||||||
entry = warmupEnrich, "Gwarm", int, "%d"
|
entry = warmupEnrich, "Gwarm", int, "%d"
|
||||||
entry = baroCorrection, "Gbaro", int, "%d"
|
entry = baroCorrection, "Gbaro", int, "%d"
|
||||||
entry = gammaEnrich, "Gammae", int, "%d"
|
entry = gammaEnrich, "Gammae", int, "%d"
|
||||||
entry = accDecEnrich, "TPSacc", int, "%d"
|
entry = accelEnrich, "TPSacc", int, "%d"
|
||||||
entry = veCurr, "VE", int, "%d"
|
entry = veCurr, "VE", int, "%d"
|
||||||
entry = pulseWidth, "PW", float, "%.1f"
|
entry = pulseWidth, "PW", float, "%.1f"
|
||||||
entry = afrTarget, "AFR Target", int, "%d"
|
entry = afrTarget, "AFR Target", int, "%d"
|
||||||
|
|
|
@ -277,7 +277,7 @@ void loop()
|
||||||
currentStatus.MAP = map(analogRead(pinMAP), 0, 1023, 10, 255); //Get the current MAP value
|
currentStatus.MAP = map(analogRead(pinMAP), 0, 1023, 10, 255); //Get the current MAP value
|
||||||
|
|
||||||
//TPS setting to be performed every 16 loops (any faster and it can upset the TPSdot sampling time)
|
//TPS setting to be performed every 16 loops (any faster and it can upset the TPSdot sampling time)
|
||||||
if ((mainLoopCount & 15) == 1)
|
if ((mainLoopCount & 31) == 1)
|
||||||
{
|
{
|
||||||
currentStatus.TPSlast = currentStatus.TPS;
|
currentStatus.TPSlast = currentStatus.TPS;
|
||||||
currentStatus.TPSlast_time = currentStatus.TPS_time;
|
currentStatus.TPSlast_time = currentStatus.TPS_time;
|
||||||
|
|
Loading…
Reference in New Issue