diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index 9654cca630..d49db49c6e 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -81,7 +81,7 @@ public: FuelSchedule *processing; #endif - OutputSignal fuelActuators[INJECTION_PIN_COUNT]; + OutputSignalPair fuelActuators[INJECTION_PIN_COUNT]; OutputSignalPair overlappingFuelActuator[INJECTION_PIN_COUNT]; bool wasOverlapping[INJECTION_PIN_COUNT]; diff --git a/firmware/controllers/algo/signal_executor.h b/firmware/controllers/algo/signal_executor.h index cabb9e8455..32c1cb1845 100644 --- a/firmware/controllers/algo/signal_executor.h +++ b/firmware/controllers/algo/signal_executor.h @@ -47,19 +47,6 @@ public: InjectionEvent *event; }; -/** - * @brief Asynchronous output signal data structure - */ -typedef struct OutputSignal_struct OutputSignal; -struct OutputSignal_struct { - - /** - * We are alternating instances so that events which extend into next revolution are not reused while - * scheduling next revolution events - */ - OutputSignalPair signalPair[2]; -}; - void initSignalExecutor(void); void initSignalExecutorImpl(void); diff --git a/firmware/controllers/trigger/main_trigger_callback.cpp b/firmware/controllers/trigger/main_trigger_callback.cpp index 3207d96242..511ad90669 100644 --- a/firmware/controllers/trigger/main_trigger_callback.cpp +++ b/firmware/controllers/trigger/main_trigger_callback.cpp @@ -209,7 +209,7 @@ static void seScheduleByTime(const char *prefix, scheduling_s *scheduling, efiti scheduleByTime(true, prefix, scheduling, time, callback, pair); } -static void scheduleFuelInjection(int rpm, OutputSignal *signal, efitimeus_t nowUs, floatus_t delayUs, floatus_t durationUs, InjectionEvent *event DECLARE_ENGINE_PARAMETER_S) { +static void scheduleFuelInjection(int rpm, OutputSignalPair *pair, efitimeus_t nowUs, floatus_t delayUs, floatus_t durationUs, InjectionEvent *event DECLARE_ENGINE_PARAMETER_S) { if (durationUs < 0) { warning(CUSTOM_OBD_3, "duration cannot be negative: %d", durationUs); return; @@ -224,8 +224,7 @@ static void scheduleFuelInjection(int rpm, OutputSignal *signal, efitimeus_t now (int)MS2US(getCrankshaftRevolutionTimeMs(rpm))); #endif /*EFI_PRINTF_FUEL_DETAILS */ - efiAssertVoid(signal!=NULL, "signal is NULL"); - OutputSignalPair *pair = &signal->signalPair[0]; + if (pair->isScheduled) { #if EFI_UNIT_TEST || EFI_SIMULATOR || defined(__DOXYGEN__) printf("still used1 %s %d\r\n", output->name, (int)getTimeNowUs()); @@ -305,7 +304,7 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE getRevolutionCounter()); #endif /* EFI_DEFAILED_LOGGING */ - OutputSignal *signal = &ENGINE(engineConfiguration2)->fuelActuators[injEventIndex]; + OutputSignalPair *pair = &ENGINE(engineConfiguration2)->fuelActuators[injEventIndex]; engine->engineConfiguration2->wasOverlapping[injEventIndex] = event->isOverlapping; @@ -315,8 +314,7 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE * 'scheduleOutput' is currently only used for injection, so maybe it should be * changed into 'scheduleInjection' and unified? todo: think about it. */ - efiAssertVoid(signal!=NULL, "signal is NULL"); - OutputSignalPair *pair = &signal->signalPair[0]; + scheduling_s * sUp = &pair->signalTimerUp; // todo: sequential need this logic as well, just do not forget to clear flag pair->isScheduled = true; scheduling_s * sDown = &pair->signalTimerDown; @@ -340,7 +338,7 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE prevOutputName = outputName; } - scheduleFuelInjection(rpm, signal, getTimeNowUs(), injectionStartDelayUs, MS2US(injectionDuration), event PASS_ENGINE_PARAMETER); + scheduleFuelInjection(rpm, pair, getTimeNowUs(), injectionStartDelayUs, MS2US(injectionDuration), event PASS_ENGINE_PARAMETER); } } diff --git a/firmware/svnversion.h b/firmware/svnversion.h index e4711cb6e1..60183e76c2 100644 --- a/firmware/svnversion.h +++ b/firmware/svnversion.h @@ -1,5 +1,5 @@ // This file was generated by Version2Header -// Wed Nov 16 11:41:34 EST 2016 +// Thu Dec 01 09:22:21 EST 2016 #ifndef VCS_VERSION -#define VCS_VERSION "10877" +#define VCS_VERSION "10931" #endif