From 1fabf639c5f56a2a6227eb14ed18b09b11388db6 Mon Sep 17 00:00:00 2001 From: Josh Stewart Date: Tue, 15 Jan 2019 17:15:56 +1100 Subject: [PATCH] Correctly handle case where sequential ignition is combined with more than 2 squirts per cycle. Is a potential fix for #187 --- speeduino/speeduino.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/speeduino/speeduino.ino b/speeduino/speeduino.ino index 66dac058..4d1a2a72 100644 --- a/speeduino/speeduino.ino +++ b/speeduino/speeduino.ino @@ -686,7 +686,7 @@ void loop() //Determine the current crank angle int crankAngle = getCrankAngle(); - if (crankAngle > CRANK_ANGLE_MAX_INJ ) { crankAngle -= CRANK_ANGLE_MAX_INJ; } + while(crankAngle > CRANK_ANGLE_MAX_INJ ) { crankAngle = crankAngle - CRANK_ANGLE_MAX_INJ; } //Continue reducing the crank angle by the max injection amount until it's below the required limit. This will usually only run (at most) once, but in cases where there is sequential ignition and more than 2 squirts per cycle, it may run up to 4 times. if(Serial && false) {