only setup etb if primary sensor configured instead of proxy (#1489)

* only setup etb if primary sensor configured instead of proxy

* fix test

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
Matthew Kennedy 2020-06-16 18:38:09 -07:00 committed by GitHub
parent 6d8f765b56
commit 65625deb32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -736,7 +736,7 @@ void doInitElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#endif /* EFI_PROD_CODE */
// If you don't have a pedal, we have no business here.
if (!Sensor::hasSensor(SensorType::AcceleratorPedal)) {
if (!Sensor::hasSensor(SensorType::AcceleratorPedalPrimary)) {
return;
}

View File

@ -43,6 +43,7 @@ TEST(etb, initializationSingleThrottle) {
// Must have a sensor configured before init
Sensor::setMockValue(SensorType::AcceleratorPedal, 0);
Sensor::setMockValue(SensorType::AcceleratorPedalPrimary, 0);
// Expect mock0 to be init with index 0, and PID params
EXPECT_CALL(mocks[0], init(_, 0, &engineConfiguration->etb, Ne(nullptr)));
@ -65,6 +66,7 @@ TEST(etb, initializationDualThrottle) {
// Must have a sensor configured before init
Sensor::setMockValue(SensorType::AcceleratorPedal, 0);
Sensor::setMockValue(SensorType::AcceleratorPedalPrimary, 0);
// The presence of a second TPS indicates dual throttle
Sensor::setMockValue(SensorType::Tps2, 25.0f);