![]() |
Speeduino
|
#include "globals.h"#include "engineProtection.h"#include "maths.h"#include "units.h"#include "unit_testing.h"#include "preprocessor.h"#include "decoder_init.h"Variables | |
| TESTABLE_STATIC uint32_t | oilProtEndTime |
| TESTABLE_CONSTEXPR table2D_u8_u8_4 oilPressureProtectTable & | configPage10 |
| TESTABLE_CONSTEXPR table2D_u8_u8_6 coolantProtectTable & | configPage9 |
| TESTABLE_STATIC bool | checkAFRLimitActive = false |
| TESTABLE_STATIC unsigned long | afrProtectedActivateTime = 0 |
| const config4 & | page4 |
| const config4 const config6 & | page6 |
| const config4 const config6 const config9 & | page9 |
| const config4 const config6 const config9 const config10 & | page10 |
| return | flags |
| TESTABLE_STATIC uint32_t | rollingCutLastRev = 0 |
| TESTABLE_STATIC uint8_t(* | rollingCutRandFunc )(void) noexcept = random1to100 |
| constexpr statuses::scheduler_cut_t | CUT_FULL_BOTH |
| constexpr statuses::scheduler_cut_t | CUT_FULL_FUEL |
| constexpr statuses::scheduler_cut_t | CUT_FULL_IGN |
| constexpr statuses::scheduler_cut_t | CUT_NONE |
| TESTABLE_CONSTEXPR table2D_i8_u8_4 rollingCutTable & | configPage15 |
| Immediately below max RPM, there is a range within which we can apply a rolling cut. | |
| const config2 & | page2 |
| else | |
| TESTABLE_INLINE_STATIC uint8_t applyEngineProtectionRevLimit | ( | uint8_t | curLimit, |
| const statuses & | current, | ||
| const config4 & | page4 | ||
| ) |


| TESTABLE_INLINE_STATIC uint16_t applyFlatShiftRevLimit | ( | uint16_t | curLimit, |
| const statuses & | current | ||
| ) |


|
inlinestatic |

| TESTABLE_INLINE_STATIC uint8_t applyHardLaunchRevLimit | ( | uint8_t | curLimit, |
| const statuses & | current, | ||
| const config6 & | page6 | ||
| ) |


| TESTABLE_STATIC statuses::scheduler_cut_t applyPendingIgnitionCuts | ( | statuses::scheduler_cut_t | cutState, |
| const statuses & | current | ||
| ) |


| TESTABLE_STATIC statuses::scheduler_cut_t applyRollingCut | ( | const statuses & | current, |
| const config2 & | page2, | ||
| const config4 & | page4, | ||
| const config6 & | page6, | ||
| uint16_t | maxAllowedRPM | ||
| ) |


| TESTABLE_STATIC statuses::scheduler_cut_t applyRollingCutPercentage | ( | const statuses & | current, |
| const config6 & | page6, | ||
| uint8_t | cutPercent, | ||
| bool | supportPendingIgnitionCut | ||
| ) |


| BEGIN_LTO_ALWAYS_INLINE | ( | statuses::engine_protect_flags_t | ) | const & |
| BEGIN_LTO_ALWAYS_INLINE | ( | statuses::scheduler_cut_t | ) | const & |


| TESTABLE_INLINE_STATIC uint8_t calcRollingCutPercentage | ( | const statuses & | current, |
| uint16_t | maxAllowedRPM | ||
| ) |


| TESTABLE_INLINE_STATIC uint8_t calcRollingCutRevolutions | ( | const config2 & | page2, |
| const config4 & | page4 | ||
| ) |



|
inlinestatic |


| TESTABLE_INLINE_STATIC statuses::scheduler_cut_t channelOn | ( | statuses::scheduler_cut_t | cutState, |
| bool | supportPendingIgnitionCut, | ||
| uint8_t | channel | ||
| ) |


| TESTABLE_INLINE_STATIC bool checkAFRLimit | ( | const statuses & | current, |
| const config6 & | page6, | ||
| const config9 & | page9, | ||
| uint32_t | currMillis | ||
| ) |




| TESTABLE_INLINE_STATIC bool checkCoolantLimit | ( | const statuses & | current, |
| const config6 & | page6, | ||
| const config9 & | page9 | ||
| ) |


| TESTABLE_INLINE_STATIC bool checkOilPressureLimit | ( | const statuses & | current, |
| const config6 & | page6, | ||
| const config10 & | page10, | ||
| uint32_t | currMillis | ||
| ) |


| TESTABLE_INLINE_STATIC bool checkRpmLimit | ( | const statuses & | current, |
| const config4 & | page4, | ||
| const config6 & | page6, | ||
| const config9 & | page9 | ||
| ) |




| TESTABLE_INLINE_STATIC uint8_t getHardRevLimit | ( | const statuses & | current, |
| const config4 & | page4, | ||
| const config9 & | page9 | ||
| ) |


| TESTABLE_INLINE_STATIC uint16_t getMaxRpm | ( | const statuses & | current, |
| const config4 & | page4, | ||
| const config6 & | page6, | ||
| const config9 & | page9 | ||
| ) |


| if | ( | current.RPM >= | maxAllowedRPM | ) |

| if | ( | page6.engineProtectType ! | = PROTECT_CUT_OFF | ) |

| else if | ( | useRollingCut(current, page2, maxAllowedRPM) | ) |

|
inlinestatic |



| TESTABLE_STATIC bool supportPendingIgnitionCut | ( | const config2 & | page2, |
| const config4 & | page4, | ||
| const config6 & | page6 | ||
| ) |


| TESTABLE_INLINE_STATIC bool useRollingCut | ( | const statuses & | current, |
| const config2 & | page2, | ||
| uint16_t | maxAllowedRPM | ||
| ) |

| TESTABLE_STATIC unsigned long afrProtectedActivateTime = 0 |
| TESTABLE_STATIC bool checkAFRLimitActive = false |
|
constexpr |
| TESTABLE_CONSTEXPR table2D_i8_u8_4 rollingCutTable& configPage15 |
Immediately below max RPM, there is a range within which we can apply a rolling cut.
The rolling cut table defines a series of relative negative RPM offsets that define the window and percent cut for each offset. I.e. RPM 0---------------------—|++++++++++++++++++++|<- max RPM | rolling cut window |
| TESTABLE_CONSTEXPR table2D_u8_u8_6 coolantProtectTable& configPage9 |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
| else |
| return flags |
| TESTABLE_STATIC uint32_t oilProtEndTime |
| TESTABLE_STATIC uint32_t rollingCutLastRev = 0 |
Tracks whether we're on the same or a different rev for the rolling cut
|
noexcept |