ETB duty cycle jitter #4833

weird, whatever for now :(
This commit is contained in:
Andrey 2022-11-27 20:54:59 -05:00
parent a10542a3d6
commit 61de170d06
2 changed files with 9 additions and 3 deletions

View File

@ -208,7 +208,7 @@ bool EtbController::init(etb_function_e function, DcMotor *motor, pid_s *pidPara
// Ignore 3% position error before complaining
m_errorAccumulator.init(3.0f, etbPeriodSeconds);
// m_dutyIntegrator.init(engineConfiguration->etbDutyThreshold, etbPeriodSeconds);
m_dutyIntegrator.init(engineConfiguration->etbDutyThreshold, etbPeriodSeconds);
reset();

View File

@ -561,6 +561,10 @@ TEST(etb, setpointLuaAdder) {
}
TEST(etb, etbTpsSensor) {
static engine_configuration_s localConfig;
// huh? how is this breaking the test? EngineTestHelper eth(TEST_ENGINE);
engineConfiguration = &localConfig;
// Throw some distinct values on the TPS sensors so we can identify that we're getting the correct one
Sensor::setMockValue(SensorType::Tps1, 25.0f, true);
Sensor::setMockValue(SensorType::Tps2, 75.0f, true);
@ -586,7 +590,6 @@ TEST(etb, etbTpsSensor) {
// Test wastegate control
{
// EngineTestHelper eth(TEST_ENGINE);
EtbController etb;
etb.init(ETB_Wastegate, nullptr, nullptr, nullptr, true);
EXPECT_EQ(etb.observePlant().Value, 33.0f);
@ -594,11 +597,11 @@ TEST(etb, etbTpsSensor) {
// Test idle valve control
{
// EngineTestHelper eth(TEST_ENGINE);
EtbController etb;
etb.init(ETB_IdleValve, nullptr, nullptr, nullptr, true);
EXPECT_EQ(etb.observePlant().Value, 66.0f);
}
engineConfiguration = nullptr;
}
TEST(etb, setOutputInvalid) {
@ -743,7 +746,9 @@ TEST(etb, setOutputLimpHome) {
}
TEST(etb, closedLoopPid) {
static engine_configuration_s localConfig;
// huh? how is this breaking the test? EngineTestHelper eth(TEST_ENGINE);
engineConfiguration = &localConfig;
pid_s pid = {};
pid.pFactor = 5;
pid.maxValue = 75;
@ -770,6 +775,7 @@ TEST(etb, closedLoopPid) {
// Test PID limiting
EXPECT_FLOAT_EQ(etb.getClosedLoop(50, 70).value_or(-1), -60);
EXPECT_FLOAT_EQ(etb.getClosedLoop(50, 30).value_or(-1), 75);
engineConfiguration = nullptr;
}
TEST(etb, openLoopThrottle) {