mirror of https://github.com/rusefi/rusefi-1.git
limp manager can disable etb (#2143)
* move rev limit to limp manager * call fatal error * include order * fix bug * tests * limp can disable etb Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
parent
898b7a82e0
commit
64d9b4b71a
|
@ -458,11 +458,14 @@ void EtbController::setOutput(expected<percent_t> outputValue) {
|
||||||
|
|
||||||
if (!m_motor) return;
|
if (!m_motor) return;
|
||||||
|
|
||||||
// If output is valid and we aren't paused, output to motor.
|
// If ETB is allowed, output is valid, and we aren't paused, output to motor.
|
||||||
if (outputValue && !engineConfiguration->pauseEtbControl) {
|
if (ENGINE(limpManager).allowElectronicThrottle()
|
||||||
|
&& outputValue
|
||||||
|
&& !engineConfiguration->pauseEtbControl) {
|
||||||
m_motor->enable();
|
m_motor->enable();
|
||||||
m_motor->set(ETB_PERCENT_TO_DUTY(outputValue.Value));
|
m_motor->set(ETB_PERCENT_TO_DUTY(outputValue.Value));
|
||||||
} else {
|
} else {
|
||||||
|
// Otherwise disable the motor.
|
||||||
m_motor->disable();
|
m_motor->disable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -529,6 +529,26 @@ TEST(etb, setOutputPauseControl) {
|
||||||
etb.setOutput(25.0f);
|
etb.setOutput(25.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(etb, setOutputLimpHome) {
|
||||||
|
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||||
|
StrictMock<MockMotor> motor;
|
||||||
|
|
||||||
|
// Must have TPS initialized for ETB setup
|
||||||
|
Sensor::setMockValue(SensorType::Tps1, 0.0f, true);
|
||||||
|
|
||||||
|
EtbController etb;
|
||||||
|
INJECT_ENGINE_REFERENCE(&etb);
|
||||||
|
etb.init(ETB_Throttle1, &motor, nullptr, nullptr, true);
|
||||||
|
|
||||||
|
// Should be disabled when in ETB limp mode
|
||||||
|
EXPECT_CALL(motor, disable());
|
||||||
|
|
||||||
|
// Trip a fatal error
|
||||||
|
ENGINE(limpManager).fatalError();
|
||||||
|
|
||||||
|
etb.setOutput(25.0f);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(etb, closedLoopPid) {
|
TEST(etb, closedLoopPid) {
|
||||||
pid_s pid = {};
|
pid_s pid = {};
|
||||||
pid.pFactor = 5;
|
pid.pFactor = 5;
|
||||||
|
|
Loading…
Reference in New Issue