don't start boost pwm unnecessarily (#3767)
* don't start boost pwm unnecessarily * test
This commit is contained in:
parent
eb023376dc
commit
3e56bacef9
|
@ -133,6 +133,11 @@ expected<percent_t> BoostController::getClosedLoop(float target, float manifoldP
|
|||
void BoostController::setOutput(expected<float> output) {
|
||||
percent_t percent = output.value_or(engineConfiguration->boostControlSafeDutyCycle);
|
||||
|
||||
if (!engineConfiguration->isBoostControlEnabled) {
|
||||
// If not enabled, force 0% output
|
||||
percent = 0;
|
||||
}
|
||||
|
||||
#if EFI_TUNER_STUDIO
|
||||
engine->outputChannels.boostControllerOutput = percent;
|
||||
#endif /* EFI_TUNER_STUDIO */
|
||||
|
@ -190,7 +195,7 @@ void setDefaultBoostParameters() {
|
|||
void startBoostPin() {
|
||||
#if !EFI_UNIT_TEST
|
||||
// Only init if a pin is set, no need to start PWM without a pin
|
||||
if (!isBrainPinValid(engineConfiguration->boostControlPin)) {
|
||||
if (!engineConfiguration->isBoostControlEnabled || !isBrainPinValid(engineConfiguration->boostControlPin)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -200,7 +205,7 @@ void startBoostPin() {
|
|||
&engine->executor,
|
||||
&enginePins.boostPin,
|
||||
engineConfiguration->boostPwmFrequency,
|
||||
0.5f
|
||||
0
|
||||
);
|
||||
#endif /* EFI_UNIT_TEST */
|
||||
}
|
||||
|
|
|
@ -109,6 +109,8 @@ TEST(BoostControl, ClosedLoop) {
|
|||
TEST(BoostControl, SetOutput) {
|
||||
EngineTestHelper eth(TEST_ENGINE);
|
||||
|
||||
engineConfiguration->isBoostControlEnabled = true;
|
||||
|
||||
StrictMock<MockPwm> pwm;
|
||||
StrictMock<MockEtb> etb;
|
||||
BoostController bc;
|
||||
|
|
Loading…
Reference in New Issue