mirror of https://github.com/rusefi/rusefi.git
add std::function hooks to ignition
This commit is contained in:
parent
6ff62e9ca0
commit
48feb535af
|
@ -55,6 +55,8 @@
|
|||
#include "vvt.h"
|
||||
#include "trip_odometer.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
#ifndef EFI_UNIT_TEST
|
||||
#error EFI_UNIT_TEST must be defined!
|
||||
#endif
|
||||
|
@ -237,6 +239,8 @@ public:
|
|||
#endif
|
||||
#if EFI_UNIT_TEST
|
||||
TestExecutor executor;
|
||||
|
||||
std::function<void(IgnitionEvent*, bool)> onIgnitionEvent;
|
||||
#endif // EFI_UNIT_TEST
|
||||
|
||||
#if EFI_ENGINE_CONTROL
|
||||
|
|
|
@ -181,6 +181,12 @@ static void overFireSparkAndPrepareNextSchedule(IgnitionEvent *event) {
|
|||
}
|
||||
|
||||
void fireSparkAndPrepareNextSchedule(IgnitionEvent *event) {
|
||||
#if EFI_UNIT_TEST
|
||||
if (engine->onIgnitionEvent) {
|
||||
engine->onIgnitionEvent(event, false);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int i = 0; i< MAX_OUTPUTS_FOR_IGNITION;i++) {
|
||||
IgnitionOutputPin *output = event->outputs[i];
|
||||
|
||||
|
@ -300,6 +306,12 @@ void turnSparkPinHighStartCharging(IgnitionEvent *event) {
|
|||
|
||||
efitick_t nowNt = getTimeNowNt();
|
||||
|
||||
#if EFI_UNIT_TEST
|
||||
if (engine->onIgnitionEvent) {
|
||||
engine->onIgnitionEvent(event, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if EFI_TOOTH_LOGGER
|
||||
LogTriggerCoilState(nowNt, true);
|
||||
#endif // EFI_TOOTH_LOGGER
|
||||
|
|
Loading…
Reference in New Issue