From bcdd308035b974eca51614697a46aa6c4a9392b8 Mon Sep 17 00:00:00 2001 From: Jon Billings Date: Wed, 3 May 2023 15:24:45 +0100 Subject: [PATCH] fix check for engine rpm below target (#954) * fix check for engine rpm below target code is checking for RPM > target speed, but comment says checking for below target speed. The comment makes sense, the old code doesn't * improve idle advance enabling revert to original (rpm > (target - 200)), to avoid excessive advance in transition from cranking to running with IAC control units. But add exception if no other idle control mechanism to start it immediately (e.g. ITBs) --- speeduino/corrections.ino | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/speeduino/corrections.ino b/speeduino/corrections.ino index 7350336d..0c3a38e2 100644 --- a/speeduino/corrections.ino +++ b/speeduino/corrections.ino @@ -800,8 +800,17 @@ int8_t correctionIdleAdvance(int8_t advance) else { idleAdvTaper = 0; } } - if ( !idleAdvActive && BIT_CHECK(currentStatus.engine, BIT_ENGINE_RUN) && (currentStatus.RPM > (((uint16_t)currentStatus.CLIdleTarget * 10) - (uint16_t)IGN_IDLE_THRESHOLD)) ) { idleAdvActive = true; } //Active only after the engine is 200 RPM below target on first time - else if (idleAdvActive && !BIT_CHECK(currentStatus.engine, BIT_ENGINE_RUN)) { idleAdvActive = false; } //Clear flag if engine isn't running anymore +/* When Idle advance is the only idle speed control mechanism, activate as soon as not cranking. +When some other mechanism is also present, wait until the engine is no more than 200 RPM below idle target speed on first time +*/ + + if ((!idleAdvActive && BIT_CHECK(currentStatus.engine, BIT_ENGINE_RUN)) && + ((configPage6.iacAlgorithm == 0) || (currentStatus.RPM > (((uint16_t)currentStatus.CLIdleTarget * 10) - (uint16_t)IGN_IDLE_THRESHOLD)))) + { + idleAdvActive = true; + } + else + if (idleAdvActive && !BIT_CHECK(currentStatus.engine, BIT_ENGINE_RUN)) { idleAdvActive = false; } //Clear flag if engine isn't running anymore return ignIdleValue; }