From 2b5994016159034aab9147ccf61deb9b952cf552 Mon Sep 17 00:00:00 2001 From: rusefi Date: Tue, 8 Oct 2019 02:13:52 -0400 Subject: [PATCH] really not clear what is the best place for these classes --- firmware/controllers/algo/engine.h | 20 ---------------- firmware/controllers/algo/event_registry.h | 28 ++++++++++++++++++++++ unit_tests/tests/test_trigger_decoder.cpp | 2 +- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index 48395f3f15..b4c899789e 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -29,28 +29,8 @@ #include "global_execution_queue.h" #endif /* EFI_UNIT_TEST */ -#define MAX_INJECTION_OUTPUT_COUNT INJECTION_PIN_COUNT #define FAST_CALLBACK_PERIOD_MS 20 -/** - * This class knows about when to inject fuel - */ -class FuelSchedule { -public: - FuelSchedule(); - /** - * this method schedules all fuel events for an engine cycle - */ - void addFuelEvents(DECLARE_ENGINE_PARAMETER_SIGNATURE); - bool addFuelEventsForCylinder(int cylinderIndex DECLARE_ENGINE_PARAMETER_SUFFIX); - - InjectionEvent elements[MAX_INJECTION_OUTPUT_COUNT]; - bool isReady; - -private: - void clear(); -}; - class RpmCalculator; #define MAF_DECODING_CACHE_SIZE 256 diff --git a/firmware/controllers/algo/event_registry.h b/firmware/controllers/algo/event_registry.h index 6b6a1a5726..16406ba05b 100644 --- a/firmware/controllers/algo/event_registry.h +++ b/firmware/controllers/algo/event_registry.h @@ -12,6 +12,9 @@ #include "fl_stack.h" #include "trigger_structure.h" +#define MAX_INJECTION_OUTPUT_COUNT INJECTION_PIN_COUNT + + class Engine; class InjectionEvent { @@ -31,6 +34,28 @@ public: event_trigger_position_s injectionStart; }; +/** + * This class knows about when to inject fuel + */ +class FuelSchedule { +public: + FuelSchedule(); + /** + * this method schedules all fuel events for an engine cycle + */ + void addFuelEvents(DECLARE_ENGINE_PARAMETER_SIGNATURE); + bool addFuelEventsForCylinder(int cylinderIndex DECLARE_ENGINE_PARAMETER_SUFFIX); + + /** + * injection events, per cylinder + */ + InjectionEvent elements[MAX_INJECTION_OUTPUT_COUNT]; + bool isReady; + +private: + void clear(); +}; + #define MAX_OUTPUTS_FOR_IGNITION 2 class IgnitionEvent { @@ -74,6 +99,9 @@ public: class IgnitionEventList { public: + /** + * ignition events, per cylinder + */ IgnitionEvent elements[MAX_IGNITION_EVENT_COUNT]; bool isReady = false; }; diff --git a/unit_tests/tests/test_trigger_decoder.cpp b/unit_tests/tests/test_trigger_decoder.cpp index 88194d596f..78580cf86e 100644 --- a/unit_tests/tests/test_trigger_decoder.cpp +++ b/unit_tests/tests/test_trigger_decoder.cpp @@ -552,7 +552,7 @@ TEST(misc, testTriggerDecoder) { extern fuel_Map3D_t fuelMap; -static void assertInjectionEvent(const char *msg, InjectionEvent *ev, int injectorIndex, int eventIndex, angle_t angleOffset, bool isOverlapping) { +static void assertInjectionEvent(const char *msg, InjectionEvent *ev, int injectorIndex, int eventIndex, angle_t angleOffset, bool unused) { assertEqualsM4(msg, "inj index", injectorIndex, ev->outputs[0]->injectorIndex); assertEqualsM4(msg, " event index", eventIndex, ev->injectionStart.triggerEventIndex); assertEqualsM4(msg, " event offset", angleOffset, ev->injectionStart.angleOffsetFromTriggerEvent);