Minor changes to multiple decoders

This commit is contained in:
Josh Stewart 2017-08-03 00:35:10 +10:00
parent 6727b0a750
commit 32b5c4684e
1 changed files with 16 additions and 6 deletions

View File

@ -810,7 +810,7 @@ uint16_t getRPM_4G63()
//Because these signals aren't even (Alternating 110 and 70 degrees), this needs a special function
if(currentStatus.hasSync == true)
{
if( currentStatus.RPM < (unsigned int)(configPage2.crankRPM * 100) )
if( currentStatus.RPM < ((unsigned int)configPage2.crankRPM * 100) )
{
int tempToothAngle;
unsigned long toothTime;
@ -823,6 +823,8 @@ uint16_t getRPM_4G63()
interrupts();
toothTime = toothTime * 36;
tempRPM = ((unsigned long)tempToothAngle * 6000000UL) / toothTime;
revolutionTime = (10UL * toothTime) / tempToothAngle;
}
}
else { tempRPM = stdGetRPM(); }
@ -1096,7 +1098,7 @@ void triggerPri_Audi135()
{
curTime = micros();
curGap = curTime - toothSystemLastToothTime;
if ( curGap > triggerFilterTime )
if ( (curGap > triggerFilterTime) || (currentStatus.startRevolutions == 0) )
{
toothSystemCount++;
@ -1865,7 +1867,7 @@ void triggerPri_Subaru67()
toothLastMinusOneToothTime = toothLastToothTime;
toothLastToothTime = curTime;
if ( (currentStatus.hasSync == false) || configPage2.useResync)
if ( (currentStatus.hasSync == false) || configPage2.useResync || (currentStatus.startRevolutions == 0) )
{
//Sync is determined by counting the number of cam teeth that have passed between the crank teeth
switch(secondaryToothCount)
@ -1935,7 +1937,15 @@ void triggerSec_Subaru67()
uint16_t getRPM_Subaru67()
{
//if(currentStatus.RPM < configPage2.crankRPM) { return crankingGetRPM(configPage2.triggerTeeth); }
return stdGetRPM();
uint16_t tempRPM = 0;
if(currentStatus.startRevolutions > 0)
{
//As the tooth count is over 720 degrees, we need to double the RPM value and halve the revolution time
tempRPM = stdGetRPM() << 1;
revolutionTime = revolutionTime >> 1; //Revolution time has to be divided by 2 as otherwise it would be over 720 degrees (triggerActualTeeth = nCylinders)
}
return tempRPM;
}
int getCrankAngle_Subaru67(int timePerDegree)
@ -2011,7 +2021,7 @@ void triggerPri_Daihatsu()
curTime = micros();
curGap = curTime - toothLastToothTime;
//if ( curGap >= triggerFilterTime )
//if ( curGap >= triggerFilterTime || (currentStatus.startRevolutions == 0 )
{
toothSystemCount++;