Initial introduction of a sync los counter

This commit is contained in:
Josh Stewart 2018-07-24 10:03:40 +10:00
parent b14e2d41f4
commit 0b2cd0d88a
2 changed files with 2 additions and 1 deletions

View File

@ -158,7 +158,7 @@ void triggerPri_missingTooth()
//Begin the missing tooth detection
//If the time between the current tooth and the last is greater than 1.5x the time between the last tooth and the tooth before that, we make the assertion that we must be at the first tooth after the gap
if(configPage4.triggerMissingTeeth == 1) { targetGap = (3 * (toothLastToothTime - toothLastMinusOneToothTime)) >> 1; } //Multiply by 1.5 (Checks for a gap 1.5x greater than the last one) (Uses bitshift to multiply by 3 then divide by 2. Much faster than multiplying by 1.5)
else { targetGap = ((toothLastToothTime - toothLastMinusOneToothTime)) * 2; } //Multiply by 2 (Checks for a gap 2x greater than the last one)
else { targetGap = ((toothLastToothTime - toothLastMinusOneToothTime)) * configPage4.triggerMissingTeeth; } //Multiply by 2 (Checks for a gap 2x greater than the last one)
if( (toothLastToothTime == 0) || (toothLastMinusOneToothTime == 0) ) { curGap = 0; }

View File

@ -387,6 +387,7 @@ struct statuses {
int16_t fuelLoad;
int16_t ignLoad;
bool fuelPumpOn; //The current status of the fuel pump
byte syncLossCounter;
//Helpful bitwise operations:
//Useful reference: http://playground.arduino.cc/Code/BitMath