Change the pulsewidth calc to us rather than ms

This commit is contained in:
Josh Stewart 2013-02-06 10:43:17 +11:00
parent 066e0ee9e8
commit 0fd819fe3b
2 changed files with 9 additions and 3 deletions

View File

@ -103,6 +103,12 @@ void loop()
//Serial.println(VE);
Serial.print("VE: ");
Serial.println(VE);
Serial.print("Injector pulsewidth: ");
Serial.println(pulseWidth);
//Serial.println(req_fuel * (float)(VE/100.0) * (float)(MAP/100.0) * (float)(100/100.0) + engineInjectorDeadTime);
//Serial.println( (float)(req_fuel * (float)(VE/100)) );
//Serial.println( (float)(VE/100.0));
}
else

View File

@ -15,16 +15,16 @@ int AIRDEN(int MAP, int temp)
}
/*
This functino retuns a pulsewidth time (in tenths of a ms) given the following:
This functino retuns a pulsewidth time (in us) given the following:
REQ_FUEL
VE: Lookup from the main MAP vs RPM fuel table
MAP: In KPa, read from the sensor
GammaE: Sum of Enrichment factors (Cold start, acceleration). This is a multiplication factor (Eg to add 10%, this should be 110)
injOpen: Injector open time. The time the injector take to open in tenths of a ms
*/
int PW(int REQ_FUEL, int VE, int MAP, int GammaE, int injOpen)
int PW(float REQ_FUEL, int VE, int MAP, int GammaE, float injOpen)
{
return REQ_FUEL * (VE/100) * (MAP/100) * (GammaE/100) + injOpen;
return (REQ_FUEL * (float)(VE/100.0) * (float)(MAP/100.0) * (float)(GammaE/100.0) + injOpen) * 1000;
}
/* Determine the Gamma Enrichment number. Forumla borrowed from MS2 manual... may be skipped/simplified for arduino!