From d77d31b883098fd1588a29eabdf74787da501633 Mon Sep 17 00:00:00 2001 From: Alex Voinea Date: Thu, 13 Oct 2022 22:22:02 +0200 Subject: [PATCH] Idler dynamic IHOLD adjustments --- src/modules/idler.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/modules/idler.cpp b/src/modules/idler.cpp index 288597c..4eee6f9 100644 --- a/src/modules/idler.cpp +++ b/src/modules/idler.cpp @@ -53,8 +53,13 @@ bool Idler::FinishHomingAndPlanMoveToParkPos() { void Idler::FinishMove() { currentlyEngaged = plannedMove; - if (Disengaged()) // turn off power into the Idler motor when disengaged (no force necessary) - mm::motion.Disable(mm::Idler); + if (Disengaged()) // reduce power into the Idler motor when disengaged (less force necessary) + mm::motion.DriverForAxis(axis).SetCurrents(mm::axisParams[axis].params, mm::axisParams[axis].currents); + else if (Engaged()) { // maximum motor power when the idler is engaged + hal::tmc2130::MotorCurrents tempCurrent = mm::axisParams[axis].currents; + tempCurrent.iHold = tempCurrent.iRun; + mm::motion.DriverForAxis(axis).SetCurrents(mm::axisParams[axis].params, tempCurrent); + } } Idler::OperationResult Idler::Disengage() {