Add fuel pump priming

This commit is contained in:
Josh Stewart 2015-12-21 15:45:52 +11:00
parent 934bafe5a0
commit 65f430a930
4 changed files with 18 additions and 3 deletions

View File

@ -183,7 +183,7 @@ struct config1 {
byte tpsMax;
byte mapMin;
unsigned int mapMax;
byte unused49;
byte fpPrime; //Time (In seconds) that the fuel pump should be primed for on power up
byte unused50;
byte unused51;
byte unused52;

View File

@ -154,7 +154,7 @@ page = 2
tpsMax = scalar, U08, 45, "ADC", 1.0, 0.0, 0.0, 255.0, 0
mapMin = scalar, U08, 46, "kpa", 1.0, 0.0, 0.0, 255.0, 0
mapMax = scalar, U16, 47, "kpa", 1.0, 0.0, 0.0, 25500, 0
unused2-49 = scalar, U08, 49, "RPM", 100.0, 0.0, 100, 25500, 0
fpPrime = scalar, U08, 49, "s", 1.0, 0.0, 0.0, 255.0, 0
unused2-50 = scalar, U08, 50, "RPM", 100.0, 0.0, 100, 25500, 0
unused2-51 = scalar, U08, 51, "RPM", 100.0, 0.0, 100, 25500, 0
unused2-52 = scalar, U08, 52, "RPM", 100.0, 0.0, 100, 25500, 0
@ -652,6 +652,7 @@ page = 8
field = "Cranking RPM (Max)", crankRPM
field = "Flood Clear level", tpsflood
field = ""
field = "Fuel pump prime duration", fpPrime
field = "Priming Pulsewidth", primePulse
field = ""
field = "Cranking Enrichment %", crankingPct

View File

@ -128,6 +128,7 @@ void (*ign4EndFunction)();
int timePerDegree;
byte degreesPerLoop; //The number of crank degrees that pass for each mainloop of the program
volatile bool fpPrimed = false; //Tracks whether or not the fuel pump priming has been completed yet
void setup()
{
@ -543,6 +544,9 @@ void setup()
break;
}
//Begin priming the fuel pump. This is turned off in the low resolution, 1s interrupt in timers.ino
digitalWrite(pinFuelPump, HIGH);
fuelPumpOn = false;
//Perform the priming pulses. Set these to run at an arbitrary time in the future (100us). The prime pulse value is in ms*10, so need to multiple by 100 to get to uS
setFuelSchedule1(openInjector1and4, 100, (unsigned long)(configPage1.primePulse * 100), closeInjector1and4);
setFuelSchedule2(openInjector2and3, 100, (unsigned long)(configPage1.primePulse * 100), closeInjector2and3);
@ -590,7 +594,7 @@ void loop()
currentStatus.rpmDOT = 0;
ignitionOn = false;
fuelOn = false;
digitalWrite(pinFuelPump, LOW); //Turn off the fuel pump
if (fpPrimed) { digitalWrite(pinFuelPump, LOW); } //Turn off the fuel pump, but only if the priming is complete
fuelPumpOn = false;
}

View File

@ -82,6 +82,16 @@ ISR(TIMER2_OVF_vect, ISR_NOBLOCK)
{
fanControl(); // Fucntion to turn the cooling fan on/off
}
//Check whether fuel pump priming is complete
if(!fpPrimed)
{
if(currentStatus.secl >= configPage1.fpPrime)
{
fpPrimed = true; //Mark the priming as being completed
if(currentStatus.RPM == 0) { digitalWrite(pinFuelPump, LOW); fuelPumpOn = false; } //If we reach here then the priming is complete, however only turn off the fuel pump if the engine isn't running
}
}
}
//Reset Timer2 to trigger in another ~1ms