rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
main_relay.cpp
Go to the documentation of this file.
1#include "pch.h"
2
3#include "main_relay.h"
5
8
10 m_lastIgnitionTime.reset();
11 }
12
13#if EFI_MAIN_RELAY_CONTROL
16 } else {
17 // Query whether any engine modules want to keep the lights on
18 delayedShutoffRequested = engine->engineModules.aggregate([](auto& m, bool prev) { return m.needsDelayedShutoff() | prev; }, false);
19 }
20 // TODO: delayed shutoff timeout?
21
23#else // not EFI_MAIN_RELAY_CONTROL
24 mainRelayState = true;
25#endif
26
28}
29
31 // Prevent main relay from turning off if we had ignition voltage in the past 1 second
32 // This avoids accidentally killing the car during a transient, for example
33 // right when the starter is engaged.
34 return !m_lastIgnitionTime.hasElapsedSec(1);
35}
type_list< Mockable< InjectorModelPrimary >, Mockable< InjectorModelSecondary >,#if EFI_IDLE_CONTROL Mockable< IdleController >,#endif TriggerScheduler,#if EFI_HPFP &&EFI_ENGINE_CONTROL Mockable< HpfpController >,#endif #if EFI_ENGINE_CONTROL Mockable< ThrottleModel >,#endif #if EFI_ALTERNATOR_CONTROL AlternatorController,#endif MainRelayController, Mockable< IgnitionController >, Mockable< AcController >, PrimeController, DfcoController,#if EFI_HD_ACR HarleyAcr,#endif Mockable< WallFuelController >, KnockController, SensorChecker,#if EFI_ENGINE_CONTROL Mockable< LimpManager >,#endif #if EFI_VVT_PID VvtController1, VvtController2, VvtController3, VvtController4,#endif #if EFI_BOOST_CONTROL BoostController,#endif TpsAccelEnrichment,#if EFI_LAUNCH_CONTROL NitrousController,#endif #if EFI_LTFT_CONTROL LongTermFuelTrim,#endif ShortTermFuelTrim,#include "modules_list_generated.h" EngineModule > engineModules
Definition engine.h:194
RegisteredOutputPin mainRelay
Definition efi_gpio.h:76
bool needsDelayedShutoff() override
void onSlowCallback() override
Definition main_relay.cpp:6
void setValue(const char *msg, int logicValue, bool isForce=false)
Definition efi_gpio.cpp:604
EnginePins enginePins
Definition efi_gpio.cpp:24
static EngineAccessor engine
Definition engine.h:413
bool isIgnVoltage()