From a1240ce8039f0bc23e94d339b222560939e417f6 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Fri, 17 Nov 2023 15:58:08 -0500 Subject: [PATCH] only:extract method --- firmware/controllers/algo/engine.cpp | 14 +++++++++++--- firmware/controllers/algo/engine.h | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index 9c6f2fdc3f..bd0356b008 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -429,7 +429,7 @@ void Engine::efiWatchdog() { return; } - if (!getTriggerCentral()->isSpinningJustForWatchdog) { + if (!triggerCentral.isSpinningJustForWatchdog) { if (!isRunningBenchTest() && enginePins.stopPins()) { // todo: make this a firmwareError assuming functional tests would run warning(ObdCode::CUSTOM_ERR_2ND_WATCHDOG, "Some pins were turned off by 2nd pass watchdog"); @@ -441,14 +441,22 @@ void Engine::efiWatchdog() { * todo: better watch dog implementation should be implemented - see * http://sourceforge.net/p/rusefi/tickets/96/ */ - getTriggerCentral()->isSpinningJustForWatchdog = false; + triggerCentral.isSpinningJustForWatchdog = false; + onEngineHasStopped(); +#endif // EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT +} + +void Engine::onEngineHasStopped() { +#if EFI_ENGINE_CONTROL ignitionEvents.isReady = false; +#endif // EFI_ENGINE_CONTROL + #if EFI_PROD_CODE || EFI_SIMULATOR efiPrintf("Engine has stopped spinning."); #endif + // this invocation should be the last layer of defence in terms of making sure injectors/coils are not active enginePins.stopPins(); -#endif // EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT } void Engine::checkShutdown() { diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index aced5559f1..348127cc36 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -325,6 +325,7 @@ public: void preCalculate(); void efiWatchdog(); + void onEngineHasStopped(); /** * Needed by EFI_MAIN_RELAY_CONTROL to shut down the engine correctly.