Minor safety checks added
This commit is contained in:
parent
56b5fcd69d
commit
9dd0908d45
|
@ -352,6 +352,7 @@ void triggerSetup_4G63()
|
||||||
toothAngles[1] = 105; //Rising edge of tooth #2
|
toothAngles[1] = 105; //Rising edge of tooth #2
|
||||||
toothAngles[2] = 175; //Falling edge of tooth #2
|
toothAngles[2] = 175; //Falling edge of tooth #2
|
||||||
toothAngles[3] = 285; //Rising edge of tooth #1
|
toothAngles[3] = 285; //Rising edge of tooth #1
|
||||||
|
|
||||||
/*
|
/*
|
||||||
toothAngles[0] = 105; //Falling edge of tooth #1
|
toothAngles[0] = 105; //Falling edge of tooth #1
|
||||||
toothAngles[1] = 175; //Rising edge of tooth #2
|
toothAngles[1] = 175; //Rising edge of tooth #2
|
||||||
|
@ -431,6 +432,7 @@ int getCrankAngle_4G63(int timePerDegree)
|
||||||
int crankAngle = toothAngles[(tempToothCurrentCount - 1)] + configPage2.triggerAngle; //Perform a lookup of the fixed toothAngles array to find what the angle of the last tooth passed was.
|
int crankAngle = toothAngles[(tempToothCurrentCount - 1)] + configPage2.triggerAngle; //Perform a lookup of the fixed toothAngles array to find what the angle of the last tooth passed was.
|
||||||
crankAngle += ldiv( (micros() - tempToothLastToothTime), timePerDegree).quot; //Estimate the number of degrees travelled since the last tooth
|
crankAngle += ldiv( (micros() - tempToothLastToothTime), timePerDegree).quot; //Estimate the number of degrees travelled since the last tooth
|
||||||
if (crankAngle > 360) { crankAngle -= 360; }
|
if (crankAngle > 360) { crankAngle -= 360; }
|
||||||
|
if (crankAngle < 0) { crankAngle += 360; }
|
||||||
|
|
||||||
return crankAngle;
|
return crankAngle;
|
||||||
}
|
}
|
||||||
|
|
|
@ -820,7 +820,7 @@ void loop()
|
||||||
if( tempCrankAngle < 0) { tempCrankAngle += 360; }
|
if( tempCrankAngle < 0) { tempCrankAngle += 360; }
|
||||||
tempStartAngle = ignition2StartAngle - channel2IgnDegrees;
|
tempStartAngle = ignition2StartAngle - channel2IgnDegrees;
|
||||||
if ( tempStartAngle < 0) { tempStartAngle += 360; }
|
if ( tempStartAngle < 0) { tempStartAngle += 360; }
|
||||||
if (tempStartAngle > tempCrankAngle)
|
if ( (tempStartAngle > tempCrankAngle) && ign2LastRev != startRevolutions)
|
||||||
{
|
{
|
||||||
setIgnitionSchedule2(beginCoil2Charge,
|
setIgnitionSchedule2(beginCoil2Charge,
|
||||||
((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree),
|
((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree),
|
||||||
|
@ -897,4 +897,3 @@ void openInjector2and3() { digitalWrite(pinInjector2, HIGH); digitalWrite(pinInj
|
||||||
void closeInjector2and3() { digitalWrite(pinInjector2, LOW); digitalWrite(pinInjector3, LOW); BIT_CLEAR(currentStatus.squirt, 1); }
|
void closeInjector2and3() { digitalWrite(pinInjector2, LOW); digitalWrite(pinInjector3, LOW); BIT_CLEAR(currentStatus.squirt, 1); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue