only:extract method

This commit is contained in:
rusefillc 2023-11-17 15:58:08 -05:00
parent 8a5c3eb5a1
commit a1240ce803
2 changed files with 12 additions and 3 deletions

View File

@ -429,7 +429,7 @@ void Engine::efiWatchdog() {
return; return;
} }
if (!getTriggerCentral()->isSpinningJustForWatchdog) { if (!triggerCentral.isSpinningJustForWatchdog) {
if (!isRunningBenchTest() && enginePins.stopPins()) { if (!isRunningBenchTest() && enginePins.stopPins()) {
// todo: make this a firmwareError assuming functional tests would run // 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"); 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 * todo: better watch dog implementation should be implemented - see
* http://sourceforge.net/p/rusefi/tickets/96/ * 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; ignitionEvents.isReady = false;
#endif // EFI_ENGINE_CONTROL
#if EFI_PROD_CODE || EFI_SIMULATOR #if EFI_PROD_CODE || EFI_SIMULATOR
efiPrintf("Engine has stopped spinning."); efiPrintf("Engine has stopped spinning.");
#endif #endif
// this invocation should be the last layer of defence in terms of making sure injectors/coils are not active
enginePins.stopPins(); enginePins.stopPins();
#endif // EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
} }
void Engine::checkShutdown() { void Engine::checkShutdown() {

View File

@ -325,6 +325,7 @@ public:
void preCalculate(); void preCalculate();
void efiWatchdog(); void efiWatchdog();
void onEngineHasStopped();
/** /**
* Needed by EFI_MAIN_RELAY_CONTROL to shut down the engine correctly. * Needed by EFI_MAIN_RELAY_CONTROL to shut down the engine correctly.