diff --git a/firmware/controllers/actuators/boost_control.cpp b/firmware/controllers/actuators/boost_control.cpp index 1b07502cdc..5c41624698 100644 --- a/firmware/controllers/actuators/boost_control.cpp +++ b/firmware/controllers/actuators/boost_control.cpp @@ -67,6 +67,12 @@ expected BoostController::observePlant() const { } expected 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); diff --git a/unit_tests/tests/test_boost.cpp b/unit_tests/tests/test_boost.cpp index 0ee8b94d96..20eb7bdfcc 100644 --- a/unit_tests/tests/test_boost.cpp +++ b/unit_tests/tests/test_boost.cpp @@ -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);