Speeduino
Loading...
Searching...
No Matches
Classes | Functions
schedule_calcs.hpp File Reference
#include "scheduler.h"
#include "crankMaths.h"
#include "maths.h"
#include "timers.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  injectorAngleCalcCache
 

Functions

static uint16_t _calculateOpenAngle (FuelSchedule &schedule, uint16_t pwDegrees, uint16_t injAngle)
 Compute the injector open angle for an injection channel.
 
static uint16_t updatePwAngleCache (uint16_t pw, injectorAngleCalcCache *pCache)
 
static FORCE_INLINE uint32_t _calculateAngularTime (const Schedule &schedule, uint16_t eventAngle, uint16_t crankAngle, uint16_t maxAngle)
 
static FORCE_INLINE uint16_t _adjustToTDC (int16_t angle, uint16_t angleOffset, uint16_t maxAngle)
 
static FORCE_INLINE uint32_t _calculateAngularTime (const Schedule &schedule, uint16_t angleOffset, uint16_t eventAngle, uint16_t crankAngle, uint16_t maxAngle)
 
static uint32_t calculateInjectorTimeout (const FuelSchedule &schedule, int16_t crankAngle, uint16_t openAngle)
 Calculate the time in uS from now to when the injector should be opened.
 
static int16_t _calculateSparkAngle (const IgnitionSchedule &schedule, int8_t advance)
 
static int16_t _calculateCoilChargeAngle (uint16_t dwellAngle, int16_t dischargeAngle)
 
static void calculateIgnitionAngles (IgnitionSchedule &schedule, uint16_t dwellAngle, int8_t advance)
 
static void calculateIgnitionTrailingRotary (IgnitionSchedule &leading, uint16_t dwellAngle, int16_t rotarySplitDegrees, IgnitionSchedule &trailing)
 
static uint32_t _calculateIgnitionTimeout (const IgnitionSchedule &schedule, int16_t crankAngle)
 
static void adjustCrankAngle (IgnitionSchedule &schedule, int16_t crankAngle)
 Adjust the crank angle used to originally set the schedule.
 

Function Documentation

◆ _adjustToTDC()

static FORCE_INLINE uint16_t _adjustToTDC ( int16_t  angle,
uint16_t  angleOffset,
uint16_t  maxAngle 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _calculateAngularTime() [1/2]

static FORCE_INLINE uint32_t _calculateAngularTime ( const Schedule schedule,
uint16_t  angleOffset,
uint16_t  eventAngle,
uint16_t  crankAngle,
uint16_t  maxAngle 
)
static
Here is the call graph for this function:

◆ _calculateAngularTime() [2/2]

static FORCE_INLINE uint32_t _calculateAngularTime ( const Schedule schedule,
uint16_t  eventAngle,
uint16_t  crankAngle,
uint16_t  maxAngle 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _calculateCoilChargeAngle()

static int16_t _calculateCoilChargeAngle ( uint16_t  dwellAngle,
int16_t  dischargeAngle 
)
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _calculateIgnitionTimeout()

static uint32_t _calculateIgnitionTimeout ( const IgnitionSchedule schedule,
int16_t  crankAngle 
)
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _calculateOpenAngle()

static uint16_t _calculateOpenAngle ( FuelSchedule schedule,
uint16_t  pwDegrees,
uint16_t  injAngle 
)
inlinestatic

Compute the injector open angle for an injection channel.

Parameters
pwDegreesHow many crank degrees the calculated PW will take at the current speed
tdcOffsetThe number of crank degrees until cylinder is at TDC (at rest)
injAngleThe requested injection angle
Returns
uint16_t
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _calculateSparkAngle()

static int16_t _calculateSparkAngle ( const IgnitionSchedule schedule,
int8_t  advance 
)
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

◆ adjustCrankAngle()

static void adjustCrankAngle ( IgnitionSchedule schedule,
int16_t  crankAngle 
)
inlinestatic

Adjust the crank angle used to originally set the schedule.

The assumption here is that we have a more accurate crank angle than was originally passed to calculateIgnitionTimeout. So we can increase the spark accuracy

Parameters
scheduleThe schedule to modify
crankAngleThe new crank angle in degrees
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calculateIgnitionAngles()

static void calculateIgnitionAngles ( IgnitionSchedule schedule,
uint16_t  dwellAngle,
int8_t  advance 
)
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calculateIgnitionTrailingRotary()

static void calculateIgnitionTrailingRotary ( IgnitionSchedule leading,
uint16_t  dwellAngle,
int16_t  rotarySplitDegrees,
IgnitionSchedule trailing 
)
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calculateInjectorTimeout()

static uint32_t calculateInjectorTimeout ( const FuelSchedule schedule,
int16_t  crankAngle,
uint16_t  openAngle 
)
inlinestatic

Calculate the time in uS from now to when the injector should be opened.

Parameters
scheduleThe ignition channel
openAngleThe angle at which to open the injector
crankAngleThe current crank angle
Returns
uint32_t
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updatePwAngleCache()

static uint16_t updatePwAngleCache ( uint16_t  pw,
injectorAngleCalcCache pCache 
)
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function: