rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions
main_trigger_callback.h File Reference

Detailed Description

Main logic header.

Date
Feb 9, 2013
Author
Andrey Belomutskiy, (c) 2012-2020

Definition in file main_trigger_callback.h.

Functions

void mainTriggerCallback (uint32_t trgEventIndex, efitick_t edgeTimestamp, angle_t currentPhase, angle_t nextPhase)
 
void endSimultaneousInjection (InjectionEvent *event)
 
void turnInjectionPinLow (InjectionEvent *event)
 

Function Documentation

◆ endSimultaneousInjection()

void endSimultaneousInjection ( InjectionEvent event)

Definition at line 50 of file main_trigger_callback.cpp.

50 {
52 event->update();
53}
void endSimultaneousInjectionOnlyTogglePins()
Here is the call graph for this function:

◆ mainTriggerCallback()

void mainTriggerCallback ( uint32_t  trgEventIndex,
efitick_t  edgeTimestamp,
angle_t  currentPhase,
angle_t  nextPhase 
)

This is the main trigger event handler. Both injection and ignition are controlled from this method.

In case on a major error we should not process any more events.

For fuel we schedule start of injection based on trigger angle, and then inject for specified duration of time

For spark we schedule both start of coil charge and actual spark based on trigger angle

Definition at line 255 of file main_trigger_callback.cpp.

255 {
257
258 if (hasFirmwareError()) {
259 /**
260 * In case on a major error we should not process any more events.
261 */
262 return;
263 }
264
265 float rpm = engine->rpmCalculator.getCachedRpm();
266 if (rpm == 0) {
267 // this happens while we just start cranking
268
269 // todo: check for 'trigger->is_synchnonized?'
270 return;
271 }
272
273 if (trgEventIndex == 0) {
274
275 if (getTriggerCentral()->checkIfTriggerConfigChanged()) {
276 getIgnitionEvents()->isReady = false; // we need to rebuild complete ignition schedule
277 getFuelSchedule()->isReady = false;
278 // moved 'triggerIndexByAngle' into trigger initialization (why was it invoked from here if it's only about trigger shape & optimization?)
279 // see updateTriggerConfiguration() -> prepareOutputSignals()
280
281 // we need this to apply new 'triggerIndexByAngle' values
283 }
284 }
285
286 engine->engineModules.apply_all([=](auto & m) {
287 m.onEnginePhase(rpm, edgeTimestamp, currentPhase, nextPhase);
288 });
289
290 /**
291 * For fuel we schedule start of injection based on trigger angle, and then inject for
292 * specified duration of time
293 */
294 handleFuel(edgeTimestamp, currentPhase, nextPhase);
295
296 engine->module<TriggerScheduler>()->scheduleEventsUntilNextTriggerTooth(
297 rpm, edgeTimestamp, currentPhase, nextPhase);
298
299 /**
300 * For spark we schedule both start of coil charge and actual spark based on trigger angle
301 */
302 onTriggerEventSparkLogic(rpm, edgeTimestamp, currentPhase, nextPhase);
303}
void periodicFastCallback()
Definition engine.cpp:556
RpmCalculator rpmCalculator
Definition engine.h:306
constexpr auto & module()
Definition engine.h:200
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
float getCachedRpm() const
TriggerCentral * getTriggerCentral()
Definition engine.cpp:590
FuelSchedule * getFuelSchedule()
Definition engine.cpp:600
IgnitionEventList * getIgnitionEvents()
Definition engine.cpp:604
static EngineAccessor engine
Definition engine.h:413
static void handleFuel(efitick_t nowNt, float currentPhase, float nextPhase)
@ MainTriggerCallback
void onTriggerEventSparkLogic(float rpm, efitick_t edgeTimestamp, float currentPhase, float nextPhase)

Referenced by TriggerCentral::handleShaftSignal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ turnInjectionPinLow()

void turnInjectionPinLow ( InjectionEvent event)

Definition at line 55 of file main_trigger_callback.cpp.

55 {
56 efitick_t nowNt = getTimeNowNt();
57
58 for (size_t i = 0; i < efi::size(event->outputs); i++) {
59 InjectorOutputPin *output = event->outputs[i];
60 if (output) {
61 output->close(nowNt);
62 }
63 }
64 event->update();
65}
InjectorOutputPin * outputs[MAX_WIRES_COUNT]
void close(efitick_t nowNt)
efitick_t getTimeNowNt()
Definition efitime.cpp:19
Here is the call graph for this function:

Go to the source code of this file.