From ec0d3a8eb23cfad87199464da9ed43bb82058a12 Mon Sep 17 00:00:00 2001 From: rusefi Date: Mon, 7 Sep 2020 14:12:21 -0400 Subject: [PATCH] Hellen says isIdleMotorBusy (cherry picked from commit b24246791e03f29d334216b6b0ad04e8ec914ac9) --- firmware/controllers/actuators/idle_thread.cpp | 8 ++++++++ firmware/controllers/actuators/idle_thread.h | 1 + 2 files changed, 9 insertions(+) diff --git a/firmware/controllers/actuators/idle_thread.cpp b/firmware/controllers/actuators/idle_thread.cpp index c2c275c040..19e1c29db5 100644 --- a/firmware/controllers/actuators/idle_thread.cpp +++ b/firmware/controllers/actuators/idle_thread.cpp @@ -544,6 +544,14 @@ bool isIdleHardwareRestartNeeded() { } +bool isIdleMotorBusy(DECLARE_ENGINE_PARAMETER_SIGNATURE) { + if (!CONFIG(useStepperIdle)) { + // todo: check other motor types? + return false; + } + return iacMotor.isBusy(); +} + void stopIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE) { #if EFI_PROD_CODE brain_pin_markUnused(activeConfiguration.stepperEnablePin); diff --git a/firmware/controllers/actuators/idle_thread.h b/firmware/controllers/actuators/idle_thread.h index 9818f65287..fc3c44660e 100644 --- a/firmware/controllers/actuators/idle_thread.h +++ b/firmware/controllers/actuators/idle_thread.h @@ -35,5 +35,6 @@ void setIdleDT(int value); void stopIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE); void initIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE); bool isIdleHardwareRestartNeeded(); +bool isIdleMotorBusy(DECLARE_ENGINE_PARAMETER_SIGNATURE); void onConfigurationChangeIdleCallback(engine_configuration_s *previousConfiguration);