mirror of https://github.com/rusefi/rusefi.git
refactoring: splitting header where cpp was already split
This commit is contained in:
parent
0ed576031e
commit
ccfe2a5d58
|
@ -42,6 +42,7 @@
|
|||
#include "advance_map.h"
|
||||
#include "fan_control.h"
|
||||
#include "sensor_checker.h"
|
||||
#include "fuel_schedule.h"
|
||||
|
||||
#ifndef EFI_UNIT_TEST
|
||||
#error EFI_UNIT_TEST must be defined!
|
||||
|
|
|
@ -24,10 +24,6 @@
|
|||
|
||||
#include "event_registry.h"
|
||||
|
||||
InjectionEvent::InjectionEvent() {
|
||||
memset(outputs, 0, sizeof(outputs));
|
||||
}
|
||||
|
||||
IgnitionEvent::IgnitionEvent() {
|
||||
memset(outputs, 0, sizeof(outputs));
|
||||
}
|
||||
|
|
|
@ -12,79 +12,6 @@
|
|||
#include "scheduler.h"
|
||||
#include "fl_stack.h"
|
||||
#include "trigger_structure.h"
|
||||
#include "accel_enrichment.h"
|
||||
#include "wall_fuel.h"
|
||||
|
||||
#define MAX_WIRES_COUNT 2
|
||||
|
||||
class Engine;
|
||||
|
||||
class InjectionEvent {
|
||||
public:
|
||||
InjectionEvent();
|
||||
|
||||
// Update the injection start angle
|
||||
bool updateInjectionAngle(int cylinderIndex);
|
||||
|
||||
// Compute the injection start angle, compensating for injection duration and injection phase settings.
|
||||
expected<float> computeInjectionAngle(int cylinderIndex) const;
|
||||
|
||||
// Call this every decoded trigger tooth. It will schedule any relevant events for this injector.
|
||||
void onTriggerTooth(int rpm, efitick_t nowNt, float currentPhase, float nextPhase);
|
||||
|
||||
/**
|
||||
* This is a performance optimization for IM_SIMULTANEOUS fuel strategy.
|
||||
* It's more efficient to handle all injectors together if that's the case
|
||||
*/
|
||||
bool isSimultaneous = false;
|
||||
InjectorOutputPin *outputs[MAX_WIRES_COUNT];
|
||||
uint8_t ownIndex = 0;
|
||||
uint8_t cylinderNumber = 0;
|
||||
|
||||
float injectionStartAngle = 0;
|
||||
|
||||
scheduling_s signalTimerUp;
|
||||
scheduling_s endOfInjectionEvent;
|
||||
|
||||
/**
|
||||
* we need atomic flag so that we do not schedule a new pair of up/down before previous down was executed.
|
||||
*
|
||||
* That's because we want to be sure that no 'down' side callback would be ignored since we are counting to see
|
||||
* overlaps so we need the end counter to always have zero.
|
||||
* TODO: make watchdog decrement relevant counter
|
||||
*/
|
||||
bool isScheduled = false;
|
||||
|
||||
WallFuel wallFuel;
|
||||
};
|
||||
|
||||
/**
|
||||
* This class knows about when to inject fuel
|
||||
*/
|
||||
class FuelSchedule {
|
||||
public:
|
||||
FuelSchedule();
|
||||
|
||||
// Call this function if something happens that requires a rebuild, like a change to the trigger pattern
|
||||
void invalidate();
|
||||
|
||||
// Call this every trigger tooth. It will schedule all required injector events.
|
||||
void onTriggerTooth(int rpm, efitick_t nowNt, float currentPhase, float nextPhase);
|
||||
|
||||
/**
|
||||
* this method schedules all fuel events for an engine cycle
|
||||
*/
|
||||
void addFuelEvents();
|
||||
bool addFuelEventsForCylinder(int cylinderIndex);
|
||||
|
||||
void resetOverlapping();
|
||||
|
||||
/**
|
||||
* injection events, per cylinder
|
||||
*/
|
||||
InjectionEvent elements[MAX_CYLINDER_COUNT];
|
||||
bool isReady = false;
|
||||
};
|
||||
|
||||
class AngleBasedEvent {
|
||||
public:
|
||||
|
|
|
@ -48,6 +48,10 @@ static float getInjectionAngleCorrection(float fuelMs, float oneDegreeUs) {
|
|||
}
|
||||
}
|
||||
|
||||
InjectionEvent::InjectionEvent() {
|
||||
memset(outputs, 0, sizeof(outputs));
|
||||
}
|
||||
|
||||
// Returns the start angle of this injector in engine coordinates (0-720 for a 4 stroke),
|
||||
// or unexpected if unable to calculate the start angle due to missing information.
|
||||
expected<float> InjectionEvent::computeInjectionAngle(int cylinderIndex) const {
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
/**
|
||||
* @file fuel_schedule.h
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "efi_gpio.h"
|
||||
#include "scheduler.h"
|
||||
#include "fl_stack.h"
|
||||
#include "trigger_structure.h"
|
||||
#include "accel_enrichment.h"
|
||||
#include "wall_fuel.h"
|
||||
|
||||
#define MAX_WIRES_COUNT 2
|
||||
|
||||
|
||||
class InjectionEvent {
|
||||
public:
|
||||
InjectionEvent();
|
||||
|
||||
// Update the injection start angle
|
||||
bool updateInjectionAngle(int cylinderIndex);
|
||||
|
||||
// Compute the injection start angle, compensating for injection duration and injection phase settings.
|
||||
expected<float> computeInjectionAngle(int cylinderIndex) const;
|
||||
|
||||
// Call this every decoded trigger tooth. It will schedule any relevant events for this injector.
|
||||
void onTriggerTooth(int rpm, efitick_t nowNt, float currentPhase, float nextPhase);
|
||||
|
||||
/**
|
||||
* This is a performance optimization for IM_SIMULTANEOUS fuel strategy.
|
||||
* It's more efficient to handle all injectors together if that's the case
|
||||
*/
|
||||
bool isSimultaneous = false;
|
||||
InjectorOutputPin *outputs[MAX_WIRES_COUNT];
|
||||
uint8_t ownIndex = 0;
|
||||
uint8_t cylinderNumber = 0;
|
||||
|
||||
float injectionStartAngle = 0;
|
||||
|
||||
scheduling_s signalTimerUp;
|
||||
scheduling_s endOfInjectionEvent;
|
||||
|
||||
/**
|
||||
* we need atomic flag so that we do not schedule a new pair of up/down before previous down was executed.
|
||||
*
|
||||
* That's because we want to be sure that no 'down' side callback would be ignored since we are counting to see
|
||||
* overlaps so we need the end counter to always have zero.
|
||||
* TODO: make watchdog decrement relevant counter
|
||||
*/
|
||||
bool isScheduled = false;
|
||||
|
||||
WallFuel wallFuel;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* This class knows about when to inject fuel
|
||||
*/
|
||||
class FuelSchedule {
|
||||
public:
|
||||
FuelSchedule();
|
||||
|
||||
// Call this function if something happens that requires a rebuild, like a change to the trigger pattern
|
||||
void invalidate();
|
||||
|
||||
// Call this every trigger tooth. It will schedule all required injector events.
|
||||
void onTriggerTooth(int rpm, efitick_t nowNt, float currentPhase, float nextPhase);
|
||||
|
||||
/**
|
||||
* this method schedules all fuel events for an engine cycle
|
||||
*/
|
||||
void addFuelEvents();
|
||||
bool addFuelEventsForCylinder(int cylinderIndex);
|
||||
|
||||
void resetOverlapping();
|
||||
|
||||
/**
|
||||
* injection events, per cylinder
|
||||
*/
|
||||
InjectionEvent elements[MAX_CYLINDER_COUNT];
|
||||
bool isReady = false;
|
||||
};
|
Loading…
Reference in New Issue