Allow for 0ms injector pulse if VE lookup is 0

This commit is contained in:
Josh Stewart 2015-12-15 21:05:29 +11:00
parent bd0fc5806b
commit e00de31a37
2 changed files with 3 additions and 1 deletions

View File

@ -931,7 +931,7 @@ void loop()
//Determine the current crank angle
int crankAngle = getCrankAngle(timePerDegree);
if (fuelOn)
if (fuelOn && currentStatus.PW > 0)
{
if (injector1StartAngle > crankAngle)
{

View File

@ -301,6 +301,8 @@ unsigned int PW(int REQ_FUEL, byte VE, byte MAP, int corrections, int injOpen, b
//intermediate = (intermediate * iMAP) >> 7;
intermediate = (intermediate * iCorrections) >> 7;
//intermediate = (intermediate * iTPS) >> 7;
if(intermediate == 0) { return 0; } //If the pulsewidth is 0, we return here before the opening time gets added
intermediate += injOpen; //Add the injector opening time
if ( intermediate > 65535) {
intermediate = 65535; //Make sure this won't overflow when we convert to uInt. This means the maximum pulsewidth possible is 65.535mS