Skip to content

Commit 2f9f75a

Browse files
committed
Only set fuel pump on if currently off.
1 parent 346ea03 commit 2f9f75a

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

speeduino/auxiliaries.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ void wmiControl(void);
4040
#define AIRCON_PIN_HIGH() (digitalWrite(pinAirConComp, HIGH))
4141
#define AIRCON_FAN_PIN_LOW() (digitalWrite(pinAirConFan, LOW))
4242
#define AIRCON_FAN_PIN_HIGH() (digitalWrite(pinAirConFan, HIGH))
43-
#define FUEL_PUMP_ON() (digitalWrite(pinFuelPump, HIGH))
44-
#define FUEL_PUMP_OFF() (digitalWrite(pinFuelPump, LOW))
43+
#define FUEL_PUMP_ON() { digitalWrite(pinFuelPump, HIGH); currentStatus.fuelPumpOn = true; }
44+
#define FUEL_PUMP_OFF() { digitalWrite(pinFuelPump, LOW); currentStatus.fuelPumpOn = false; }
4545

4646
#else
4747

@@ -55,8 +55,8 @@ void wmiControl(void);
5555
#define N2O_STAGE1_PIN_HIGH() ATOMIC() { *n2o_stage1_pin_port |= (n2o_stage1_pin_mask); }
5656
#define N2O_STAGE2_PIN_LOW() ATOMIC() { *n2o_stage2_pin_port &= ~(n2o_stage2_pin_mask); }
5757
#define N2O_STAGE2_PIN_HIGH() ATOMIC() { *n2o_stage2_pin_port |= (n2o_stage2_pin_mask); }
58-
#define FUEL_PUMP_ON() ATOMIC() { *pump_pin_port |= (pump_pin_mask); }
59-
#define FUEL_PUMP_OFF() ATOMIC() { *pump_pin_port &= ~(pump_pin_mask); }
58+
#define FUEL_PUMP_ON() ATOMIC() { *pump_pin_port |= (pump_pin_mask); currentStatus.fuelPumpOn = true; }
59+
#define FUEL_PUMP_OFF() ATOMIC() { *pump_pin_port &= ~(pump_pin_mask); currentStatus.fuelPumpOn = false; }
6060

6161
//Note the below macros cannot use ATOMIC() as they are called from within ternary operators. The ATOMIC is instead placed around the ternary call below
6262
#define FAN_PIN_LOW() *fan_pin_port &= ~(fan_pin_mask)

speeduino/init.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1183,7 +1183,6 @@ void initialiseAll(void)
11831183
if(configPage2.fpPrime > 0)
11841184
{
11851185
FUEL_PUMP_ON();
1186-
currentStatus.fuelPumpOn = true;
11871186
}
11881187
else { currentStatus.fpPrimed = true; } //If the user has set 0 for the pump priming, immediately mark the priming as being completed
11891188

speeduino/speeduino.ino

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,9 @@ void __attribute__((always_inline)) loop(void)
159159
currentStatus.longRPM = getRPM(); //Long RPM is included here
160160
currentStatus.RPM = currentStatus.longRPM;
161161
currentStatus.RPMdiv100 = div100(currentStatus.RPM);
162-
if(currentStatus.RPM > 0)
162+
if( (currentStatus.RPM > 0) && (currentStatus.fuelPumpOn == false) )
163163
{
164164
FUEL_PUMP_ON();
165-
currentStatus.fuelPumpOn = true;
166165
}
167166
}
168167
else
@@ -184,7 +183,7 @@ void __attribute__((always_inline)) loop(void)
184183
ignitionCount = 0;
185184
ignitionChannelsOn = 0;
186185
fuelChannelsOn = 0;
187-
if (currentStatus.fpPrimed == true) { FUEL_PUMP_OFF(); currentStatus.fuelPumpOn = false; } //Turn off the fuel pump, but only if the priming is complete
186+
if (currentStatus.fpPrimed == true) { FUEL_PUMP_OFF(); } //Turn off the fuel pump, but only if the priming is complete
188187
if (configPage6.iacPWMrun == false) { disableIdle(); } //Turn off the idle PWM
189188
currentStatus.engineIsCranking = false; //Clear cranking bit (Can otherwise get stuck 'on' even with 0 rpm)
190189
currentStatus.wueIsActive = false; //Same as above except for WUE

speeduino/timers.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,7 @@ void oneMSInterval(void) //Most ARM chips can simply call a function
292292
if(currentStatus.RPM == 0)
293293
{
294294
//If we reach here then the priming is complete, however only turn off the fuel pump if the engine isn't running
295-
digitalWrite(pinFuelPump, LOW);
296-
currentStatus.fuelPumpOn = false;
295+
FUEL_PUMP_OFF();
297296
}
298297
}
299298
}

0 commit comments

Comments
 (0)