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)
This commit is contained in:
Jon Billings 2023-05-03 15:24:45 +01:00 committed by GitHub
parent 78bed477f5
commit bcdd308035
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 2 deletions

View File

@ -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;
}