Fuel pump should turn on at the first sign of engine rotation #1961

This commit is contained in:
rusefillc 2020-12-02 23:09:39 -05:00
parent 0ba97379fb
commit c36f76b68e
5 changed files with 17 additions and 1 deletions

View File

@ -80,6 +80,7 @@ public:
explicit Engine(persistent_config_s *config);
Engine();
bool isPwmEnabled = true;
int triggerActivitySecond = 0;
IEtbController *etbControllers[ETB_COUNT] = {nullptr};
IFuelComputer *fuelComputer = nullptr;

View File

@ -56,6 +56,7 @@ typedef enum {
LE_METHOD_FSIO_DIGITAL_INPUT = 123,
LE_METHOD_FSIO_SETTING = 124,
LE_METHOD_PPS = 125,
LE_METHOD_TIME_SINCE_TRIGGER_EVENT = 126,
#include "fsio_enums_generated.def"

View File

@ -139,6 +139,7 @@ FsioValue getEngineValue(le_action_e action DECLARE_ENGINE_PARAMETER_SUFFIX) {
case LE_METHOD_EXHAUST_VVT:
return engine->triggerCentral.getVVTPosition();
#endif
case LE_METHOD_TIME_SINCE_TRIGGER_EVENT:
case LE_METHOD_TIME_SINCE_BOOT:
#if EFI_MAIN_RELAY_CONTROL
// in main relay control mode, we return the number of seconds since the ignition is turned on
@ -781,7 +782,7 @@ void runHardcodedFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
}
// see FUEL_PUMP_LOGIC
if (CONFIG(fuelPumpPin) != GPIO_UNASSIGNED) {
enginePins.fuelPumpRelay.setValue((getTimeNowSeconds() < engineConfiguration->startUpFuelPumpDuration) || (engine->rpmCalculator.getRpm() > 0));
enginePins.fuelPumpRelay.setValue((getTimeNowSeconds() < engine->triggerActivitySecond + engineConfiguration->startUpFuelPumpDuration) || (engine->rpmCalculator.getRpm() > 0));
}
enginePins.o2heater.setValue(engine->rpmCalculator.isRunning());

View File

@ -406,6 +406,14 @@ void mainTriggerCallback(uint32_t trgEventIndex, efitick_t edgeTimestamp DECLARE
int rpm = GET_RPM();
if (rpm == 0) {
// this happens while we just start cranking
/**
* While we have start-up priming pulse, we also want to start pumping fuel again as soon as possible.
* Hopefully battery would handle both cranking and fuel pump simultaneously?
*/
enginePins.fuelPumpRelay.setValue(true); // quickly set pin right from the callback here! todo: would it work OK for smart SPI pin?!
#if EFI_PROD_CODE
engine->triggerActivitySecond = getTimeNowSeconds();
#endif
// todo: check for 'trigger->is_synchnonized?'
// TODO: add 'pin shutdown' invocation somewhere - coils might be still open here!
return;

View File

@ -13,6 +13,11 @@
# (self and (coolant > fan_off_setting)) | (coolant > fan_on_setting) | is_clt_broken
FAN_CONTROL_LOGIC=(fan and (coolant > cfg_fanOffTemperature)) | (coolant > cfg_fanOnTemperature) | is_clt_broken
#
# todo: we might have a bug here?
# todo: 'time_since_boot' means 'getTimeIgnitionSeconds' in case of EFI_MAIN_RELAY_CONTROL like Proteus
# and it's negative if ignition is off? does Proteus not get fuel pump start-up priming pulse?!
#
FUEL_PUMP_LOGIC=((time_since_boot >= 0) & (time_since_boot < startup_fuel_pump_duration)) | (rpm > 0)
ALTERNATOR_LOGIC=vbatt < 14.5