diff --git a/kartduino.ino b/kartduino.ino index bd5b0e97..eb76e38c 100644 --- a/kartduino.ino +++ b/kartduino.ino @@ -13,6 +13,8 @@ Need to calculate the req_fuel figure here, preferably in pre-processor macro #define engineStrokes 4 //Can be 2 stroke or 4 stroke, any other value will cause problems //************************************************************************************************** +#include "utils.h" + int req_fuel = ((engineCapacity / engineInjectorSize) / engineCylinders / engineStoich) * 100; // This doesn't seem quite correct, but I can't find why. It will be close enough to start an engine // Setup section @@ -61,7 +63,7 @@ void loop() { //Always check for sync //Main loop runs within this clause - if hasSync + if (hasSync) { } diff --git a/utils.h b/utils.h new file mode 100644 index 00000000..904f9a30 --- /dev/null +++ b/utils.h @@ -0,0 +1,22 @@ +/* +These are some utility functions and variables used through the main code +*/ + +//The following functions help determine the required fuel constant. For more information about these calculations, please refer to http://www.megamanual.com/v22manual/mfuel.htm +int AIRDEN(int MAP, int temp) + { + + } + +/* +This functino retuns a pulsewidth time (in tenths of a ms) 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) + { + return REQ_FUEL * (VE/100) * (MAP/100) * (GammaE/100) + injOpen; + }