fix etb unit test idle hardware (#1991)

* move check to etb

* give it a sensor to read
This commit is contained in:
Matthew Kennedy 2020-11-26 16:21:42 -08:00 committed by GitHub
parent 3435d205b4
commit a5ba9d54dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 9 deletions

View File

@ -910,6 +910,11 @@ void initElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
}
void setEtbIdlePosition(percent_t pos DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (!Sensor::hasSensor(SensorType::AcceleratorPedal)) {
firmwareError(CUSTOM_NO_ETB_FOR_IDLE, "No ETB to use for idle");
return;
}
for (int i = 0; i < ETB_COUNT; i++) {
if (auto etb = engine->etbControllers[i]) {
etb->setIdlePosition(pos);

View File

@ -55,14 +55,6 @@ void applyIACposition(percent_t position DECLARE_ENGINE_PARAMETER_SUFFIX) {
float duty = PERCENT_TO_DUTY(position);
if (CONFIG(useETBforIdleControl)) {
if (!Sensor::hasSensor(SensorType::AcceleratorPedal)) {
//todo: something is wrong here in unit test mode?
#if !EFI_UNIT_TEST
firmwareError(CUSTOM_NO_ETB_FOR_IDLE, "No ETB to use for idle");
#endif
return;
}
#if EFI_ELECTRONIC_THROTTLE_BODY
setEtbIdlePosition(position PASS_ENGINE_PARAMETER_SUFFIX);
#endif // EFI_ELECTRONIC_THROTTLE_BODY

View File

@ -17,6 +17,8 @@
#include "sensor.h"
#include "mocks.h"
#include <unordered_map>
extern EnginePins enginePins;
class EngineTestHelperBase

View File

@ -9,7 +9,8 @@
#include "engine_controller.h"
TEST(start, startStop) {
WITH_ENGINE_TEST_HELPER(BMW_M73_PROTEUS);
std::unordered_map<SensorType, float> sensorVals = {{ SensorType::AcceleratorPedal, 0 }};
WITH_ENGINE_TEST_HELPER_SENS(BMW_M73_PROTEUS, sensorVals);
eth.smartMoveTimeForwardSeconds(1); // '0' time has special meaning for implementation so let's move forward
// this is a pull-up, so 'true' on start-up