rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes
SoftSparkLimiter Class Reference

#include <launch_control.h>

Collaboration diagram for SoftSparkLimiter:
Collaboration graph
[legend]

Public Member Functions

 SoftSparkLimiter (bool p_allowHardCut)
 
void updateTargetSkipRatio (float luaSoftSparkSkip, float tractionControlSparkSkip, float launchOrShiftTorqueReductionControllerSparkSkipRatio=0.0f)
 
float getTargetSkipRatio () const
 
bool shouldSkip ()
 

Private Attributes

const bool allowHardCut
 
bool wasJustSkipped = false
 
float targetSkipRatio = 0
 

Detailed Description

See also SoftLimiterSandbox.java

Definition at line 50 of file launch_control.h.

Constructor & Destructor Documentation

◆ SoftSparkLimiter()

SoftSparkLimiter::SoftSparkLimiter ( bool  p_allowHardCut)

Definition at line 169 of file launch_control.cpp.

170 : allowHardCut(p_allowHardCut) {
171#if EFI_UNIT_TEST
173#endif // EFI_UNIT_TEST
174}
const bool allowHardCut
void initLaunchControl()
Here is the call graph for this function:

Member Function Documentation

◆ getTargetSkipRatio()

float SoftSparkLimiter::getTargetSkipRatio ( ) const
inline

Definition at line 61 of file launch_control.h.

61{ return targetSkipRatio; }

◆ shouldSkip()

bool SoftSparkLimiter::shouldSkip ( )

Definition at line 201 of file launch_control.cpp.

201 {
202 if (targetSkipRatio == 0 || (!allowHardCut && wasJustSkipped)) {
203 wasJustSkipped = false;
204 return false;
205 }
206
207 float random = tinymt32_generate_float(&tinymt);
208 wasJustSkipped = random < (allowHardCut ? 1 : 2) * targetSkipRatio;
209 return wasJustSkipped;
210}
static tinymt32_t tinymt
static float tinymt32_generate_float(tinymt32_t *random)
Definition tinymt32.h:191

Referenced by onTriggerEventSparkLogic().

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

◆ updateTargetSkipRatio()

void SoftSparkLimiter::updateTargetSkipRatio ( float  luaSoftSparkSkip,
float  tractionControlSparkSkip,
float  launchOrShiftTorqueReductionControllerSparkSkipRatio = 0.0f 
)

targetSkipRatio of '0' means 'do not skip', would always return false

Definition at line 176 of file launch_control.cpp.

180 {
181 targetSkipRatio = luaSparkSkip;
183 if (allowHardCut) {
185 }
186 } else if (!allowHardCut) {
188 }
189
190 if (allowHardCut) {
191 /*
192 * We are applying launch controller spark skip ratio only for hard skip limiter (see
193 * https://github.com/rusefi/rusefi/issues/6566#issuecomment-2153149902).
194 */
195 targetSkipRatio += launchOrShiftTorqueReductionControllerSparkSkipRatio;
196 }
197}
static constexpr engine_configuration_s * engineConfiguration
tractionControlSparkSkip("tractionControlSparkSkip", SensorCategory.SENSOR_INPUTS, FieldType.INT, 1396, 1.0, -1.0, -1.0, "")

Referenced by EngineState::updateSparkSkip().

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

Field Documentation

◆ allowHardCut

const bool SoftSparkLimiter::allowHardCut
private

Definition at line 65 of file launch_control.h.

Referenced by shouldSkip(), and updateTargetSkipRatio().

◆ targetSkipRatio

float SoftSparkLimiter::targetSkipRatio = 0
private

Definition at line 67 of file launch_control.h.

Referenced by getTargetSkipRatio(), shouldSkip(), and updateTargetSkipRatio().

◆ wasJustSkipped

bool SoftSparkLimiter::wasJustSkipped = false
private

Definition at line 66 of file launch_control.h.

Referenced by shouldSkip().


The documentation for this class was generated from the following files: