From b69d61319223944de92f39dc3e27f7eb1a22c9ef Mon Sep 17 00:00:00 2001 From: Andrey Date: Wed, 14 Sep 2022 00:52:24 -0400 Subject: [PATCH] moving IO-only away from scheduling logic --- .../controllers/engine_cycle/fuel_schedule.h | 2 ++ .../engine_cycle/main_trigger_callback.cpp | 14 -------------- .../engine_cycle/main_trigger_callback.h | 5 ----- firmware/controllers/system/injection_gpio.cpp | 16 ++++++++++++++++ 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/firmware/controllers/engine_cycle/fuel_schedule.h b/firmware/controllers/engine_cycle/fuel_schedule.h index e644faf193..5792c7c9f8 100644 --- a/firmware/controllers/engine_cycle/fuel_schedule.h +++ b/firmware/controllers/engine_cycle/fuel_schedule.h @@ -53,6 +53,8 @@ public: WallFuel wallFuel; }; +void turnInjectionPinHigh(InjectionEvent *event); + /** * This class knows about when to inject fuel diff --git a/firmware/controllers/engine_cycle/main_trigger_callback.cpp b/firmware/controllers/engine_cycle/main_trigger_callback.cpp index c745fdc6a9..07db0bf144 100644 --- a/firmware/controllers/engine_cycle/main_trigger_callback.cpp +++ b/firmware/controllers/engine_cycle/main_trigger_callback.cpp @@ -53,20 +53,6 @@ #include "backup_ram.h" -void startSimultaneousInjection(void*) { - efitick_t nowNt = getTimeNowNt(); - for (size_t i = 0; i < engineConfiguration->specs.cylindersCount; i++) { - enginePins.injectors[i].open(nowNt); - } -} - -void endSimultaneousInjectionOnlyTogglePins() { - efitick_t nowNt = getTimeNowNt(); - for (size_t i = 0; i < engineConfiguration->specs.cylindersCount; i++) { - enginePins.injectors[i].close(nowNt); - } -} - void endSimultaneousInjection(InjectionEvent *event) { event->isScheduled = false; endSimultaneousInjectionOnlyTogglePins(); diff --git a/firmware/controllers/engine_cycle/main_trigger_callback.h b/firmware/controllers/engine_cycle/main_trigger_callback.h index 41e49d05ac..a474ad2d64 100644 --- a/firmware/controllers/engine_cycle/main_trigger_callback.h +++ b/firmware/controllers/engine_cycle/main_trigger_callback.h @@ -14,9 +14,4 @@ void mainTriggerCallback(uint32_t trgEventIndex, efitick_t edgeTimestamp, angle_t currentPhase, angle_t nextPhase); void endSimultaneousInjection(InjectionEvent *event); -void turnInjectionPinHigh(InjectionEvent *event); void turnInjectionPinLow(InjectionEvent *event); - -// Internal use only - exposed for tests -void handleFuelInjectionEvent(int injEventIndex, InjectionEvent *event, - int rpm, efitick_t nowNt); diff --git a/firmware/controllers/system/injection_gpio.cpp b/firmware/controllers/system/injection_gpio.cpp index a24a1299cc..205e330a72 100644 --- a/firmware/controllers/system/injection_gpio.cpp +++ b/firmware/controllers/system/injection_gpio.cpp @@ -6,9 +6,25 @@ #include "engine_state.h" #include "tooth_logger.h" #include "tunerstudio_outputs.h" +#include "engine_configuration.h" +#include "efi_gpio.h" extern bool printFuelDebug; +void startSimultaneousInjection(void*) { + efitick_t nowNt = getTimeNowNt(); + for (size_t i = 0; i < engineConfiguration->specs.cylindersCount; i++) { + enginePins.injectors[i].open(nowNt); + } +} + +void endSimultaneousInjectionOnlyTogglePins() { + efitick_t nowNt = getTimeNowNt(); + for (size_t i = 0; i < engineConfiguration->specs.cylindersCount; i++) { + enginePins.injectors[i].close(nowNt); + } +} + InjectorOutputPin::InjectorOutputPin() : NamedOutputPin() { overlappingCounter = 1; // Force update in reset reset();