From b24246791e03f29d334216b6b0ad04e8ec914ac9 Mon Sep 17 00:00:00 2001 From: rusefi Date: Mon, 7 Sep 2020 14:12:21 -0400 Subject: [PATCH] Hellen says isIdleMotorBusy --- 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 9556f887f4..05612177c2 100644 --- a/firmware/controllers/actuators/idle_thread.cpp +++ b/firmware/controllers/actuators/idle_thread.cpp @@ -677,6 +677,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 b8a94fa45f..45626ddab0 100644 --- a/firmware/controllers/actuators/idle_thread.h +++ b/firmware/controllers/actuators/idle_thread.h @@ -38,6 +38,7 @@ 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); float getIdlePidOffset(DECLARE_ENGINE_PARAMETER_SIGNATURE); Pid * getIdlePid(DECLARE_ENGINE_PARAMETER_SIGNATURE);