now we use updateTargetSkipRatio method instead of setTargetSkipRatio (#6566)
This commit is contained in:
parent
f9faac21f9
commit
3e4d1db28b
|
@ -165,10 +165,6 @@ SoftSparkLimiter::SoftSparkLimiter(const bool p_allowHardCut)
|
||||||
#endif // EFI_UNIT_TEST
|
#endif // EFI_UNIT_TEST
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoftSparkLimiter::setTargetSkipRatio(float p_targetSkipRatio) {
|
|
||||||
this->targetSkipRatio = p_targetSkipRatio;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SoftSparkLimiter::updateTargetSkipRatio(const float luaSparkSkip, const float tractionControlSparkSkip) {
|
void SoftSparkLimiter::updateTargetSkipRatio(const float luaSparkSkip, const float tractionControlSparkSkip) {
|
||||||
targetSkipRatio = luaSparkSkip;
|
targetSkipRatio = luaSparkSkip;
|
||||||
if (engineConfiguration->useHardSkipInTraction) {
|
if (engineConfiguration->useHardSkipInTraction) {
|
||||||
|
|
|
@ -50,7 +50,6 @@ public:
|
||||||
/**
|
/**
|
||||||
* targetSkipRatio of '0' means 'do not skip', would always return false
|
* targetSkipRatio of '0' means 'do not skip', would always return false
|
||||||
*/
|
*/
|
||||||
void setTargetSkipRatio(float targetSkipRatio);
|
|
||||||
void updateTargetSkipRatio(float luaSoftSparkSkip, float tractionControlSparkSkip);
|
void updateTargetSkipRatio(float luaSoftSparkSkip, float tractionControlSparkSkip);
|
||||||
[[nodiscard]] float getTargetSkipRatio() const { return targetSkipRatio; }
|
[[nodiscard]] float getTargetSkipRatio() const { return targetSkipRatio; }
|
||||||
|
|
||||||
|
|
|
@ -228,16 +228,18 @@ TEST(LaunchControl, CompleteRun) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(LaunchControl, hardSkip) {
|
TEST(LaunchControl, hardSkip) {
|
||||||
|
EngineTestHelper eth(engine_type_e::TEST_ENGINE);
|
||||||
|
|
||||||
SoftSparkLimiter hardSparkLimiter(true);
|
SoftSparkLimiter hardSparkLimiter(true);
|
||||||
ASSERT_FALSE(hardSparkLimiter.shouldSkip());
|
ASSERT_FALSE(hardSparkLimiter.shouldSkip());
|
||||||
|
|
||||||
|
|
||||||
hardSparkLimiter.setTargetSkipRatio(1);
|
hardSparkLimiter.updateTargetSkipRatio(1.0f, 0.0f);
|
||||||
// open question if we need special handling of '1' or random would just work?
|
// open question if we need special handling of '1' or random would just work?
|
||||||
ASSERT_TRUE(hardSparkLimiter.shouldSkip());
|
ASSERT_TRUE(hardSparkLimiter.shouldSkip());
|
||||||
|
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
hardSparkLimiter.setTargetSkipRatio(0.5);
|
hardSparkLimiter.updateTargetSkipRatio(0.5f, 0.0f);
|
||||||
for (int i =0;i<1000;i++) {
|
for (int i =0;i<1000;i++) {
|
||||||
if (hardSparkLimiter.shouldSkip()) {
|
if (hardSparkLimiter.shouldSkip()) {
|
||||||
counter++;
|
counter++;
|
||||||
|
|
Loading…
Reference in New Issue