mirror of https://github.com/rusefi/speeduino.git
Remove float multiplication from trigger interrupt
This commit is contained in:
parent
0fd819fe3b
commit
41d424fca6
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue