Speeduino
Loading...
Searching...
No Matches
Macros | Functions | Variables
scheduler_fuel_controller.cpp File Reference
#include "scheduler_fuel_controller.h"
#include "scheduledIO_inj.h"
#include "units.h"

Macros

#define SET_CALLBACKS(index)   setCallbacks(fuelSchedule ## index, openInjector ## index, closeInjector ## index);\
 
#define SET_FUEL_CHANNEL(channel)    setFuelChannelSchedule(fuelSchedule ##channel, UINT8_C(channel), crankAngle, injChannelMask, injAngle, &angleCalcCache);
 
#define ASSIGN_PRIMARY_PW(index)   fuelSchedule ## index .pw = applyFuelTrim(trimTables[index-1U], pulse_widths.primary, page6, current);
 
#define ASSIGN_SECONDARY_PW(index)
 
#define ASSIGN_ZERO_PW(index)   fuelSchedule ## index .pw = 0U;
 

Functions

static void setupSequentialCallbacks (void)
 
static void setupPairedCallbacks (void)
 
static void setupSemiSequentialCallbacks (uint8_t nCylinders, uint8_t inj4cylPairing)
 
static void setupCallbacks (uint8_t injLayout, uint8_t nCylinders, uint8_t inj4cylPairing)
 
static bool isSwitchableCylinderCount (const config2 &page2)
 
TESTABLE_INLINE_STATIC bool changeToSemiSequentialInjection (const config2 &page2, const decoder_status_t &decoderStatus)
 
TESTABLE_INLINE_STATIC bool changeToFullSequentialInjection (const config2 &page2, const decoder_status_t &decoderStatus)
 
TESTABLE_INLINE_STATIC bool isAnyFuelScheduleRunning (void)
 
static void changeFuellingToFullSequential (const config2 &page2, statuses &current)
 
static void changeFuellingToSemiSequential (const config2 &page2, const config4 &page4, statuses &current)
 
TESTABLE_STATIC void matchFuelSchedulersToSyncState (const config2 &page2, const config4 &page4, statuses &current)
 
TESTABLE_INLINE_STATIC uint16_t lookupInjectorAngle (const statuses &current)
 
TESTABLE_INLINE_STATIC void setFuelChannelSchedule (FuelSchedule &schedule, uint8_t channel, uint16_t crankAngle, byte injChannelMask, uint16_t injAngle, injectorAngleCalcCache *pCache) noexcept
 
TESTABLE_INLINE_STATIC uint16_t setFuelChannelSchedules (uint16_t crankAngle, byte injChannelMask, uint16_t injAngle)
 
 BEGIN_LTO_ALWAYS_INLINE (uint16_t) setFuelChannelSchedules(const statuses &current)
 
static uint16_t applyFuelTrim (const table3d6RpmLoad &trimTable, uint16_t pw, const config6 &page6, const statuses &current)
 
static void assignPrimaryPws (const pulseWidths &pulse_widths, const config6 &page6, const statuses &current)
 
static void assignSecondaryPws (const pulseWidths &pulse_widths, const statuses &current)
 
static void zeroAllChannels (void)
 
 BEGIN_LTO_ALWAYS_INLINE (void) applyPwToInjectorChannels(const pulseWidths &pulse_widths
 
 assignPrimaryPws (pulse_widths, page6, current)
 
 assignSecondaryPws (pulse_widths, current)
 
static void resetFuelSchedules (void)
 
void startFuelSchedulers (void)
 Start the timers that drive schedulers.
 
void stopFuelSchedulers (void)
 Stop the timers that drive schedulers.
 
void beginInjectorPriming (const statuses &current, const config4 &page4)
 Start priming the fuel system.
 
void initialiseFuelSchedules (statuses &current, const config2 &page2, const config4 &page4)
 Initialise this module.
 

Variables

FuelSchedule fuelSchedule1 (FUEL1_COUNTER, FUEL1_COMPARE)
 
FuelSchedule fuelSchedule2 (FUEL2_COUNTER, FUEL2_COMPARE)
 
FuelSchedule fuelSchedule3 (FUEL3_COUNTER, FUEL3_COMPARE)
 
FuelSchedule fuelSchedule4 (FUEL4_COUNTER, FUEL4_COMPARE)
 
TESTABLE_STATIC table2D_u8_u16_4 injectorAngleTableconfigPage2
 
const config2page2
 
const config2 const config4page4
 
const config2 const config4 const config6page6
 
const config2 const config4 const config6 statusescurrent
 

Macro Definition Documentation

◆ ASSIGN_PRIMARY_PW

#define ASSIGN_PRIMARY_PW (   index)    fuelSchedule ## index .pw = applyFuelTrim(trimTables[index-1U], pulse_widths.primary, page6, current);

◆ ASSIGN_SECONDARY_PW

#define ASSIGN_SECONDARY_PW (   index)
Value:
if ((index>current.numPrimaryInjOutputs) && (index<=getTotalInjChannelCount(current))) \
{ \
fuelSchedule ## index .pw = pulse_widths.secondary; \
}
static TIntegral readSerialIntegralTimeout(void)
Reads an integral type, timing out if necessary.
Definition comms.cpp:175
const config2 const config4 const config6 statuses & current
Definition scheduler_fuel_controller.cpp:400
static uint8_t getTotalInjChannelCount(const statuses &current)
Definition statuses.h:339

◆ ASSIGN_ZERO_PW

#define ASSIGN_ZERO_PW (   index)    fuelSchedule ## index .pw = 0U;

◆ SET_CALLBACKS

#define SET_CALLBACKS (   index)    setCallbacks(fuelSchedule ## index, openInjector ## index, closeInjector ## index);\

◆ SET_FUEL_CHANNEL

Function Documentation

◆ applyFuelTrim()

static uint16_t applyFuelTrim ( const table3d6RpmLoad trimTable,
uint16_t  pw,
const config6 page6,
const statuses current 
)
inlinestatic
Here is the call graph for this function:

◆ assignPrimaryPws() [1/2]

static void assignPrimaryPws ( const pulseWidths pulse_widths,
const config6 page6,
const statuses current 
)
inlinestatic

◆ assignPrimaryPws() [2/2]

assignPrimaryPws ( pulse_widths  ,
page6  ,
current   
)

◆ assignSecondaryPws() [1/2]

static void assignSecondaryPws ( const pulseWidths pulse_widths,
const statuses current 
)
inlinestatic
Here is the call graph for this function:

◆ assignSecondaryPws() [2/2]

assignSecondaryPws ( pulse_widths  ,
current   
)

◆ BEGIN_LTO_ALWAYS_INLINE() [1/2]

BEGIN_LTO_ALWAYS_INLINE ( uint16_t  ) const &
Here is the call graph for this function:

◆ BEGIN_LTO_ALWAYS_INLINE() [2/2]

BEGIN_LTO_ALWAYS_INLINE ( void  ) const &
Here is the call graph for this function:

◆ beginInjectorPriming()

void beginInjectorPriming ( const statuses current,
const config4 page4 
)

Start priming the fuel system.

Perform the injector priming pulses. Set these to run at an arbitrary time in the future (100us). The prime pulse value is in ms*10, so need to multiple by 100 to get to uS

Here is the call graph for this function:
Here is the caller graph for this function:

◆ changeFuellingToFullSequential()

static void changeFuellingToFullSequential ( const config2 page2,
statuses current 
)
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

◆ changeFuellingToSemiSequential()

static void changeFuellingToSemiSequential ( const config2 page2,
const config4 page4,
statuses current 
)
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

◆ changeToFullSequentialInjection()

TESTABLE_INLINE_STATIC bool changeToFullSequentialInjection ( const config2 page2,
const decoder_status_t decoderStatus 
)
Here is the caller graph for this function:

◆ changeToSemiSequentialInjection()

TESTABLE_INLINE_STATIC bool changeToSemiSequentialInjection ( const config2 page2,
const decoder_status_t decoderStatus 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialiseFuelSchedules()

void initialiseFuelSchedules ( statuses current,
const config2 page2,
const config4 page4 
)

Initialise this module.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isAnyFuelScheduleRunning()

TESTABLE_INLINE_STATIC bool isAnyFuelScheduleRunning ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isSwitchableCylinderCount()

static bool isSwitchableCylinderCount ( const config2 page2)
inlinestatic
Here is the caller graph for this function:

◆ lookupInjectorAngle()

TESTABLE_INLINE_STATIC uint16_t lookupInjectorAngle ( const statuses current)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ matchFuelSchedulersToSyncState()

TESTABLE_STATIC void matchFuelSchedulersToSyncState ( const config2 page2,
const config4 page4,
statuses current 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetFuelSchedules()

static void resetFuelSchedules ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFuelChannelSchedule()

TESTABLE_INLINE_STATIC void setFuelChannelSchedule ( FuelSchedule schedule,
uint8_t  channel,
uint16_t  crankAngle,
byte  injChannelMask,
uint16_t  injAngle,
injectorAngleCalcCache pCache 
)
noexcept
Here is the call graph for this function:

◆ setFuelChannelSchedules()

TESTABLE_INLINE_STATIC uint16_t setFuelChannelSchedules ( uint16_t  crankAngle,
byte  injChannelMask,
uint16_t  injAngle 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setupCallbacks()

static void setupCallbacks ( uint8_t  injLayout,
uint8_t  nCylinders,
uint8_t  inj4cylPairing 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setupPairedCallbacks()

static void setupPairedCallbacks ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setupSemiSequentialCallbacks()

static void setupSemiSequentialCallbacks ( uint8_t  nCylinders,
uint8_t  inj4cylPairing 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setupSequentialCallbacks()

static void setupSequentialCallbacks ( void  )
static
Here is the caller graph for this function:

◆ startFuelSchedulers()

void startFuelSchedulers ( void  )

Start the timers that drive schedulers.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stopFuelSchedulers()

void stopFuelSchedulers ( void  )

Stop the timers that drive schedulers.

Here is the call graph for this function:

◆ zeroAllChannels()

zeroAllChannels ( void  )
inlinestatic
Here is the caller graph for this function:

Variable Documentation

◆ configPage2

◆ current

Initial value:
{
const config2 & page2
Definition scheduler_fuel_controller.cpp:400
TESTABLE_STATIC void matchFuelSchedulersToSyncState(const config2 &page2, const config4 &page4, statuses &current)
Definition scheduler_fuel_controller.cpp:185
const config2 const config4 & page4
Definition scheduler_fuel_controller.cpp:400

◆ fuelSchedule1

◆ fuelSchedule2

◆ fuelSchedule3

◆ fuelSchedule4

◆ page2

const config2& page2

◆ page4

◆ page6