Remove float multiplication from trigger interrupt

This commit is contained in:
Josh Stewart 2013-02-08 09:34:51 +11:00
parent 0fd819fe3b
commit 41d424fca6
1 changed files with 2 additions and 1 deletions

View File

@ -150,7 +150,8 @@ void trigger()
//Begin the missing tooth detection
unsigned long curTime = micros();
//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 ( (curTime - toothLastToothTime) > (1.5 * (toothLastToothTime - toothLastMinusOneToothTime))) { toothCurrentCount = 1; }
//if ( (curTime - toothLastToothTime) > (1.5 * (toothLastToothTime - toothLastMinusOneToothTime))) { toothCurrentCount = 1; }
if ( (curTime - toothLastToothTime) > ((3 * (toothLastToothTime - toothLastMinusOneToothTime))>>1)) { toothCurrentCount = 1; } //Same as above, but uses bitshift instead of multiplying by 1.5
// Update the last few tooth times
toothLastMinusOneToothTime = toothLastToothTime;