diff --git a/kartduino.ino b/kartduino.ino index 97af50a..f43ee57 100644 --- a/kartduino.ino +++ b/kartduino.ino @@ -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 diff --git a/utils.h b/utils.h index 47843b9..c673afc 100644 --- a/utils.h +++ b/utils.h @@ -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!