only:reordering: move functionality from `ShiftTorqueReductionTestBase` and `ShiftTorqueReductionTestConfig` classes to `TestBase` and `EngineConfig`

This commit is contained in:
kifir 2024-11-21 15:03:50 +02:00 committed by kifir23917
parent 5a7f41bcd6
commit 8873f2d784
13 changed files with 157 additions and 203 deletions

View File

@ -14,9 +14,9 @@ FlatShiftConditionTestBase::FlatShiftConditionTestBase(
}
void FlatShiftConditionTestBase::SetUp() {
ShiftTorqueReductionTestBase::SetUp();
TestBase::SetUp();
setUpTestConfig(ShiftTorqueReductionTestConfig()
setUpEngineConfiguration(EngineConfig()
.setTorqueReductionEnabled(true)
.setTorqueReductionActivationMode(torqueReductionActivationMode_e::TORQUE_REDUCTION_BUTTON)
.setTorqueReductionTriggerPin(TEST_TORQUE_REDUCTION_BUTTON_PIN)

View File

@ -4,9 +4,9 @@
#pragma once
#include "shift_torque_reduction_test_base.h"
#include "util/test_base.h"
class FlatShiftConditionTestBase : public ShiftTorqueReductionTestBase {
class FlatShiftConditionTestBase : public TestBase {
protected:
static constexpr switch_input_pin_e TEST_TORQUE_REDUCTION_BUTTON_PIN = Gpio::G10;
static constexpr float TEST_TORQUE_REDUCTION_ARMING_APP = 7.89;

View File

@ -1,103 +0,0 @@
//
// Created by kifir on 9/30/24.
//
#include "pch.h"
#include "shift_torque_reduction_test_base.h"
ShiftTorqueReductionTestConfig ShiftTorqueReductionTestConfig::setLaunchActivatePin(
const std::optional<switch_input_pin_e> value
) {
m_launchActivatePin = value;
return *this;
}
ShiftTorqueReductionTestConfig ShiftTorqueReductionTestConfig::setLaunchActivateInverted(
const std::optional<bool> value
) {
m_launchActivateInverted = value;
return *this;
}
ShiftTorqueReductionTestConfig ShiftTorqueReductionTestConfig::setTorqueReductionEnabled(
const std::optional<bool> value
) {
m_isTorqueReductionEnabled = value;
return *this;
}
ShiftTorqueReductionTestConfig ShiftTorqueReductionTestConfig::setTorqueReductionActivationMode(
const std::optional<torqueReductionActivationMode_e> value
) {
m_torqueReductionActivationMode = value;
return *this;
}
ShiftTorqueReductionTestConfig ShiftTorqueReductionTestConfig::setTorqueReductionTriggerPin(
const std::optional<switch_input_pin_e> value
) {
m_torqueReductionTriggerPin = value;
return *this;
}
ShiftTorqueReductionTestConfig ShiftTorqueReductionTestConfig::setTorqueReductionTriggerPinInverted(
const std::optional<bool> value
) {
m_torqueReductionTriggerPinInverted = value;
return *this;
}
ShiftTorqueReductionTestConfig ShiftTorqueReductionTestConfig::setLimitTorqueReductionTime(std::optional<bool> value) {
m_limitTorqueReductionTime = value;
return *this;
}
ShiftTorqueReductionTestConfig ShiftTorqueReductionTestConfig::setTorqueReductionTime(
const std::optional<float> value
) {
m_torqueReductionTime = value;
return *this;
}
ShiftTorqueReductionTestConfig ShiftTorqueReductionTestConfig::setTorqueReductionArmingRpm(std::optional<float> value) {
m_torqueReductionArmingRpm = value;
return *this;
}
ShiftTorqueReductionTestConfig ShiftTorqueReductionTestConfig::setTorqueReductionArmingApp(std::optional<float> value) {
m_torqueReductionArmingApp = value;
return *this;
}
ShiftTorqueReductionTestConfig ShiftTorqueReductionTestConfig::setTorqueReductionIgnitionCut(
const std::optional<int8_t> value
) {
m_torqueReductionIgnitionCut = value;
return *this;
}
ShiftTorqueReductionTestConfig ShiftTorqueReductionTestConfig::setTorqueReductionIgnitionRetard(
const std::optional<float> value
) {
m_torqueReductionIgnitionRetard = value;
return *this;
}
void ShiftTorqueReductionTestBase::setUpTestConfig(const ShiftTorqueReductionTestConfig& config) {
// Launch Control
getTestEngineConfiguration().configureLaunchActivatePin(config.getLaunchActivatePin());
getTestEngineConfiguration().configureLaunchActivateInverted(config.getLaunchActivateInverted());
// Shift Torque Reduction (Flat Shift)
getTestEngineConfiguration().configureTorqueReductionEnabled(config.getTorqueReductionEnabled());
getTestEngineConfiguration().configureTorqueReductionActivationMode(config.getTorqueReductionActivationMode());
getTestEngineConfiguration().configureTorqueReductionTriggerPin(config.getTorqueReductionTriggerPin());
getTestEngineConfiguration().configureTorqueReductionButtonInverted(config.getTorqueReductionTriggerPinInverted());
getTestEngineConfiguration().configureLimitTorqueReductionTime(config.getLimitTorqueReductionTime());
getTestEngineConfiguration().configureTorqueReductionTime(config.getTorqueReductionTime());
getTestEngineConfiguration().configureTorqueReductionArmingRpm(config.getTorqueReductionArmingRpm());
getTestEngineConfiguration().configureTorqueReductionArmingApp(config.getTorqueReductionArmingApp());
getTestEngineConfiguration().configureTorqueReductionIgnitionCut(config.getTorqueReductionIgnitionCut());
getTestEngineConfiguration().configureTorqueReductionIgnitionRetard(config.getTorqueReductionIgnitionRetard());
}

View File

@ -1,70 +0,0 @@
//
// Created by kifir on 9/30/24.
//
#pragma once
#include "util/test_base.h"
class ShiftTorqueReductionTestConfig {
public:
// Launch Control
std::optional<switch_input_pin_e> getLaunchActivatePin() const { return m_launchActivatePin; }
std::optional<bool> getLaunchActivateInverted() const { return m_launchActivateInverted; }
// Shift Torque Reduction (Flat Shift)
std::optional<bool> getTorqueReductionEnabled() const { return m_isTorqueReductionEnabled; }
std::optional<torqueReductionActivationMode_e> getTorqueReductionActivationMode() const {
return m_torqueReductionActivationMode;
}
std::optional<switch_input_pin_e> getTorqueReductionTriggerPin() const { return m_torqueReductionTriggerPin; }
std::optional<bool> getTorqueReductionTriggerPinInverted() const { return m_torqueReductionTriggerPinInverted; }
std::optional<bool> getLimitTorqueReductionTime() const { return m_limitTorqueReductionTime; }
std::optional<float> getTorqueReductionTime() const { return m_torqueReductionTime; }
std::optional<float> getTorqueReductionArmingRpm() const { return m_torqueReductionArmingRpm; }
std::optional<float> getTorqueReductionArmingApp() const { return m_torqueReductionArmingApp; }
std::optional<int8_t> getTorqueReductionIgnitionCut() const { return m_torqueReductionIgnitionCut; }
std::optional<float> getTorqueReductionIgnitionRetard() const { return m_torqueReductionIgnitionRetard; }
// We do not core about performance in tests, but we want to use builder-like style, so setters return new instance
// of configuration:
// Launch Control
ShiftTorqueReductionTestConfig setLaunchActivatePin(std::optional<switch_input_pin_e> value);
ShiftTorqueReductionTestConfig setLaunchActivateInverted(std::optional<bool> value);
// Shift Torque Reduction (Flat Shift)
ShiftTorqueReductionTestConfig setTorqueReductionEnabled(std::optional<bool> value);
ShiftTorqueReductionTestConfig setTorqueReductionActivationMode(
std::optional<torqueReductionActivationMode_e> value
);
ShiftTorqueReductionTestConfig setTorqueReductionTriggerPin(std::optional<switch_input_pin_e> value);
ShiftTorqueReductionTestConfig setTorqueReductionTriggerPinInverted(std::optional<bool> value);
ShiftTorqueReductionTestConfig setLimitTorqueReductionTime(std::optional<bool> value);
ShiftTorqueReductionTestConfig setTorqueReductionTime(std::optional<float> value);
ShiftTorqueReductionTestConfig setTorqueReductionArmingRpm(std::optional<float> value);
ShiftTorqueReductionTestConfig setTorqueReductionArmingApp(std::optional<float> value);
ShiftTorqueReductionTestConfig setTorqueReductionIgnitionCut(std::optional<int8_t> value);
ShiftTorqueReductionTestConfig setTorqueReductionIgnitionRetard(std::optional<float> value);
private:
// Launch Control
std::optional<switch_input_pin_e> m_launchActivatePin;
std::optional<bool> m_launchActivateInverted;
// Shift Torque Reduction (Flat Shift)
std::optional<bool> m_isTorqueReductionEnabled;
std::optional<torqueReductionActivationMode_e> m_torqueReductionActivationMode;
std::optional<switch_input_pin_e> m_torqueReductionTriggerPin;
std::optional<bool> m_torqueReductionTriggerPinInverted;
std::optional<bool> m_limitTorqueReductionTime;
std::optional<float> m_torqueReductionTime;
std::optional<float> m_torqueReductionArmingRpm;
std::optional<float> m_torqueReductionArmingApp;
std::optional<int8_t> m_torqueReductionIgnitionCut;
std::optional<float> m_torqueReductionIgnitionRetard;
};
class ShiftTorqueReductionTestBase : public TestBase {
protected:
void setUpTestConfig(const ShiftTorqueReductionTestConfig& config);
};

View File

@ -4,12 +4,12 @@
#include "pch.h"
#include "shift_torque_reduction_test_base.h"
#include "util/test_base.h"
namespace {
constexpr float TEST_TORQUE_REDUCTION_ARMING_APP = 17.0f;
class ShiftTorqueReductionAppConditionTest : public ShiftTorqueReductionTestBase {
class ShiftTorqueReductionAppConditionTest : public TestBase {
protected:
void checkAppCondition(std::optional<float> rpm, bool expectedAppCondition, const char* context);
};
@ -24,7 +24,7 @@ namespace {
}
TEST_F(ShiftTorqueReductionAppConditionTest, checkZeroArmingApp) {
setUpTestConfig(ShiftTorqueReductionTestConfig()
setUpEngineConfiguration(EngineConfig()
.setTorqueReductionEnabled(true)
.setTorqueReductionArmingApp(0.0f)
);
@ -34,7 +34,7 @@ namespace {
}
TEST_F(ShiftTorqueReductionAppConditionTest, checkArmingApp) {
setUpTestConfig(ShiftTorqueReductionTestConfig()
setUpEngineConfiguration(EngineConfig()
.setTorqueReductionEnabled(true)
.setTorqueReductionArmingApp(TEST_TORQUE_REDUCTION_ARMING_APP)
);

View File

@ -4,10 +4,10 @@
#include "pch.h"
#include "shift_torque_reduction_test_base.h"
#include "util/test_base.h"
namespace {
class ShiftTorqueReductionFlatShiftConditionTest : public ShiftTorqueReductionTestBase {
class ShiftTorqueReductionFlatShiftConditionTest : public TestBase {
protected:
static constexpr switch_input_pin_e TEST_TORQUE_REDUCTION_BUTTON_PIN = Gpio::E13;
static constexpr float TEST_TORQUE_REDUCTION_TIME = 123.45f;
@ -26,7 +26,7 @@ namespace {
void ShiftTorqueReductionFlatShiftConditionTest::SetUp() {
TestBase::SetUp();
setUpTestConfig(ShiftTorqueReductionTestConfig()
setUpEngineConfiguration(EngineConfig()
.setTorqueReductionEnabled(true)
.setTorqueReductionActivationMode(torqueReductionActivationMode_e::TORQUE_REDUCTION_BUTTON)
.setTorqueReductionTriggerPin(TEST_TORQUE_REDUCTION_BUTTON_PIN)

View File

@ -4,12 +4,12 @@
#include "pch.h"
#include "shift_torque_reduction_test_base.h"
#include "util/test_base.h"
namespace {
constexpr float TEST_TORQUE_REDUCTION_ARMING_RPM = 239.0f;
class ShiftTorqueReductionRpmConditionTest : public ShiftTorqueReductionTestBase {
class ShiftTorqueReductionRpmConditionTest : public TestBase {
protected:
void checkRpmCondition(float rpm, bool expectedRpmCondition, const char* context);
};
@ -24,7 +24,7 @@ namespace {
}
TEST_F(ShiftTorqueReductionRpmConditionTest, checkZeroArmingRpm) {
setUpTestConfig(ShiftTorqueReductionTestConfig()
setUpEngineConfiguration(EngineConfig()
.setTorqueReductionEnabled(true)
.setTorqueReductionArmingRpm(0.0f)
);
@ -33,7 +33,7 @@ namespace {
}
TEST_F(ShiftTorqueReductionRpmConditionTest, checkArmingRpm) {
setUpTestConfig(ShiftTorqueReductionTestConfig()
setUpEngineConfiguration(EngineConfig()
.setTorqueReductionEnabled(true)
.setTorqueReductionArmingRpm(TEST_TORQUE_REDUCTION_ARMING_RPM)
);

View File

@ -4,14 +4,14 @@
#include "pch.h"
#include "shift_torque_reduction_test_base.h"
#include "util/test_base.h"
namespace {
constexpr switch_input_pin_e TEST_TORQUE_REDUCTION_BUTTON_PIN = Gpio::F13;
constexpr float TEST_TORQUE_REDUCTION_TIME = 239.17;
constexpr float IMMEDIATELY = 0.0f;
class ShiftTorqueReductionTimeConditionTest : public ShiftTorqueReductionTestBase {
class ShiftTorqueReductionTimeConditionTest : public TestBase {
protected:
void waitAndCheckTimeCondition(
float timeoutInMs,
@ -42,7 +42,7 @@ namespace {
}
TEST_F(ShiftTorqueReductionTimeConditionTest, checkExpiration) {
setUpTestConfig(ShiftTorqueReductionTestConfig()
setUpEngineConfiguration(EngineConfig()
.setTorqueReductionEnabled(true)
.setTorqueReductionActivationMode(torqueReductionActivationMode_e::TORQUE_REDUCTION_BUTTON)
.setTorqueReductionTriggerPin(TEST_TORQUE_REDUCTION_BUTTON_PIN)
@ -61,7 +61,7 @@ namespace {
}
TEST_F(ShiftTorqueReductionTimeConditionTest, checkDeactivation) {
setUpTestConfig(ShiftTorqueReductionTestConfig()
setUpEngineConfiguration(EngineConfig()
.setTorqueReductionEnabled(true)
.setTorqueReductionActivationMode(torqueReductionActivationMode_e::TORQUE_REDUCTION_BUTTON)
.setTorqueReductionTriggerPin(TEST_TORQUE_REDUCTION_BUTTON_PIN)
@ -79,7 +79,7 @@ namespace {
}
TEST_F(ShiftTorqueReductionTimeConditionTest, checkReactivation) {
setUpTestConfig(ShiftTorqueReductionTestConfig()
setUpEngineConfiguration(EngineConfig()
.setTorqueReductionEnabled(true)
.setTorqueReductionActivationMode(torqueReductionActivationMode_e::TORQUE_REDUCTION_BUTTON)
.setTorqueReductionTriggerPin(TEST_TORQUE_REDUCTION_BUTTON_PIN)
@ -104,7 +104,7 @@ namespace {
}
TEST_F(ShiftTorqueReductionTimeConditionTest, checkTimeConditionIsNeverSatisfiedWithZeroTorqueReductionTime) {
setUpTestConfig(ShiftTorqueReductionTestConfig()
setUpEngineConfiguration(EngineConfig()
.setTorqueReductionEnabled(true)
.setTorqueReductionActivationMode(torqueReductionActivationMode_e::TORQUE_REDUCTION_BUTTON)
.setTorqueReductionTriggerPin(TEST_TORQUE_REDUCTION_BUTTON_PIN)
@ -129,7 +129,7 @@ namespace {
}
TEST_F(ShiftTorqueReductionTimeConditionTest, checkDeactivationWithoutLimitedTorqueReductionTime) {
setUpTestConfig(ShiftTorqueReductionTestConfig()
setUpEngineConfiguration(EngineConfig()
.setTorqueReductionEnabled(true)
.setTorqueReductionActivationMode(torqueReductionActivationMode_e::TORQUE_REDUCTION_BUTTON)
.setTorqueReductionTriggerPin(TEST_TORQUE_REDUCTION_BUTTON_PIN)

View File

@ -4,7 +4,7 @@
#include "pch.h"
#include "shift_torque_reduction_test_base.h"
#include "util/test_base.h"
namespace {
constexpr switch_input_pin_e TEST_TORQUE_REDUCTION_BUTTON_PIN = Gpio::F15;
@ -16,7 +16,7 @@ namespace {
const bool torqueReductionTriggerPinState;
};
class ShiftTorqueReductionTriggerPinTest : public ShiftTorqueReductionTestBase {
class ShiftTorqueReductionTriggerPinTest : public TestBase {
protected:
void checkShiftTorqueReductionState(const ShiftTorqueReductionTriggerPinTestData& expected);
void checkShiftTorqueReductionStateAfterPeriodicFastCallback(
@ -60,13 +60,13 @@ namespace {
}
TEST_F(ShiftTorqueReductionTriggerPinTest, checkDefaultConfiguration) {
setUpTestConfig(ShiftTorqueReductionTestConfig());
setUpEngineConfiguration(EngineConfig());
checkShiftTorqueReductionStateAfterPeriodicFastCallback({ "Default trigger pin state", false, false });
}
TEST_F(ShiftTorqueReductionTriggerPinTest, checkTorqueReductionTriggerPinSwitch) {
setUpTestConfig(ShiftTorqueReductionTestConfig()
setUpEngineConfiguration(EngineConfig()
.setTorqueReductionEnabled(true)
.setTorqueReductionActivationMode(torqueReductionActivationMode_e::TORQUE_REDUCTION_BUTTON)
.setTorqueReductionTriggerPin(TEST_TORQUE_REDUCTION_BUTTON_PIN)
@ -99,7 +99,7 @@ namespace {
}
TEST_F(ShiftTorqueReductionTriggerPinTest, checkTorqueReductionTriggerInvertedPinSwitch) {
setUpTestConfig(ShiftTorqueReductionTestConfig()
setUpEngineConfiguration(EngineConfig()
.setTorqueReductionEnabled(true)
.setTorqueReductionActivationMode(torqueReductionActivationMode_e::TORQUE_REDUCTION_BUTTON)
.setTorqueReductionTriggerPin(TEST_TORQUE_REDUCTION_BUTTON_PIN)
@ -120,7 +120,7 @@ namespace {
}
TEST_F(ShiftTorqueReductionTriggerPinTest, checkLaunchActivatePinSwitch) {
setUpTestConfig(ShiftTorqueReductionTestConfig()
setUpEngineConfiguration(EngineConfig()
.setTorqueReductionEnabled(true)
.setTorqueReductionActivationMode(torqueReductionActivationMode_e::LAUNCH_BUTTON)
.setTorqueReductionTriggerPin(TEST_TORQUE_REDUCTION_BUTTON_PIN)
@ -153,7 +153,7 @@ namespace {
}
TEST_F(ShiftTorqueReductionTriggerPinTest, checkTorqueReductionTriggerPinSwitchWithDisabledTorqueReduction) {
setUpTestConfig(ShiftTorqueReductionTestConfig()
setUpEngineConfiguration(EngineConfig()
.setTorqueReductionEnabled(false)
.setTorqueReductionActivationMode(torqueReductionActivationMode_e::TORQUE_REDUCTION_BUTTON)
.setTorqueReductionTriggerPin(TEST_TORQUE_REDUCTION_BUTTON_PIN)

View File

@ -62,7 +62,6 @@ TESTS_SRC_CPP = \
tests/launch/test_retard_threshold_rpm.cpp \
tests/launch/test_ignition_angle_advance.cpp \
tests/launch/test_spark_skip_ratio.cpp \
tests/shift_torque_reduction/shift_torque_reduction_test_base.cpp \
tests/shift_torque_reduction/flat_shift_condition_test_base.cpp \
tests/shift_torque_reduction/test_shift_torque_reduction_trigger_pin_state.cpp \
tests/shift_torque_reduction/test_shift_torque_reduction_time_condition.cpp \

View File

@ -10,6 +10,68 @@ EngineConfig EngineConfig::clone() const {
return *this;
}
EngineConfig EngineConfig::setLaunchActivatePin(const std::optional<switch_input_pin_e> value) {
m_launchActivatePin = value;
return *this;
}
EngineConfig EngineConfig::setLaunchActivateInverted(const std::optional<bool> value) {
m_launchActivateInverted = value;
return *this;
}
EngineConfig EngineConfig::setTorqueReductionEnabled(const std::optional<bool> value) {
m_isTorqueReductionEnabled = value;
return *this;
}
EngineConfig EngineConfig::setTorqueReductionActivationMode(
const std::optional<torqueReductionActivationMode_e> value
) {
m_torqueReductionActivationMode = value;
return *this;
}
EngineConfig EngineConfig::setTorqueReductionTriggerPin(const std::optional<switch_input_pin_e> value) {
m_torqueReductionTriggerPin = value;
return *this;
}
EngineConfig EngineConfig::setTorqueReductionTriggerPinInverted(const std::optional<bool> value) {
m_torqueReductionTriggerPinInverted = value;
return *this;
}
EngineConfig EngineConfig::setLimitTorqueReductionTime(std::optional<bool> value) {
m_limitTorqueReductionTime = value;
return *this;
}
EngineConfig EngineConfig::setTorqueReductionTime(const std::optional<float> value) {
m_torqueReductionTime = value;
return *this;
}
EngineConfig EngineConfig::setTorqueReductionArmingRpm(std::optional<float> value) {
m_torqueReductionArmingRpm = value;
return *this;
}
EngineConfig EngineConfig::setTorqueReductionArmingApp(std::optional<float> value) {
m_torqueReductionArmingApp = value;
return *this;
}
EngineConfig EngineConfig::setTorqueReductionIgnitionCut(const std::optional<int8_t> value) {
m_torqueReductionIgnitionCut = value;
return *this;
}
EngineConfig EngineConfig::setTorqueReductionIgnitionRetard(const std::optional<float> value) {
m_torqueReductionIgnitionRetard = value;
return *this;
}
EngineConfig EngineConfig::setInjectorFlowAsMassFlow(const std::optional<bool> injectorFlowAsMassFlow) {
m_injectorFlowAsMassFlow = injectorFlowAsMassFlow;
return *this;

View File

@ -10,6 +10,24 @@ class EngineConfig {
public:
EngineConfig clone() const;
// Launch Control
std::optional<switch_input_pin_e> getLaunchActivatePin() const { return m_launchActivatePin; }
std::optional<bool> getLaunchActivateInverted() const { return m_launchActivateInverted; }
// Shift Torque Reduction (Flat Shift)
std::optional<bool> getTorqueReductionEnabled() const { return m_isTorqueReductionEnabled; }
std::optional<torqueReductionActivationMode_e> getTorqueReductionActivationMode() const {
return m_torqueReductionActivationMode;
}
std::optional<switch_input_pin_e> getTorqueReductionTriggerPin() const { return m_torqueReductionTriggerPin; }
std::optional<bool> getTorqueReductionTriggerPinInverted() const { return m_torqueReductionTriggerPinInverted; }
std::optional<bool> getLimitTorqueReductionTime() const { return m_limitTorqueReductionTime; }
std::optional<float> getTorqueReductionTime() const { return m_torqueReductionTime; }
std::optional<float> getTorqueReductionArmingRpm() const { return m_torqueReductionArmingRpm; }
std::optional<float> getTorqueReductionArmingApp() const { return m_torqueReductionArmingApp; }
std::optional<int8_t> getTorqueReductionIgnitionCut() const { return m_torqueReductionIgnitionCut; }
std::optional<float> getTorqueReductionIgnitionRetard() const { return m_torqueReductionIgnitionRetard; }
// Injector
std::optional<float> getInjectorFlow() const { return m_injectorFlow; }
std::optional<BattLagCorrCurve> getInjectorBattLagCorr() const { return m_injectorBattLagCorrCurve; }
@ -25,6 +43,22 @@ public:
// We do not core about performance in tests, but we want to use builder-like style, so setters return new instance
// of configuration:
// Launch Control
EngineConfig setLaunchActivatePin(std::optional<switch_input_pin_e> value);
EngineConfig setLaunchActivateInverted(std::optional<bool> value);
// Shift Torque Reduction (Flat Shift)
EngineConfig setTorqueReductionEnabled(std::optional<bool> value);
EngineConfig setTorqueReductionActivationMode(std::optional<torqueReductionActivationMode_e> value);
EngineConfig setTorqueReductionTriggerPin(std::optional<switch_input_pin_e> value);
EngineConfig setTorqueReductionTriggerPinInverted(std::optional<bool> value);
EngineConfig setLimitTorqueReductionTime(std::optional<bool> value);
EngineConfig setTorqueReductionTime(std::optional<float> value);
EngineConfig setTorqueReductionArmingRpm(std::optional<float> value);
EngineConfig setTorqueReductionArmingApp(std::optional<float> value);
EngineConfig setTorqueReductionIgnitionCut(std::optional<int8_t> value);
EngineConfig setTorqueReductionIgnitionRetard(std::optional<float> value);
// Injector
EngineConfig setInjectorFlowAsMassFlow(std::optional<bool> injectorFlowAsMassFlow);
EngineConfig setInjectorFlow(std::optional<float> flow);
@ -37,6 +71,22 @@ public:
// Staged injection
EngineConfig setStagedInjectionEnabled(std::optional<bool> value);
private:
// Launch Control
std::optional<switch_input_pin_e> m_launchActivatePin;
std::optional<bool> m_launchActivateInverted;
// Shift Torque Reduction (Flat Shift)
std::optional<bool> m_isTorqueReductionEnabled;
std::optional<torqueReductionActivationMode_e> m_torqueReductionActivationMode;
std::optional<switch_input_pin_e> m_torqueReductionTriggerPin;
std::optional<bool> m_torqueReductionTriggerPinInverted;
std::optional<bool> m_limitTorqueReductionTime;
std::optional<float> m_torqueReductionTime;
std::optional<float> m_torqueReductionArmingRpm;
std::optional<float> m_torqueReductionArmingApp;
std::optional<int8_t> m_torqueReductionIgnitionCut;
std::optional<float> m_torqueReductionIgnitionRetard;
// Injector
std::optional<float> m_injectorFlow;
std::optional<BattLagCorrCurve> m_injectorBattLagCorrCurve;

View File

@ -27,6 +27,22 @@ TestEngineState& TestBase::getTestEngineState() {
}
void TestBase::setUpEngineConfiguration(const EngineConfig& config) {
// Launch Control
getTestEngineConfiguration().configureLaunchActivatePin(config.getLaunchActivatePin());
getTestEngineConfiguration().configureLaunchActivateInverted(config.getLaunchActivateInverted());
// Shift Torque Reduction (Flat Shift)
getTestEngineConfiguration().configureTorqueReductionEnabled(config.getTorqueReductionEnabled());
getTestEngineConfiguration().configureTorqueReductionActivationMode(config.getTorqueReductionActivationMode());
getTestEngineConfiguration().configureTorqueReductionTriggerPin(config.getTorqueReductionTriggerPin());
getTestEngineConfiguration().configureTorqueReductionButtonInverted(config.getTorqueReductionTriggerPinInverted());
getTestEngineConfiguration().configureLimitTorqueReductionTime(config.getLimitTorqueReductionTime());
getTestEngineConfiguration().configureTorqueReductionTime(config.getTorqueReductionTime());
getTestEngineConfiguration().configureTorqueReductionArmingRpm(config.getTorqueReductionArmingRpm());
getTestEngineConfiguration().configureTorqueReductionArmingApp(config.getTorqueReductionArmingApp());
getTestEngineConfiguration().configureTorqueReductionIgnitionCut(config.getTorqueReductionIgnitionCut());
getTestEngineConfiguration().configureTorqueReductionIgnitionRetard(config.getTorqueReductionIgnitionRetard());
// Injector
getTestEngineConfiguration().configureInjectorFlowAsMassFlow(config.getInjectorFlowAsMassFlow());
getTestEngineConfiguration().configureInjectorFlow(config.getInjectorFlow());