Speeduino
Loading...
Searching...
No Matches
Macros | Functions | Variables
scheduler_ignition_controller.cpp File Reference
#include "scheduler_ignition_controller.h"
#include "scheduledIO_ign.h"
#include "schedule_calcs.hpp"
#include "globals.h"
#include "unit_testing.h"

Macros

#define SET_IGNITION_CHANNEL(channelIdx)   setIgnitionChannel(ignitionSchedule ##channelIdx, crankAngle, dwellTime, current.schedulerCutState.ignitionChannels, channelIdx);
 

Functions

static void setSequentialCallbacks (uint8_t numChannels)
 
static void setWastedSparkCallbacks (void)
 
static void setSingleChannelCallbacks (void)
 
static void setWastedCOPCallbacks (uint8_t numCylinders)
 
static void setRotaryCallbacks (uint8_t rotaryType)
 
static void setCallbacks (uint8_t sparkMode, uint8_t numCylinders, uint8_t rotaryMode)
 
TESTABLE_STATIC void resetIgnitionSchedulers (void)
 
void initialiseIgnitionSchedules (uint8_t sparkMode, uint8_t numCylinders, uint8_t rotaryMode)
 Initialise all ignition schedules.
 
TESTABLE_INLINE_STATIC bool isAnyIgnScheduleRunning (void)
 
static bool isSwitchableCylinderCount (const config2 &page2)
 
static bool isSemiSequentialIgnition (const config2 &page2, const config4 &page4, const decoder_status_t &decoderStatus)
 
static bool isFullSequentialIgnition (const config4 &page4, const decoder_status_t &decoderStatus)
 
TESTABLE_STATIC void changeIgnitionToHalfSync (const config2 &page2, statuses &current)
 
TESTABLE_STATIC void changeIgnitionToFullSequential (const config2 &page2, statuses &current)
 
TESTABLE_INLINE_STATIC void matchIgnitionSchedulersToSyncState (const config2 &page2, const config4 &page4, statuses &current)
 
static void calculateRotaryIgnitionAngles (uint16_t dwellAngle, const statuses &current)
 
static void calculateNonRotaryIgnitionAngles (uint16_t dwellAngle, const statuses &current)
 
 BEGIN_LTO_ALWAYS_INLINE (void) calculateIgnitionAngles(const config2 &page2
 
 if ((current.maxIgnOutputs==4U) &&(page4.sparkMode==IGN_MODE_ROTARY))
 
 if (page2.perToothIgn==true)
 
TESTABLE_INLINE_STATIC void setIgnitionScheduleDuration (IgnitionSchedule &schedule, uint32_t delay, uint16_t duration)
 
static void setIgnitionChannel (IgnitionSchedule &schedule, uint16_t crankAngle, uint16_t dwellDuration, byte channelMask, uint8_t channelIdx)
 
TESTABLE_INLINE_STATIC void applyChannelOverDwellProtection (IgnitionSchedule &schedule, uint32_t targetOverdwellTime)
 
TESTABLE_INLINE_STATIC bool isOverDwellActive (const config4 &page4, const statuses &current)
 
void applyOverDwellProtection (const config4 &page4, const statuses &current)
 Check that no ignition channel has been charging the coil for too long.
 
void startIgnitionSchedulers (void)
 Start the timers that drive schedulers

 
void stopIgnitionSchedulers (void)
 Stop the timers that drive schedulers

 

Variables

IgnitionSchedule ignitionSchedule1 (IGN1_COUNTER, IGN1_COMPARE)
 
IgnitionSchedule ignitionSchedule2 (IGN2_COUNTER, IGN2_COMPARE)
 
IgnitionSchedule ignitionSchedule3 (IGN3_COUNTER, IGN3_COMPARE)
 
IgnitionSchedule ignitionSchedule4 (IGN4_COUNTER, IGN4_COMPARE)
 
IgnitionSchedule ignitionSchedule5 (IGN5_COUNTER, IGN5_COMPARE)
 
constexpr table2D_u8_u8_8 rotarySplitTableconfigPage10
 
const config4page4
 
const config4 statusescurrent
 
uint16_t dwellAngle = timeToAngleDegPerMicroSec(current.dwell)
 
 else
 
uint16_t crankAngle
 
uint16_t uint16_t dwellTime
 

Macro Definition Documentation

◆ SET_IGNITION_CHANNEL

#define SET_IGNITION_CHANNEL (   channelIdx)    setIgnitionChannel(ignitionSchedule ##channelIdx, crankAngle, dwellTime, current.schedulerCutState.ignitionChannels, channelIdx);

Function Documentation

◆ applyChannelOverDwellProtection()

TESTABLE_INLINE_STATIC void applyChannelOverDwellProtection ( IgnitionSchedule schedule,
uint32_t  targetOverdwellTime 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ applyOverDwellProtection()

void applyOverDwellProtection ( const config4 page4,
const statuses current 
)

Check that no ignition channel has been charging the coil for too long.

The over dwell protection system runs independently of the standard ignition schedules and monitors the time that each ignition output has been active. If the active time exceeds the tune defined amount, the output will be ended to prevent damage to coils.

Note
Must be called once per millisecond by an external timer.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ BEGIN_LTO_ALWAYS_INLINE()

BEGIN_LTO_ALWAYS_INLINE ( void  ) const &

Calculate the Ignition angles for all cylinders (based on config2::nCylinders). both start and end angles are calculated for each channel. Also the mode of ignition firing - wasted spark vs. dedicated spark per cyl. - is considered here.

Here is the call graph for this function:

◆ calculateNonRotaryIgnitionAngles()

static void calculateNonRotaryIgnitionAngles ( uint16_t  dwellAngle,
const statuses current 
)
inlinestatic
Here is the call graph for this function:

◆ calculateRotaryIgnitionAngles()

static void calculateRotaryIgnitionAngles ( uint16_t  dwellAngle,
const statuses current 
)
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

◆ changeIgnitionToFullSequential()

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

◆ changeIgnitionToHalfSync()

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

◆ if() [1/2]

if ( (current.maxIgnOutputs==4U) &&(page4.sparkMode==IGN_MODE_ROTARY )
Here is the call graph for this function:

◆ if() [2/2]

if ( page2.  perToothIgn = true)

◆ initialiseIgnitionSchedules()

void initialiseIgnitionSchedules ( uint8_t  sparkMode,
uint8_t  numCylinders,
uint8_t  rotaryMode 
)

Initialise all ignition schedules.

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

◆ isAnyIgnScheduleRunning()

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

◆ isFullSequentialIgnition()

static bool isFullSequentialIgnition ( const config4 page4,
const decoder_status_t decoderStatus 
)
inlinestatic
Here is the caller graph for this function:

◆ isOverDwellActive()

TESTABLE_INLINE_STATIC bool isOverDwellActive ( const config4 page4,
const statuses current 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isSemiSequentialIgnition()

static bool isSemiSequentialIgnition ( const config2 page2,
const config4 page4,
const decoder_status_t decoderStatus 
)
inlinestatic
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:

◆ matchIgnitionSchedulersToSyncState()

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

◆ resetIgnitionSchedulers()

TESTABLE_STATIC void resetIgnitionSchedulers ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCallbacks()

static void setCallbacks ( uint8_t  sparkMode,
uint8_t  numCylinders,
uint8_t  rotaryMode 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setIgnitionChannel()

static void setIgnitionChannel ( IgnitionSchedule schedule,
uint16_t  crankAngle,
uint16_t  dwellDuration,
byte  channelMask,
uint8_t  channelIdx 
)
inlinestatic
Here is the call graph for this function:

◆ setIgnitionScheduleDuration()

TESTABLE_INLINE_STATIC void setIgnitionScheduleDuration ( IgnitionSchedule schedule,
uint32_t  delay,
uint16_t  duration 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setRotaryCallbacks()

static void setRotaryCallbacks ( uint8_t  rotaryType)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSequentialCallbacks()

static void setSequentialCallbacks ( uint8_t  numChannels)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSingleChannelCallbacks()

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

◆ setWastedCOPCallbacks()

static void setWastedCOPCallbacks ( uint8_t  numCylinders)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setWastedSparkCallbacks()

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

◆ startIgnitionSchedulers()

void startIgnitionSchedulers ( void  )

Start the timers that drive schedulers

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

◆ stopIgnitionSchedulers()

void stopIgnitionSchedulers ( void  )

Stop the timers that drive schedulers

Here is the call graph for this function:

Variable Documentation

◆ configPage10

constexpr table2D_u8_u8_8 rotarySplitTable& configPage10
constexpr

◆ crankAngle

uint16_t crankAngle

◆ current

Initial value:
{
const config2 & page2
Definition engineProtection.cpp:438
TESTABLE_INLINE_STATIC void matchIgnitionSchedulersToSyncState(const config2 &page2, const config4 &page4, statuses &current)
Definition scheduler_ignition_controller.cpp:286
const config4 & page4
Definition scheduler_ignition_controller.cpp:366
const config4 statuses & current
Definition scheduler_ignition_controller.cpp:367

◆ dwellAngle

uint16_t dwellAngle = timeToAngleDegPerMicroSec(current.dwell)

◆ dwellTime

uint16_t uint16_t dwellTime
Initial value:
{
static int16_t ignitionLimits(int16_t angle)
Makes one pass at nudging the angle to within [0,CRANK_ANGLE_MAX_IGN].
Definition crankMaths.h:51
uint16_t crankAngle
Definition scheduler_ignition_controller.cpp:399

◆ else

else
Initial value:
{
static void calculateNonRotaryIgnitionAngles(uint16_t dwellAngle, const statuses &current)
Definition scheduler_ignition_controller.cpp:310
uint16_t dwellAngle
Definition scheduler_ignition_controller.cpp:370

◆ ignitionSchedule1

◆ ignitionSchedule2

◆ ignitionSchedule3

◆ ignitionSchedule4

◆ ignitionSchedule5

◆ page4

const config4& page4