Fix 10x error in TAE check

This commit is contained in:
Josh Stewart 2015-01-28 13:04:23 +11:00
parent 8040de56ce
commit 2d9484731a
2 changed files with 4 additions and 2 deletions

View File

@ -69,6 +69,7 @@ When the enrichment is turned on, it runs at that amount for a fixed period of t
byte correctionAccel()
{
//First, check whether the accel. enrichment is already running
if( BIT_CHECK(currentStatus.engine, BIT_ENGINE_ACC) )
{
//If it is currently running, check whether it should still be running or whether it's reached it's end time
@ -83,11 +84,12 @@ byte correctionAccel()
return 100 + currentStatus.TAEamount;
}
//If TAE isn't currently turned on, need to check whether it needs to be turned on
int rateOfChange = ldiv(1000000, (currentLoopTime - previousLoopTime)).quot * (currentStatus.TPS - currentStatus.TPSlast); //This is the % per second that the TPS has moved
currentStatus.tpsDOT = div(rateOfChange, 10).quot; //The TAE bins are divided by 10 in order to allow them to be stored in a byte.
if (rateOfChange > configPage1.tpsThresh)
if (currentStatus.tpsDOT > (configPage1.tpsThresh * 10))
{
BIT_SET(currentStatus.engine, BIT_ENGINE_ACC); //Mark accleration enrichment as active.
currentStatus.TAEamount = table2D_getValue(taeTable, currentStatus.tpsDOT); //Lookup and store the amount of enrichment required

View File

@ -229,7 +229,7 @@ void loop()
//Check for any requets from serial. Serial operations are checked under 2 scenarios:
// 1) Every 64 loops (64 Is more than fast enough for TunerStudio). This function is equivalent to ((loopCount % 64) == 1) but is considerably faster due to not using the mod or division operations
// 2) If the amount of data in the serial buffer is greater than a set threhold (See globals.h). This is to avoid serial buffer overflow when large amounts of data is being sent
if ( ((mainLoopCount & 63) == 1) or (Serial.available() > SERIAL_BUFFER_THRESHOLD))
if ( ((mainLoopCount & 63) == 1) or (Serial.available() > SERIAL_BUFFER_THRESHOLD) )
{
if (Serial.available() > 0)
{