Speeduino
Loading...
Searching...
No Matches
Functions | Variables
engineProtection.cpp File Reference
#include "globals.h"
#include "engineProtection.h"
#include "maths.h"
#include "units.h"
#include "unit_testing.h"
#include "preprocessor.h"
#include "decoders.h"

Functions

TESTABLE_INLINE_STATIC bool checkOilPressureLimit (const statuses &current, const config6 &page6, const config10 &page10, uint32_t currMillis)
 
TESTABLE_INLINE_STATIC bool checkBoostLimit (const statuses &current, const config6 &page6)
 
static bool canApplyAfrLimit (const config6 &page6, const config9 &page9)
 
static uint16_t getAfrO2Limit (const statuses &current, const config9 &page9)
 
static bool isAfrLimitCondtionActive (const statuses &current, const config9 &page9)
 
TESTABLE_INLINE_STATIC bool checkAFRLimit (const statuses &current, const config6 &page6, const config9 &page9, uint32_t currMillis)
 
TESTABLE_INLINE_STATIC bool checkEngineProtect (statuses &current, const config4 &page4, const config6 &page6, const config9 &page9, const config10 &page10, uint32_t currMillis)
 
 BEGIN_LTO_ALWAYS_INLINE (bool) checkEngineProtect(statuses &current
 
 END_LTO_INLINE ()
 
uint8_t checkRevLimit (statuses &current, const config4 &page4, const config6 &page6, const config9 &page9)
 
 BEGIN_LTO_ALWAYS_INLINE (statuses::scheduler_cut_t) calculateFuelIgnitionChannelCut(statuses &current
 
 if (checkEngineProtect(current, page4, page6, page9, page10) &&(page4.engineProtectMaxRPM< maxAllowedRPM))
 
 if ((current.launchingHard==true) &&(page6.lnchHardLim< maxAllowedRPM))
 
 if ((current.flatShiftingHard==true) &&(current.clutchEngagedRPM< maxAllowedRPM))
 
 if (current.RPM >=maxAllowedRPM)
 
else if (current.hardLimitActive)
 
 if ((page2.hardCutType==HARD_CUT_FULL) &&current.hardLimitActive)
 
else if ((page2.hardCutType==HARD_CUT_ROLLING) &&(current.RPM >(maxAllowedRPM+(rollingCutTable.axis[0] *10))))
 
 if (current.startRevolutions >=page4.StgCycles)
 

Variables

TESTABLE_STATIC uint32_t oilProtEndTime
 
TESTABLE_CONSTEXPR table2D_u8_u8_4 oilPressureProtectTableconfigPage10
 
TESTABLE_CONSTEXPR table2D_u8_u8_6 coolantProtectTableconfigPage9
 
TESTABLE_STATIC bool checkAFRLimitActive = false
 
TESTABLE_STATIC unsigned long afrProtectedActivateTime = 0
 
const config4page4
 
const config4 const config6page6
 
const config4 const config6 const config9page9
 
const config4 const config6 const config9 const config10page10
 
TESTABLE_STATIC uint32_t rollingCutLastRev = 0
 
TESTABLE_CONSTEXPR table2D_i8_u8_4 rollingCutTableconfigPage15
 
TESTABLE_STATIC uint8_t(* rollingCutRandFunc )(void) = random1to100
 
const config2page2
 
uint16_t maxAllowedRPM = checkRevLimit(current, page4, page6, page9)
 
 else
 
return cutState
 

Function Documentation

◆ BEGIN_LTO_ALWAYS_INLINE() [1/2]

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

◆ BEGIN_LTO_ALWAYS_INLINE() [2/2]

BEGIN_LTO_ALWAYS_INLINE ( statuses::scheduler_cut_t  ) &
Here is the call graph for this function:

◆ canApplyAfrLimit()

static bool canApplyAfrLimit ( const config6 page6,
const config9 page9 
)
inlinestatic
Here is the caller graph for this function:

◆ checkAFRLimit()

TESTABLE_INLINE_STATIC bool checkAFRLimit ( const statuses current,
const config6 page6,
const config9 page9,
uint32_t  currMillis 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkBoostLimit()

TESTABLE_INLINE_STATIC bool checkBoostLimit ( const statuses current,
const config6 page6 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkEngineProtect()

TESTABLE_INLINE_STATIC bool checkEngineProtect ( statuses current,
const config4 page4,
const config6 page6,
const config9 page9,
const config10 page10,
uint32_t  currMillis 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkOilPressureLimit()

TESTABLE_INLINE_STATIC bool checkOilPressureLimit ( const statuses current,
const config6 page6,
const config10 page10,
uint32_t  currMillis 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkRevLimit()

uint8_t checkRevLimit ( statuses current,
const config4 page4,
const config6 page6,
const config9 page9 
)
Here is the call graph for this function:

◆ END_LTO_INLINE()

END_LTO_INLINE ( )

◆ getAfrO2Limit()

static uint16_t getAfrO2Limit ( const statuses current,
const config9 page9 
)
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

◆ if() [1/8]

if ( (current.flatShiftingHard==true) &&(current.clutchEngagedRPM< maxAllowedRPM )
Here is the call graph for this function:

◆ if() [2/8]

if ( (current.launchingHard==true) &&(page6.lnchHardLim< maxAllowedRPM )

◆ if() [3/8]

if ( (page2.hardCutType==HARD_CUT_FULL) &&current.  hardLimitActive)
Here is the call graph for this function:

◆ if() [4/8]

else if ( (page2.hardCutType==HARD_CUT_ROLLING) &&(current.RPM >(maxAllowedRPM+(rollingCutTable.axis[0] *10)))  )
Here is the call graph for this function:

◆ if() [5/8]

if ( checkEngineProtect(current, page4, page6, page9, page10) &&(page4.engineProtectMaxRPM< maxAllowedRPM )

◆ if() [6/8]

else if ( current.  hardLimitActive)
Here is the call graph for this function:

◆ if() [7/8]

if ( current.RPM >=  maxAllowedRPM)
Here is the call graph for this function:

◆ if() [8/8]

if ( current.startRevolutions >=page4.  StgCycles)

◆ isAfrLimitCondtionActive()

static bool isAfrLimitCondtionActive ( const statuses current,
const config9 page9 
)
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ afrProtectedActivateTime

TESTABLE_STATIC unsigned long afrProtectedActivateTime = 0

◆ checkAFRLimitActive

TESTABLE_STATIC bool checkAFRLimitActive = false

◆ configPage10

◆ configPage15

◆ configPage9

◆ cutState

return cutState

◆ else

else
Initial value:
{
static TIntegral readSerialIntegralTimeout(void)
Reads an integral type, timing out if necessary.
Definition comms.cpp:175
static void resetEngineProtect(statuses &status)
Definition statuses.h:310

◆ maxAllowedRPM

maxAllowedRPM = checkRevLimit(current, page4, page6, page9)

◆ oilProtEndTime

TESTABLE_STATIC uint32_t oilProtEndTime

◆ page10

Initial value:
{
const config4 const config6 const config9 const config10 & page10
Definition engineProtection.cpp:152
TESTABLE_INLINE_STATIC bool checkEngineProtect(statuses &current, const config4 &page4, const config6 &page6, const config9 &page9, const config10 &page10, uint32_t currMillis)
Definition engineProtection.cpp:141
const config4 const config6 const config9 & page9
Definition engineProtection.cpp:151
const config4 const config6 & page6
Definition engineProtection.cpp:151
const config4 & page4
Definition engineProtection.cpp:151

◆ page2

const config2& page2

◆ page4

◆ page6

◆ page9

◆ rollingCutLastRev

TESTABLE_STATIC uint32_t rollingCutLastRev = 0

Tracks whether we're on the same or a different rev for the rolling cut

◆ rollingCutRandFunc

TESTABLE_STATIC uint8_t(* rollingCutRandFunc) (void) ( void  ) = random1to100