Boost tolerance (#1986)
* tolerate invalid closed loop config when in open loop mode * fix test
This commit is contained in:
parent
808aa672ba
commit
492498f8d0
|
@ -67,6 +67,12 @@ expected<float> BoostController::observePlant() const {
|
|||
}
|
||||
|
||||
expected<float> BoostController::getSetpoint() const {
|
||||
// If we're in open loop only mode, disregard any target computation.
|
||||
// Open loop needs to work even in case of invalid closed loop config
|
||||
if (engineConfiguration->boostType != CLOSED_LOOP) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
float rpm = GET_RPM();
|
||||
|
||||
auto tps = Sensor::get(SensorType::DriverThrottleIntent);
|
||||
|
|
|
@ -15,6 +15,7 @@ TEST(BoostControl, Setpoint) {
|
|||
.WillRepeatedly([](float xRpm, float tps) { return tps * 2; });
|
||||
|
||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||
engineConfiguration->boostType = CLOSED_LOOP;
|
||||
|
||||
BoostController bc;
|
||||
INJECT_ENGINE_REFERENCE(&bc);
|
||||
|
|
Loading…
Reference in New Issue