From 80471100be4d41a103e054f03031c18aa631d752 Mon Sep 17 00:00:00 2001 From: Josh Stewart Date: Tue, 4 Jul 2017 16:33:41 +1000 Subject: [PATCH] Tweak to potentially avoid spikes during cranking on some decoders --- speeduino/decoders.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/speeduino/decoders.ino b/speeduino/decoders.ino index bc181881..37124c8e 100644 --- a/speeduino/decoders.ino +++ b/speeduino/decoders.ino @@ -94,7 +94,7 @@ static inline int crankingGetRPM(byte totalTeeth) revolutionTime = (toothLastToothTime - toothLastMinusOneToothTime) * totalTeeth; interrupts(); tempRPM = (US_IN_MINUTE / revolutionTime); - if(tempRPM >= MAX_RPM) { tempRPM = currentStatus.RPM; } //Sanity check + if( tempRPM >= (configPage2.crankRPM * 400) ) { tempRPM = currentStatus.RPM; } //Sanity check. This can prevent spiking caused by noise on individual teeth. The new RPM should never be above 4x the cranking setting value (Remembering that this function is only called is the current RPM is less than the cranking setting) } return tempRPM; }