From b1ab455f31034bd817213f582e08beaf6052d503 Mon Sep 17 00:00:00 2001 From: rusefi Date: Mon, 6 Jul 2020 16:40:16 -0400 Subject: [PATCH] idle_min through FSIO not working as intended #1553 we now re-activated idle PID even in deadzone for half a second after A/C toggle --- firmware/controllers/actuators/idle_thread.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/firmware/controllers/actuators/idle_thread.cpp b/firmware/controllers/actuators/idle_thread.cpp index 02554d7ad5..80d720b84d 100644 --- a/firmware/controllers/actuators/idle_thread.cpp +++ b/firmware/controllers/actuators/idle_thread.cpp @@ -315,8 +315,11 @@ static percent_t automaticIdleController(float tpsPos DECLARE_ENGINE_PARAMETER_S rpm = GET_RPM(); } + + // #1553 we need to give FSIO variable offset or minValue a chance + bool acToggleJustTouched = (getTimeNowUs() - engine->acSwitchLastChangeTime) < MS2US(500); // check if within the dead zone - if (absI(rpm - targetRpm) <= CONFIG(idlePidRpmDeadZone)) { + if (!acToggleJustTouched && absI(rpm - targetRpm) <= CONFIG(idlePidRpmDeadZone)) { engine->engineState.idle.idleState = RPM_DEAD_ZONE; // current RPM is close enough, no need to change anything return engine->engineState.idle.baseIdlePosition;