only: refactoring: extract part of `A/C Settings` default values to `engine_configuration_defaults` namespace
This commit is contained in:
parent
29485ad97b
commit
c3d95a5849
|
@ -629,9 +629,9 @@ static void setDefaultEngineConfiguration() {
|
|||
engineConfiguration->isWaveAnalyzerEnabled = true;
|
||||
|
||||
engineConfiguration->acIdleRpmTarget = 900;
|
||||
engineConfiguration->acDelay = 0.5;
|
||||
engineConfiguration->minAcPressure = 100;
|
||||
engineConfiguration->maxAcPressure = 300;
|
||||
engineConfiguration->acDelay = engine_configuration_defaults::AC_DELAY;
|
||||
engineConfiguration->minAcPressure = engine_configuration_defaults::MIN_AC_PRESSURE;
|
||||
engineConfiguration->maxAcPressure = engine_configuration_defaults::MAX_AC_PRESSURE;
|
||||
engineConfiguration->acPressureEnableHyst = engine_configuration_defaults::AC_PRESSURE_ENABLE_HYST;
|
||||
engineConfiguration->acIdleExtraOffset = 15;
|
||||
|
||||
|
|
|
@ -5,5 +5,9 @@
|
|||
#pragma once
|
||||
|
||||
namespace engine_configuration_defaults {
|
||||
/* A/C Settings: */
|
||||
constexpr float AC_DELAY = 0.5f;
|
||||
constexpr uint16_t MIN_AC_PRESSURE = 100;
|
||||
constexpr uint16_t MAX_AC_PRESSURE = 300;
|
||||
constexpr float AC_PRESSURE_ENABLE_HYST = 10.0f;
|
||||
}
|
||||
|
|
|
@ -184,32 +184,32 @@ namespace {
|
|||
/* config = */ { {}, {}, { 0.0f } },
|
||||
/* testData = */ {
|
||||
{
|
||||
"acPressure = (DEFAULT_MIN_AC_PRESSURE + DEFAULT_MAX_AC_PRESSURE) / 2.0",
|
||||
(DEFAULT_MIN_AC_PRESSURE + DEFAULT_MAX_AC_PRESSURE) / 2.0,
|
||||
"acPressure = (engine_configuration_defaults::MIN_AC_PRESSURE + engine_configuration_defaults::MAX_AC_PRESSURE) / 2.0",
|
||||
(engine_configuration_defaults::MIN_AC_PRESSURE + engine_configuration_defaults::MAX_AC_PRESSURE) / 2.0,
|
||||
false,
|
||||
false
|
||||
},
|
||||
{
|
||||
"acPressure = DEFAULT_MAX_AC_PRESSURE",
|
||||
DEFAULT_MAX_AC_PRESSURE,
|
||||
"acPressure = engine_configuration_defaults::MAX_AC_PRESSURE",
|
||||
engine_configuration_defaults::MAX_AC_PRESSURE,
|
||||
false,
|
||||
false
|
||||
},
|
||||
{
|
||||
"acPressure = DEFAULT_MAX_AC_PRESSURE + EPS4D",
|
||||
DEFAULT_MAX_AC_PRESSURE + EPS4D,
|
||||
"acPressure = engine_configuration_defaults::MAX_AC_PRESSURE + EPS4D",
|
||||
engine_configuration_defaults::MAX_AC_PRESSURE + EPS4D,
|
||||
false,
|
||||
true
|
||||
},
|
||||
{
|
||||
"acPressure = DEFAULT_MAX_AC_PRESSURE",
|
||||
DEFAULT_MAX_AC_PRESSURE,
|
||||
"acPressure = engine_configuration_defaults::MAX_AC_PRESSURE",
|
||||
engine_configuration_defaults::MAX_AC_PRESSURE,
|
||||
false,
|
||||
true
|
||||
},
|
||||
{
|
||||
"acPressure = DEFAULT_MAX_AC_PRESSURE - EPS4D",
|
||||
DEFAULT_MAX_AC_PRESSURE - EPS4D,
|
||||
"acPressure = engine_configuration_defaults::MAX_AC_PRESSURE - EPS4D",
|
||||
engine_configuration_defaults::MAX_AC_PRESSURE - EPS4D,
|
||||
false,
|
||||
false
|
||||
}
|
||||
|
@ -223,37 +223,37 @@ namespace {
|
|||
/* testData = */ {
|
||||
{
|
||||
"acPressure = (DEFAULT_MIN_AC_PRESSURE + DEFAULT_MAX_AC_PRESSURE) / 2.0",
|
||||
(DEFAULT_MIN_AC_PRESSURE + DEFAULT_MAX_AC_PRESSURE) / 2.0,
|
||||
(engine_configuration_defaults::MIN_AC_PRESSURE + engine_configuration_defaults::MAX_AC_PRESSURE) / 2.0,
|
||||
false,
|
||||
false
|
||||
},
|
||||
{
|
||||
"acPressure = DEFAULT_MIN_AC_PRESSURE - DEADBAND_WIDTH",
|
||||
DEFAULT_MIN_AC_PRESSURE - DEADBAND_WIDTH,
|
||||
"acPressure = engine_configuration_defaults::MIN_AC_PRESSURE - DEADBAND_WIDTH",
|
||||
engine_configuration_defaults::MIN_AC_PRESSURE - DEADBAND_WIDTH,
|
||||
false,
|
||||
false
|
||||
},
|
||||
{
|
||||
"acPressure = DEFAULT_MIN_AC_PRESSURE - DEADBAND_WIDTH - EPS5D",
|
||||
DEFAULT_MIN_AC_PRESSURE - DEADBAND_WIDTH - EPS5D,
|
||||
"acPressure = engine_configuration_defaults::MIN_AC_PRESSURE - DEADBAND_WIDTH - EPS5D",
|
||||
engine_configuration_defaults::MIN_AC_PRESSURE - DEADBAND_WIDTH - EPS5D,
|
||||
true,
|
||||
false
|
||||
},
|
||||
{
|
||||
"acPressure = DEFAULT_MIN_AC_PRESSURE",
|
||||
DEFAULT_MIN_AC_PRESSURE,
|
||||
"acPressure = engine_configuration_defaults::MIN_AC_PRESSURE",
|
||||
engine_configuration_defaults::MIN_AC_PRESSURE,
|
||||
true,
|
||||
false
|
||||
},
|
||||
{
|
||||
"acPressure = DEFAULT_MIN_AC_PRESSURE + DEADBAND_WIDTH",
|
||||
DEFAULT_MIN_AC_PRESSURE + DEADBAND_WIDTH,
|
||||
"acPressure = engine_configuration_defaults::MIN_AC_PRESSURE + DEADBAND_WIDTH",
|
||||
engine_configuration_defaults::MIN_AC_PRESSURE + DEADBAND_WIDTH,
|
||||
true,
|
||||
false
|
||||
},
|
||||
{
|
||||
"acPressure = DEFAULT_MIN_AC_PRESSURE + DEADBAND_WIDTH + EPS5D",
|
||||
DEFAULT_MIN_AC_PRESSURE + DEADBAND_WIDTH + EPS5D,
|
||||
"acPressure = engine_configuration_defaults::MIN_AC_PRESSURE + DEADBAND_WIDTH + EPS5D",
|
||||
engine_configuration_defaults::MIN_AC_PRESSURE + DEADBAND_WIDTH + EPS5D,
|
||||
false,
|
||||
false
|
||||
}
|
||||
|
@ -266,32 +266,32 @@ namespace {
|
|||
/* config = */ DEFAULT_AC_PRESSURE_CONFIG,
|
||||
/* testData = */ {
|
||||
{
|
||||
"acPressure = (DEFAULT_MIN_AC_PRESSURE + DEFAULT_MAX_AC_PRESSURE) / 2.0",
|
||||
(DEFAULT_MIN_AC_PRESSURE + DEFAULT_MAX_AC_PRESSURE) / 2.0,
|
||||
"acPressure = (engine_configuration_defaults::MIN_AC_PRESSURE + engine_configuration_defaults::MAX_AC_PRESSURE) / 2.0",
|
||||
(engine_configuration_defaults::MIN_AC_PRESSURE + engine_configuration_defaults::MAX_AC_PRESSURE) / 2.0,
|
||||
false,
|
||||
false
|
||||
},
|
||||
{
|
||||
"acPressure = DEFAULT_MAX_AC_PRESSURE",
|
||||
DEFAULT_MAX_AC_PRESSURE,
|
||||
"acPressure = engine_configuration_defaults::MAX_AC_PRESSURE",
|
||||
engine_configuration_defaults::MAX_AC_PRESSURE,
|
||||
false,
|
||||
false
|
||||
},
|
||||
{
|
||||
"acPressure = DEFAULT_MAX_AC_PRESSURE + EPS4D",
|
||||
DEFAULT_MAX_AC_PRESSURE + EPS4D,
|
||||
"acPressure = engine_configuration_defaults::MAX_AC_PRESSURE + EPS4D",
|
||||
engine_configuration_defaults::MAX_AC_PRESSURE + EPS4D,
|
||||
false,
|
||||
true
|
||||
},
|
||||
{
|
||||
"acPressure = DEFAULT_MAX_AC_PRESSURE - engine_configuration_defaults::AC_PRESSURE_ENABLE_HYST",
|
||||
DEFAULT_MAX_AC_PRESSURE - engine_configuration_defaults::AC_PRESSURE_ENABLE_HYST,
|
||||
"acPressure = engine_configuration_defaults::MAX_AC_PRESSURE - engine_configuration_defaults::AC_PRESSURE_ENABLE_HYST",
|
||||
engine_configuration_defaults::MAX_AC_PRESSURE - engine_configuration_defaults::AC_PRESSURE_ENABLE_HYST,
|
||||
false,
|
||||
true
|
||||
},
|
||||
{
|
||||
"acPressure = DEFAULT_MAX_AC_PRESSURE - engine_configuration_defaults::AC_PRESSURE_ENABLE_HYST - EPS4D",
|
||||
DEFAULT_MAX_AC_PRESSURE - engine_configuration_defaults::AC_PRESSURE_ENABLE_HYST - EPS4D,
|
||||
"acPressure = engine_configuration_defaults::MAX_AC_PRESSURE - engine_configuration_defaults::AC_PRESSURE_ENABLE_HYST - EPS4D",
|
||||
engine_configuration_defaults::MAX_AC_PRESSURE - engine_configuration_defaults::AC_PRESSURE_ENABLE_HYST - EPS4D,
|
||||
false,
|
||||
false
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ void AcTestBase::configureAcDelay(const std::optional<float> acDelay) {
|
|||
if (acDelay.has_value()) {
|
||||
engineConfiguration->acDelay = acDelay.value();
|
||||
} else {
|
||||
ASSERT_EQ(engineConfiguration->acDelay, DEFAULT_AC_DELAY); // check default value
|
||||
ASSERT_EQ(engineConfiguration->acDelay, engine_configuration_defaults::AC_DELAY); // check default value
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ void AcTestBase::configureMinAcPressure(const std::optional<uint16_t> minAcPress
|
|||
if (minAcPressure.has_value()) {
|
||||
engineConfiguration->minAcPressure = minAcPressure.value();
|
||||
} else {
|
||||
ASSERT_EQ(engineConfiguration->minAcPressure, DEFAULT_MIN_AC_PRESSURE); // check default value
|
||||
ASSERT_EQ(engineConfiguration->minAcPressure, engine_configuration_defaults::MIN_AC_PRESSURE); // check default value
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ void AcTestBase::configureMaxAcPressure(const std::optional<uint16_t> maxAcPress
|
|||
if (maxAcPressure.has_value()) {
|
||||
engineConfiguration->maxAcPressure = maxAcPressure.value();
|
||||
} else {
|
||||
ASSERT_EQ(engineConfiguration->maxAcPressure, DEFAULT_MAX_AC_PRESSURE); // check default value
|
||||
ASSERT_EQ(engineConfiguration->maxAcPressure, engine_configuration_defaults::MAX_AC_PRESSURE); // check default value
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,10 +26,6 @@ private:
|
|||
|
||||
class AcTestBase : public TestBase {
|
||||
protected:
|
||||
constexpr static float DEFAULT_AC_DELAY = 0.5f;
|
||||
constexpr static uint16_t DEFAULT_MIN_AC_PRESSURE = 100;
|
||||
constexpr static uint16_t DEFAULT_MAX_AC_PRESSURE = 300;
|
||||
|
||||
void updateAcPressure(float acPressure);
|
||||
|
||||
void setUpTestConfig(const AcTestConfig& config);
|
||||
|
|
Loading…
Reference in New Issue