| Line | Branch | Decision | Exec | Source |
|---|---|---|---|---|
| 1 | /* | |||
| 2 | * @file launch_control.h | |||
| 3 | * | |||
| 4 | * @date Mar 23, 2020 | |||
| 5 | * @author Andrey Belomutskiy, (c) 2012-2020 | |||
| 6 | */ | |||
| 7 | ||||
| 8 | #pragma once | |||
| 9 | ||||
| 10 | #include "launch_control_state_generated.h" | |||
| 11 | ||||
| 12 | void initLaunchControl(); | |||
| 13 | ||||
| 14 | enum class LaunchCondition { | |||
| 15 | PreLaunch, | |||
| 16 | Launch, | |||
| 17 | NotMet | |||
| 18 | }; | |||
| 19 | ||||
| 20 | class LaunchControlBase : public launch_control_state_s { | |||
| 21 | public: | |||
| 22 | LaunchControlBase(); | |||
| 23 | // Update the state of the launch control system | |||
| 24 | void update(); | |||
| 25 | ||||
| 26 | float getFuelCoefficient() const; | |||
| 27 | bool isInsideSpeedCondition() const; | |||
| 28 | bool isInsideTpsCondition() const; | |||
| 29 | bool isInsideSwitchCondition(); | |||
| 30 | LaunchCondition calculateRPMLaunchCondition(float rpm); | |||
| 31 | LaunchCondition calculateLaunchCondition(float rpm); | |||
| 32 | ||||
| 33 | bool isLaunchSparkRpmRetardCondition() const; | |||
| 34 | bool isLaunchFuelRpmRetardCondition() const; | |||
| 35 | ||||
| 36 | 1090 | float getSparkSkipRatio() const { return sparkSkipRatio; } | ||
| 37 | ||||
| 38 | private: | |||
| 39 | bool isLaunchRpmRetardCondition() const; | |||
| 40 | ||||
| 41 | float calculateSparkSkipRatio(float rpm) const; | |||
| 42 | ||||
| 43 | ||||
| 44 | float sparkSkipRatio = 0.0f; | |||
| 45 | }; | |||
| 46 | ||||
| 47 | /** | |||
| 48 | * See also SoftLimiterSandbox.java | |||
| 49 | */ | |||
| 50 | class SoftSparkLimiter { | |||
| 51 | public: | |||
| 52 | SoftSparkLimiter(bool p_allowHardCut); | |||
| 53 | /** | |||
| 54 | * targetSkipRatio of '0' means 'do not skip', would always return false | |||
| 55 | */ | |||
| 56 | void updateTargetSkipRatio( | |||
| 57 | float luaSoftSparkSkip, | |||
| 58 | float tractionControlSparkSkip, | |||
| 59 | float launchOrShiftTorqueReductionControllerSparkSkipRatio = 0.0f | |||
| 60 | ); | |||
| 61 | 66 | [[nodiscard]] float getTargetSkipRatio() const { return targetSkipRatio; } | ||
| 62 | ||||
| 63 | bool shouldSkip(); | |||
| 64 | private: | |||
| 65 | const bool allowHardCut; | |||
| 66 | bool wasJustSkipped = false; | |||
| 67 | float targetSkipRatio = 0; | |||
| 68 | }; | |||
| 69 |