diff --git a/speeduino.ino b/speeduino.ino index 1c5a642f..afd4f46e 100644 --- a/speeduino.ino +++ b/speeduino.ino @@ -311,7 +311,7 @@ void loop() //Determine the current crank angle //This is the current angle ATDC the engine is at. This is the last known position based on what tooth was last 'seen'. It is only accurate to the resolution of the trigger wheel (Eg 36-1 is 10 degrees) - int crankAngle = (toothCurrentCount - 1) * triggerToothAngle + configPage2.triggerAngle; //Number of teeth that have passed since tooth 1, multiplied by the angle each tooth represents, plus the angle that tooth 1 is ATDC. This gives accuracy only to the nearest tooth + int crankAngle = (toothCurrentCount - 1) * triggerToothAngle + (int)(configPage2.triggerAngle*4); //Number of teeth that have passed since tooth 1, multiplied by the angle each tooth represents, plus the angle that tooth 1 is ATDC. This gives accuracy only to the nearest tooth. Needs to be multipled by 4 as the trigger angle is divided by 4 for the serial protocol if (crankAngle > 360) { crankAngle -= 360; } //How fast are we going? Need to know how long (uS) it will take to get from one tooth to the next. We then use that to estimate how far we are between the last tooth and the next one