Skip to content

Commit

Permalink
ETB overheats due to constant isTpsError true/false/true/false jitter #…
Browse files Browse the repository at this point in the history
  • Loading branch information
rusefillc committed Nov 29, 2022
1 parent fee886b commit 607a567
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion firmware/controllers/actuators/electronic_throttle.cpp
Expand Up @@ -259,7 +259,7 @@ expected<percent_t> EtbController::getSetpoint() {
expected<percent_t> EtbController::getSetpointIdleValve() const {
// VW ETB idle mode uses an ETB only for idle (a mini-ETB sets the lower stop, and a normal cable
// can pull the throttle up off the stop.), so we directly control the throttle with the idle position.
#if EFI_TUNER_STUDIO && (EFI_PROD_CODE || EFI_SIMULATOR)
#if EFI_TUNER_STUDIO
engine->outputChannels.etbTarget = m_idlePosition;
#endif // EFI_TUNER_STUDIO
return clampF(0, m_idlePosition, 100);
Expand Down
3 changes: 2 additions & 1 deletion firmware/controllers/actuators/electronic_throttle_impl.h
Expand Up @@ -71,6 +71,8 @@ class EtbController : public IEtbController, public electronic_throttle_s {
void setLuaAdjustment(percent_t adjustment) override;
float getLuaAdjustment() const;

float prevOutput = 0;

protected:
// This is set if an automatic TPS calibration should be run
bool m_isAutocal = false;
Expand All @@ -90,7 +92,6 @@ class EtbController : public IEtbController, public electronic_throttle_s {

ExpAverage m_dutyRocAverage;
ExpAverage m_dutyAverage;
float prevOutput = 0;

// Pedal -> target map
const ValueProvider3D* m_pedalMap = nullptr;
Expand Down
31 changes: 31 additions & 0 deletions unit_tests/tests/actuators/test_etb_integrated.cpp
@@ -0,0 +1,31 @@
#include "pch.h"
#include "init.h"
#include "electronic_throttle_impl.h"

TEST(etb, integrated) {
EngineTestHelper eth(TEST_ENGINE);

engineConfiguration->tps1_1AdcChannel = EFI_ADC_3;
engineConfiguration->tps1_2AdcChannel = EFI_ADC_3;

engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_3;
engineConfiguration->throttlePedalPositionSecondAdcChannel = EFI_ADC_3;

Sensor::setMockValue(SensorType::AcceleratorPedalPrimary, 40);
Sensor::setMockValue(SensorType::AcceleratorPedalSecondary, 40);

Sensor::setMockValue(SensorType::Tps1, 25.0f, true);


initTps();
doInitElectronicThrottle();

EtbController *etb = (EtbController*)engine->etbControllers[0];
etb->update();



ASSERT_EQ(engine->outputChannels.etbTarget, 40);
ASSERT_EQ(etb->prevOutput, 100);

}
1 change: 1 addition & 0 deletions unit_tests/tests/tests.mk
Expand Up @@ -107,6 +107,7 @@ TESTS_SRC_CPP = \
tests/actuators/test_boost.cpp \
tests/actuators/test_dc_motor.cpp \
tests/actuators/test_etb.cpp \
tests/actuators/test_etb_integrated.cpp \
tests/actuators/test_fan_control.cpp \
tests/actuators/test_fuel_pump.cpp \
tests/actuators/test_gppwm.cpp \
Expand Down

0 comments on commit 607a567

Please sign in to comment.