fix etb wastegate percent output (#1988)
* wastegate etb should use percent * percent_t * fix test
This commit is contained in:
parent
e356ee7f45
commit
750070a496
|
@ -146,13 +146,14 @@ expected<percent_t> BoostController::getClosedLoop(float target, float manifoldP
|
||||||
|
|
||||||
void BoostController::setOutput(expected<float> output) {
|
void BoostController::setOutput(expected<float> output) {
|
||||||
// TODO: hook up safe duty cycle
|
// 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) {
|
if (m_pwm) {
|
||||||
m_pwm->setSimplePwmDutyCycle(duty);
|
m_pwm->setSimplePwmDutyCycle(duty);
|
||||||
}
|
}
|
||||||
|
|
||||||
setEtbWastegatePosition(duty PASS_ENGINE_PARAMETER_SUFFIX);
|
setEtbWastegatePosition(percent PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BoostController::PeriodicTask() {
|
void BoostController::PeriodicTask() {
|
||||||
|
|
|
@ -115,7 +115,7 @@ TEST(BoostControl, SetOutput) {
|
||||||
INJECT_ENGINE_REFERENCE(&bc);
|
INJECT_ENGINE_REFERENCE(&bc);
|
||||||
|
|
||||||
// ETB wastegate position & PWM should both be set
|
// 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));
|
EXPECT_CALL(pwm, setSimplePwmDutyCycle(0.25f));
|
||||||
|
|
||||||
// Don't crash if not init'd (don't deref null ptr m_pwm)
|
// Don't crash if not init'd (don't deref null ptr m_pwm)
|
||||||
|
|
Loading…
Reference in New Issue