Boost tolerance (#1986)

* tolerate invalid closed loop config when in open loop mode

* fix test
This commit is contained in:
Matthew Kennedy 2020-11-25 04:27:24 -08:00 committed by GitHub
parent 808aa672ba
commit 492498f8d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -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);

View File

@ -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);