fix etb wastegate percent output (#1988)

* wastegate etb should use percent

* percent_t

* fix test
This commit is contained in:
Matthew Kennedy 2020-11-25 18:14:06 -08:00 committed by GitHub
parent e356ee7f45
commit 750070a496
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -146,13 +146,14 @@ expected<percent_t> BoostController::getClosedLoop(float target, float manifoldP
void BoostController::setOutput(expected<float> output) {
// TODO: hook up safe duty cycle
float duty = PERCENT_TO_DUTY(output.value_or(/*CONFIG(boostControlSafeDutyCycle)*/ 0));
percent_t percent = output.value_or(/*CONFIG(boostControlSafeDutyCycle)*/ 0);
float duty = PERCENT_TO_DUTY(percent);
if (m_pwm) {
m_pwm->setSimplePwmDutyCycle(duty);
}
setEtbWastegatePosition(duty PASS_ENGINE_PARAMETER_SUFFIX);
setEtbWastegatePosition(percent PASS_ENGINE_PARAMETER_SUFFIX);
}
void BoostController::PeriodicTask() {

View File

@ -115,7 +115,7 @@ TEST(BoostControl, SetOutput) {
INJECT_ENGINE_REFERENCE(&bc);
// ETB wastegate position & PWM should both be set
EXPECT_CALL(etb, setWastegatePosition(0.25f));
EXPECT_CALL(etb, setWastegatePosition(25.0f));
EXPECT_CALL(pwm, setSimplePwmDutyCycle(0.25f));
// Don't crash if not init'd (don't deref null ptr m_pwm)