Trigger angle fix for byte division in serial comms

This commit is contained in:
Josh Stewart 2014-09-22 20:15:50 +10:00
parent 5038ddfc1d
commit 0bd13361dd
1 changed files with 1 additions and 1 deletions

View File

@ -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