rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
ignition_controller.cpp
Go to the documentation of this file.
1#include "pch.h"
2
6
8 // default to 0 if failed sensor to prevent accidental ign-on if battery
9 // input misconfigured (or the ADC hasn't started yet)
10 auto hasIgnVoltage = isIgnVoltage();
11
12 if (hasIgnVoltage) {
14 }
15
16 if (hasIgnVoltage == m_lastState) {
17 // nothing to do, states match
18 return;
19 }
20
21 // Ignore low voltage transients - we may see this at the start of cranking
22 // and we don't want to
23 if (!hasIgnVoltage && secondsSinceIgnVoltage() < 0.2f) {
24 return;
25 }
26
27 // Store state and notify other modules of the change
28 m_lastState = hasIgnVoltage;
29 engine->engineModules.apply_all([&](auto& m) { m.onIgnitionStateChanged(hasIgnVoltage); });
30}
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 FuelPumpController, MainRelayController, Mockable< IgnitionController >, Mockable< AcController >, FanControl1, FanControl2, PrimeController, DfcoController,#if EFI_HD_ACR HarleyAcr,#endif Mockable< WallFuelController >,#if EFI_VEHICLE_SPEED GearDetector, TripOdometer,#endif KnockController, SensorChecker,#if EFI_ENGINE_CONTROL 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 EngineModule > engineModules
Definition engine.h:187
void onSlowCallback() override
static float getOrZero(SensorType type)
Definition sensor.h:83
static Engine *const engine
Definition engine.h:390
bool isIgnVoltage()
bool isIgnVoltage()
void apply_all(func_t const &f)
Definition type_list.h:43