diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index 7296a347ea..366e93d216 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -286,7 +286,9 @@ void Engine::OnTriggerStateProperState(efitick_t nowNt) { Engine *engine = this; EXPAND_Engine; +#if EFI_SHAFT_POSITION_INPUT triggerCentral.triggerState.runtimeStatistics(nowNt PASS_ENGINE_PARAMETER_SUFFIX); +#endif /* EFI_SHAFT_POSITION_INPUT */ rpmCalculator.setSpinningUp(nowNt PASS_ENGINE_PARAMETER_SUFFIX); } @@ -542,6 +544,8 @@ void doScheduleStopEngine(DECLARE_ENGINE_PARAMETER_SIGNATURE) { // let's close injectors or else if these happen to be open right now enginePins.stopPins(); // todo: initiate stepper motor parking + // make sure we have stored all the info + backupRamFlush(); } void action_s::execute() { diff --git a/firmware/controllers/core/fsio_impl.cpp b/firmware/controllers/core/fsio_impl.cpp index 94098df728..bc0d4e0e5f 100644 --- a/firmware/controllers/core/fsio_impl.cpp +++ b/firmware/controllers/core/fsio_impl.cpp @@ -139,8 +139,13 @@ float getEngineValue(le_action_e action DECLARE_ENGINE_PARAMETER_SUFFIX) { case LE_METHOD_EXHAUST_VVT: return engine->triggerCentral.vvtPosition; 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 + // (or negative if the ignition key is switched off) + return engine->getTimeIgnitionSeconds(); +#else return getTimeNowSeconds(); - +#endif /* EFI_MAIN_RELAY_CONTROL */ case LE_METHOD_STARTUP_FUEL_PUMP_DURATION: return engineConfiguration->startUpFuelPumpDuration; @@ -456,6 +461,7 @@ void runFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE) { #if EFI_MAIN_RELAY_CONTROL if (CONFIG(mainRelayPin) != GPIO_UNASSIGNED) + // the MAIN_RELAY_LOGIC calls engine->isInShutdownMode() setPinState("main_relay", &enginePins.mainRelay, mainRelayLogic PASS_ENGINE_PARAMETER_SUFFIX); #else /* EFI_MAIN_RELAY_CONTROL */ /** @@ -738,6 +744,12 @@ extern EnginePins enginePins; // "Limp-mode" implementation for some RAM-limited configs without FSIO void runHardcodedFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE) { +#if EFI_PROD_CODE + if (isRunningBenchTest()) { + return; // let's not mess with bench testing + } +#endif /* EFI_PROD_CODE */ + // see MAIN_RELAY_LOGIC if (CONFIG(mainRelayPin) != GPIO_UNASSIGNED) { enginePins.mainRelay.setValue((getTimeNowSeconds() < 2) || (getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE) > 5) || engine->isInShutdownMode());