ETB overheats due to constant isTpsError true/false/true/false jitter: this seems obvious enough to disable ETB at least on non running engine #4832

This commit is contained in:
rusefi 2022-11-29 22:39:55 -05:00
parent 4a35b55634
commit 1e7baa1089
3 changed files with 31 additions and 13 deletions

View File

@ -160,9 +160,10 @@ static percent_t directPwmValue = NAN;
// this macro clamps both positive and negative percentages from about -100% to 100%
#define ETB_PERCENT_TO_DUTY(x) (clampF(-ETB_DUTY_LIMIT, 0.01f * (x), ETB_DUTY_LIMIT))
bool EtbController::init(etb_function_e function, DcMotor *motor, pid_s *pidParameters, const ValueProvider3D* pedalMap, bool initializeThrottles) {
bool EtbController::init(etb_function_e function, DcMotor *motor, pid_s *pidParameters, const ValueProvider3D* pedalMap, bool hasPedal) {
if (function == ETB_None) {
// if not configured, don't init.
etbErrorCode = (int8_t)TpsState::NotConfigured;
return false;
}
@ -172,12 +173,14 @@ bool EtbController::init(etb_function_e function, DcMotor *motor, pid_s *pidPara
// If we are a throttle, require redundant TPS sensor
if (function == ETB_Throttle1 || function == ETB_Throttle2) {
// We don't need to init throttles, so nothing to do here.
if (!initializeThrottles) {
if (!hasPedal) {
etbErrorCode = (int8_t)TpsState::PpsError;
return false;
}
// If no sensor is configured for this throttle, skip initialization.
if (!Sensor::hasSensor(functionToTpsSensorPrimary(function))) {
etbErrorCode = (int8_t)TpsState::TpsError;
return false;
}
@ -188,6 +191,7 @@ bool EtbController::init(etb_function_e function, DcMotor *motor, pid_s *pidPara
Sensor::getSensorName(m_positionSensor)
);
etbErrorCode = (int8_t)TpsState::Redundancy;
return false;
}
@ -196,7 +200,7 @@ bool EtbController::init(etb_function_e function, DcMotor *motor, pid_s *pidPara
OBD_TPS_Configuration,
"Use of electronic throttle requires accelerator pedal to be redundant."
);
etbErrorCode = (int8_t)TpsState::Redundancy;
return false;
}
}
@ -536,7 +540,9 @@ void EtbController::setOutput(expected<percent_t> outputValue) {
}
#endif
if (!m_motor) return;
if (!m_motor) {
return;
}
// If ETB is allowed, output is valid, and we aren't paused, output to motor.
if (getLimpManager()->allowElectronicThrottle()
@ -567,12 +573,21 @@ void EtbController::update() {
if (!cisnan(directPwmValue)) {
m_motor->set(directPwmValue);
etbErrorCode = (int8_t)TpsState::Manual;
return;
}
if ((engineConfiguration->disableEtbWhenEngineStopped && !engine->triggerCentral.engineMovedRecently())
|| (etbInputErrorCounter > 50)
|| engine->engineState.lua.luaDisableEtb) {
TpsState localReason = TpsState::None;
if (engineConfiguration->disableEtbWhenEngineStopped && !engine->triggerCentral.engineMovedRecently()) {
localReason = TpsState::Setting;
} else if (etbInputErrorCounter > 50) {
localReason = TpsState::InputJitter;
} else if (engine->engineState.lua.luaDisableEtb) {
localReason = TpsState::Lua;
}
if (localReason != TpsState::None) {
etbErrorCode = (int8_t)localReason;
// If engine is stopped and so configured, skip the ETB update entirely
// This is quieter and pulls less power than leaving it on all the time
m_motor->disable();
@ -956,10 +971,10 @@ static pid_s* getEtbPidForFunction(etb_function_e function) {
}
void doInitElectronicThrottle() {
bool shouldInitThrottles = Sensor::hasSensor(SensorType::AcceleratorPedalPrimary);
bool hasPedal = Sensor::hasSensor(SensorType::AcceleratorPedalPrimary);
#if EFI_UNIT_TEST
printf("doInitElectronicThrottle %s\n", boolToString(shouldInitThrottles));
printf("doInitElectronicThrottle %s\n", boolToString(hasPedal));
#endif // EFI_UNIT_TEST
engineConfiguration->etb1configured = engineConfiguration->etb2configured = false;
@ -981,7 +996,7 @@ void doInitElectronicThrottle() {
auto pid = getEtbPidForFunction(func);
bool etbConfigured = controller->init(func, motor, pid, &pedal2tpsMap, shouldInitThrottles);
bool etbConfigured = controller->init(func, motor, pid, &pedal2tpsMap, hasPedal);
if (i == 0) {
engineConfiguration->etb1configured = etbConfigured;
} else if (i == 1) {
@ -991,7 +1006,7 @@ void doInitElectronicThrottle() {
if (!engineConfiguration->etb1configured && !engineConfiguration->etb2configured) {
// It's not valid to have a PPS without any ETBs - check that at least one ETB was enabled along with the pedal
if (shouldInitThrottles) {
if (hasPedal) {
firmwareError(OBD_PCM_Processor_Fault, "A pedal position sensor was configured, but no electronic throttles are configured.");
}

View File

@ -33,7 +33,10 @@ enum class TpsState : uint8_t {
PpsError, // 3
InputJitter,
PidJitter,
Lua
Lua, // 6
Manual,
NotConfigured,
Redundancy, // 9
// keep this list in sync with etbCutCodeList in rusefi.input!
};

View File

@ -239,7 +239,7 @@ enable2ndByteCanID = false
fuelIgnCutCodeList = bits, U08, [0:7], "None", "fatal error", "setting disabled", "RPM limit", "fault RPM limit", "boost cut", "oil pressure", "stop requested", "ETB problem", "launch control", "max injector duty", "flood clear", "engine sync", "kickstart", "ign off"
; TpsState
etbCutCodeList = bits, U08, [0:7], "None", "engine off setting", "TPS error", "PPS error", "Input noise", "PID noise", "Lua"
etbCutCodeList = bits, U08, [0:7], "None", "engine off setting", "TPS error", "PPS error", "Input noise", "PID noise", "Lua", "Manual", "N/A", "Redundancy"
[ConstantsExtensions]
; defaultValue is used to provide TunerStudio with a value to use in the case of