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) {
|
void BoostController::setOutput(expected<float> output) {
|
||||||
percent_t percent = output.value_or(engineConfiguration->boostControlSafeDutyCycle);
|
percent_t percent = output.value_or(engineConfiguration->boostControlSafeDutyCycle);
|
||||||
|
|
||||||
|
if (!engineConfiguration->isBoostControlEnabled) {
|
||||||
|
// If not enabled, force 0% output
|
||||||
|
percent = 0;
|
||||||
|
}
|
||||||
|
|
||||||
#if EFI_TUNER_STUDIO
|
#if EFI_TUNER_STUDIO
|
||||||
engine->outputChannels.boostControllerOutput = percent;
|
engine->outputChannels.boostControllerOutput = percent;
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
|
@ -190,7 +195,7 @@ void setDefaultBoostParameters() {
|
||||||
void startBoostPin() {
|
void startBoostPin() {
|
||||||
#if !EFI_UNIT_TEST
|
#if !EFI_UNIT_TEST
|
||||||
// Only init if a pin is set, no need to start PWM without a pin
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +205,7 @@ void startBoostPin() {
|
||||||
&engine->executor,
|
&engine->executor,
|
||||||
&enginePins.boostPin,
|
&enginePins.boostPin,
|
||||||
engineConfiguration->boostPwmFrequency,
|
engineConfiguration->boostPwmFrequency,
|
||||||
0.5f
|
0
|
||||||
);
|
);
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,6 +109,8 @@ TEST(BoostControl, ClosedLoop) {
|
||||||
TEST(BoostControl, SetOutput) {
|
TEST(BoostControl, SetOutput) {
|
||||||
EngineTestHelper eth(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
|
engineConfiguration->isBoostControlEnabled = true;
|
||||||
|
|
||||||
StrictMock<MockPwm> pwm;
|
StrictMock<MockPwm> pwm;
|
||||||
StrictMock<MockEtb> etb;
|
StrictMock<MockEtb> etb;
|
||||||
BoostController bc;
|
BoostController bc;
|
||||||
|
|
Loading…
Reference in New Issue