rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes
MainRelayController Class Reference

#include <main_relay.h>

Inheritance diagram for MainRelayController:
Inheritance graph
[legend]
Collaboration diagram for MainRelayController:
Collaboration graph
[legend]

Public Member Functions

void onSlowCallback () override
 
bool needsDelayedShutoff () override
 
- Public Member Functions inherited from EngineModule
virtual void initNoConfiguration ()
 
virtual void setDefaultConfiguration ()
 
virtual void onConfigurationChange (engine_configuration_s const *)
 
virtual void onFastCallback ()
 
virtual void onEngineStop ()
 
virtual void onIgnitionStateChanged (bool)
 
virtual void onEnginePhase (float, efitick_t, angle_t, angle_t)
 

Private Attributes

Timer m_lastIgnitionTime
 

Additional Inherited Members

- Data Fields inherited from main_relay_s
bool isBenchTest: 1 {}
 
bool hasIgnitionVoltage: 1 {}
 
bool mainRelayState: 1 {}
 
bool delayedShutoffRequested: 1 {}
 
bool unusedBit_4_4: 1 {}
 
bool unusedBit_4_5: 1 {}
 
bool unusedBit_4_6: 1 {}
 
bool unusedBit_4_7: 1 {}
 
bool unusedBit_4_8: 1 {}
 
bool unusedBit_4_9: 1 {}
 
bool unusedBit_4_10: 1 {}
 
bool unusedBit_4_11: 1 {}
 
bool unusedBit_4_12: 1 {}
 
bool unusedBit_4_13: 1 {}
 
bool unusedBit_4_14: 1 {}
 
bool unusedBit_4_15: 1 {}
 
bool unusedBit_4_16: 1 {}
 
bool unusedBit_4_17: 1 {}
 
bool unusedBit_4_18: 1 {}
 
bool unusedBit_4_19: 1 {}
 
bool unusedBit_4_20: 1 {}
 
bool unusedBit_4_21: 1 {}
 
bool unusedBit_4_22: 1 {}
 
bool unusedBit_4_23: 1 {}
 
bool unusedBit_4_24: 1 {}
 
bool unusedBit_4_25: 1 {}
 
bool unusedBit_4_26: 1 {}
 
bool unusedBit_4_27: 1 {}
 
bool unusedBit_4_28: 1 {}
 
bool unusedBit_4_29: 1 {}
 
bool unusedBit_4_30: 1 {}
 
bool unusedBit_4_31: 1 {}
 

Detailed Description

Definition at line 6 of file main_relay.h.

Member Function Documentation

◆ needsDelayedShutoff()

bool MainRelayController::needsDelayedShutoff ( )
overridevirtual

Reimplemented from EngineModule.

Definition at line 30 of file main_relay.cpp.

30 {
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}

◆ onSlowCallback()

void MainRelayController::onSlowCallback ( )
overridevirtual

Reimplemented from EngineModule.

Definition at line 6 of file main_relay.cpp.

6 {
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}
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
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()
Here is the call graph for this function:

Field Documentation

◆ m_lastIgnitionTime

Timer MainRelayController::m_lastIgnitionTime
private

Definition at line 12 of file main_relay.h.

Referenced by needsDelayedShutoff(), and onSlowCallback().


The documentation for this class was generated from the following files: