2015-07-10 06:01:56 -07:00
|
|
|
/**
|
|
|
|
* @file event_registry.h
|
|
|
|
*
|
|
|
|
* @date Nov 27, 2013
|
2017-01-03 03:05:22 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2017
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef EVENT_REGISTRY_H_
|
|
|
|
#define EVENT_REGISTRY_H_
|
|
|
|
|
|
|
|
#include "global.h"
|
|
|
|
#include "signal_executor.h"
|
|
|
|
#include "fl_stack.h"
|
2016-12-18 19:03:00 -08:00
|
|
|
#include "trigger_structure.h"
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2016-11-30 19:06:43 -08:00
|
|
|
class Engine;
|
|
|
|
|
2015-07-10 06:01:56 -07:00
|
|
|
class InjectionEvent {
|
|
|
|
public:
|
|
|
|
InjectionEvent();
|
|
|
|
/**
|
2016-07-17 09:02:12 -07:00
|
|
|
* This is a performance optimization for IM_SIMULTANEOUS fuel strategy.
|
|
|
|
* It's more efficient to handle all injectors together if that's the case
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
2016-01-11 14:01:33 -08:00
|
|
|
bool isSimultanious;
|
2016-11-30 16:01:43 -08:00
|
|
|
InjectorOutputPin *outputs[MAX_WIRES_COUNT];
|
2016-08-28 15:01:46 -07:00
|
|
|
bool isOverlapping;
|
2016-11-30 19:06:43 -08:00
|
|
|
int ownIndex;
|
2019-04-12 19:07:03 -07:00
|
|
|
#if EFI_UNIT_TEST
|
2016-11-30 19:06:43 -08:00
|
|
|
Engine *engine;
|
|
|
|
#endif
|
2016-01-24 23:03:01 -08:00
|
|
|
event_trigger_position_s injectionStart;
|
2015-07-10 06:01:56 -07:00
|
|
|
};
|
|
|
|
|
2016-11-26 21:01:22 -08:00
|
|
|
#define MAX_OUTPUTS_FOR_IGNITION 2
|
|
|
|
|
2015-07-10 06:01:56 -07:00
|
|
|
class IgnitionEvent {
|
|
|
|
public:
|
|
|
|
IgnitionEvent();
|
2016-11-27 18:04:45 -08:00
|
|
|
IgnitionOutputPin *outputs[MAX_OUTPUTS_FOR_IGNITION];
|
2015-07-10 06:01:56 -07:00
|
|
|
scheduling_s signalTimerUp;
|
|
|
|
scheduling_s signalTimerDown;
|
2019-10-07 21:27:49 -07:00
|
|
|
angle_t advance = NAN;
|
2019-05-07 14:22:26 -07:00
|
|
|
floatms_t sparkDwell;
|
2019-05-07 18:39:11 -07:00
|
|
|
uint32_t startOfDwell;
|
2015-07-10 06:01:56 -07:00
|
|
|
event_trigger_position_s dwellPosition;
|
|
|
|
event_trigger_position_s sparkPosition;
|
2019-10-07 22:36:03 -07:00
|
|
|
/**
|
|
|
|
* Ignition scheduler maintains a linked list of all pending ignition events.
|
|
|
|
*/
|
2019-10-07 22:26:35 -07:00
|
|
|
IgnitionEvent *next = nullptr;
|
2016-11-28 11:01:52 -08:00
|
|
|
/**
|
2019-10-07 22:36:03 -07:00
|
|
|
* Sequential number of all spark events
|
|
|
|
* @see globalSparkIdCounter
|
2016-11-28 11:01:52 -08:00
|
|
|
*/
|
2019-10-07 21:27:49 -07:00
|
|
|
int sparkId = 0;
|
2017-03-11 19:22:10 -08:00
|
|
|
/**
|
|
|
|
* [0, specs.cylindersCount)
|
|
|
|
*/
|
2019-10-07 21:27:49 -07:00
|
|
|
int cylinderIndex = 0;
|
2019-10-07 22:26:35 -07:00
|
|
|
char *name = nullptr;
|
2019-04-12 19:07:03 -07:00
|
|
|
#if EFI_UNIT_TEST
|
2016-11-28 13:01:48 -08:00
|
|
|
Engine *engine;
|
|
|
|
#endif
|
2016-11-27 18:04:45 -08:00
|
|
|
IgnitionOutputPin *getOutputForLoggins();
|
2015-07-10 06:01:56 -07:00
|
|
|
};
|
|
|
|
|
2016-11-28 05:03:30 -08:00
|
|
|
#define MAX_IGNITION_EVENT_COUNT IGNITION_PIN_COUNT
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2016-11-28 10:02:24 -08:00
|
|
|
class IgnitionEventList {
|
2016-11-28 09:03:02 -08:00
|
|
|
public:
|
|
|
|
IgnitionEventList();
|
2016-11-28 10:02:24 -08:00
|
|
|
IgnitionEvent elements[MAX_IGNITION_EVENT_COUNT];
|
2016-11-28 09:03:02 -08:00
|
|
|
bool isReady;
|
|
|
|
};
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
#endif /* EVENT_REGISTRY_H_ */
|