really not clear what is the best place for these classes

This commit is contained in:
rusefi 2019-10-08 02:13:52 -04:00
parent 4e26bd2fd2
commit 2b59940161
3 changed files with 29 additions and 21 deletions

View File

@ -29,28 +29,8 @@
#include "global_execution_queue.h" #include "global_execution_queue.h"
#endif /* EFI_UNIT_TEST */ #endif /* EFI_UNIT_TEST */
#define MAX_INJECTION_OUTPUT_COUNT INJECTION_PIN_COUNT
#define FAST_CALLBACK_PERIOD_MS 20 #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; class RpmCalculator;
#define MAF_DECODING_CACHE_SIZE 256 #define MAF_DECODING_CACHE_SIZE 256

View File

@ -12,6 +12,9 @@
#include "fl_stack.h" #include "fl_stack.h"
#include "trigger_structure.h" #include "trigger_structure.h"
#define MAX_INJECTION_OUTPUT_COUNT INJECTION_PIN_COUNT
class Engine; class Engine;
class InjectionEvent { class InjectionEvent {
@ -31,6 +34,28 @@ public:
event_trigger_position_s injectionStart; 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 #define MAX_OUTPUTS_FOR_IGNITION 2
class IgnitionEvent { class IgnitionEvent {
@ -74,6 +99,9 @@ public:
class IgnitionEventList { class IgnitionEventList {
public: public:
/**
* ignition events, per cylinder
*/
IgnitionEvent elements[MAX_IGNITION_EVENT_COUNT]; IgnitionEvent elements[MAX_IGNITION_EVENT_COUNT];
bool isReady = false; bool isReady = false;
}; };

View File

@ -552,7 +552,7 @@ TEST(misc, testTriggerDecoder) {
extern fuel_Map3D_t fuelMap; 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, "inj index", injectorIndex, ev->outputs[0]->injectorIndex);
assertEqualsM4(msg, " event index", eventIndex, ev->injectionStart.triggerEventIndex); assertEqualsM4(msg, " event index", eventIndex, ev->injectionStart.triggerEventIndex);
assertEqualsM4(msg, " event offset", angleOffset, ev->injectionStart.angleOffsetFromTriggerEvent); assertEqualsM4(msg, " event offset", angleOffset, ev->injectionStart.angleOffsetFromTriggerEvent);