limp mangaer handles more stuff (#3983)

This commit is contained in:
Matthew Kennedy 2022-03-20 06:28:17 -07:00 committed by GitHub
parent 213ee48403
commit f742ae8b7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 20 additions and 35 deletions

View File

@ -6,7 +6,7 @@ bit sd_present
bit isIgnitionEnabledIndicator;
bit isInjectionEnabledIndicator;
bit sd_logging_internal
bit isCylinderCleanupActivated;
bit unusedb4;
bit isFuelPumpOn;
bit isFanOn;"radiator fan"
bit isO2HeaterOn;

View File

@ -680,7 +680,6 @@ static void updateFlags() {
engine->outputChannels.isO2HeaterOn = enginePins.o2heater.getLogicValue();
engine->outputChannels.isIgnitionEnabledIndicator = engine->limpManager.allowIgnition().value;
engine->outputChannels.isInjectionEnabledIndicator = engine->limpManager.allowInjection().value;
engine->outputChannels.isCylinderCleanupActivated = engine->isCylinderCleanupMode;
engine->outputChannels.dfcoActive = engine->module<DfcoController>()->cutFuel();
#if EFI_LAUNCH_CONTROL

View File

@ -182,21 +182,6 @@ void Engine::initializeTriggerWaveform() {
#endif /* EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT */
}
static void cylinderCleanupControl() {
#if EFI_ENGINE_CONTROL
bool newValue;
if (engineConfiguration->isCylinderCleanupEnabled) {
newValue = !engine->rpmCalculator.isRunning() && Sensor::getOrZero(SensorType::DriverThrottleIntent) > CLEANUP_MODE_TPS;
} else {
newValue = false;
}
if (newValue != engine->isCylinderCleanupMode) {
engine->isCylinderCleanupMode = newValue;
efiPrintf("isCylinderCleanupMode %s", boolToString(newValue));
}
#endif
}
#if ANALOG_HW_CHECK_MODE
static void assertCloseTo(const char * msg, float actual, float expected) {
if (actual < 0.75 * expected || actual > 1.25 * expected) {
@ -235,8 +220,6 @@ void Engine::periodicSlowCallback() {
updateBoostControl();
#endif // EFI_BOOST_CONTROL
cylinderCleanupControl();
standardAirCharge = getStandardAirCharge();
#if (BOARD_TLE8888_COUNT > 0)

View File

@ -389,12 +389,6 @@ public:
SensorsState sensors;
efitick_t mainRelayBenchStartNt = 0;
/**
* This field is true if we are in 'cylinder cleanup' state right now
* see isCylinderCleanupEnabled
*/
bool isCylinderCleanupMode = false;
/**
* value of 'triggerShape.getLength()'
* pre-calculating this value is a performance optimization

View File

@ -292,16 +292,6 @@ static void handleFuel(const bool limitedFuel, uint32_t trgEventIndex, int rpm,
if (limitedFuel) {
return;
}
if (engine->isCylinderCleanupMode) {
return;
}
// If duty cycle is high, impose a fuel cut rev limiter.
// This is safer than attempting to limp along with injectors or a pump that are out of flow.
if (getInjectorDutyCycle(rpm) > 96.0f) {
warning(CUSTOM_OBD_63, "Injector Duty cycle cut");
return;
}
/**
* Injection events are defined by addFuelEvents() according to selected

View File

@ -2,6 +2,10 @@
#include "limp_manager.h"
#include "fuel_math.h"
#define CLEANUP_MODE_TPS 90
void LimpManager::updateState(int rpm, efitick_t nowNt) {
Clearable allowFuel = engineConfiguration->isInjectionEnabled;
Clearable allowSpark = engineConfiguration->isIgnitionEnabled;
@ -68,6 +72,19 @@ void LimpManager::updateState(int rpm, efitick_t nowNt) {
allowFuel.clear(ClearReason::StopRequested);
}
// If duty cycle is high, impose a fuel cut rev limiter.
// This is safer than attempting to limp along with injectors or a pump that are out of flow.
if (getInjectorDutyCycle(rpm) > 96.0f) {
allowFuel.clear(ClearReason::InjectorDutyCycle);
}
// If the pedal is pushed while not running, cut fuel to clear a flood condition.
if (!engine->rpmCalculator.isRunning() &&
engineConfiguration->isCylinderCleanupEnabled &&
Sensor::getOrZero(SensorType::DriverThrottleIntent) > CLEANUP_MODE_TPS) {
allowFuel.clear(ClearReason::FloodClear);
}
if (!engine->isMainRelayEnabled()) {
/*
todo AndreiKA this change breaks 22 unit tests?

View File

@ -15,6 +15,8 @@ enum class ClearReason : uint8_t {
StopRequested, // 7
EtbProblem, // 8
LaunchCut, // 9
InjectorDutyCycle,
FloodClear,
};
// Only allows clearing the value, but never resetting it.