2022-08-25 16:58:15 -07:00
|
|
|
/**
|
|
|
|
* low pressure fuel pump control
|
|
|
|
* for high-pressure see HpfpController@high_pressure_fuel_pump
|
|
|
|
*
|
|
|
|
*/
|
2021-11-19 19:23:12 -08:00
|
|
|
#include "pch.h"
|
|
|
|
|
|
|
|
#include "fuel_pump.h"
|
2023-06-15 19:28:15 -07:00
|
|
|
#include "bench_test.h"
|
2021-11-19 19:23:12 -08:00
|
|
|
|
|
|
|
void FuelPumpController::onSlowCallback() {
|
2021-12-07 18:28:04 -08:00
|
|
|
auto timeSinceIgn = m_ignOnTimer.getElapsedSeconds();
|
2021-11-19 19:23:12 -08:00
|
|
|
|
2021-12-07 18:28:04 -08:00
|
|
|
// If the ignition just turned on, turn on the fuel pump to prime
|
|
|
|
isPrime = timeSinceIgn >= 0 && timeSinceIgn < engineConfiguration->startUpFuelPumpDuration;
|
2021-11-19 19:23:12 -08:00
|
|
|
|
2022-12-17 11:43:51 -08:00
|
|
|
#if EFI_SHAFT_POSITION_INPUT
|
2021-11-19 19:23:12 -08:00
|
|
|
// If there was a trigger event recently, turn on the pump, the engine is running!
|
2022-01-17 17:52:50 -08:00
|
|
|
engineTurnedRecently = engine->triggerCentral.engineMovedRecently();
|
2022-12-17 11:43:51 -08:00
|
|
|
#endif //EFI_SHAFT_POSITION_INPUT
|
2021-11-19 19:23:12 -08:00
|
|
|
|
2022-08-27 11:28:33 -07:00
|
|
|
isFuelPumpOn = isPrime || engineTurnedRecently;
|
2021-11-19 19:23:12 -08:00
|
|
|
|
2023-06-15 19:23:35 -07:00
|
|
|
if (!isRunningBenchTest()) {
|
|
|
|
enginePins.fuelPumpRelay.setValue("FP", isFuelPumpOn);
|
|
|
|
}
|
2021-11-19 19:23:12 -08:00
|
|
|
}
|
2021-12-07 18:28:04 -08:00
|
|
|
|
2022-01-01 22:17:22 -08:00
|
|
|
void FuelPumpController::onIgnitionStateChanged(bool ignitionOnParam) {
|
|
|
|
// live data parser convention is asking for a field
|
|
|
|
ignitionOn = ignitionOnParam;
|
2021-12-07 18:28:04 -08:00
|
|
|
if (ignitionOn) {
|
|
|
|
m_ignOnTimer.reset();
|
|
|
|
}
|
|
|
|
}
|