From 6b696125a49ba6159daae89480c5b24407045d5e Mon Sep 17 00:00:00 2001 From: "D.R.racer" Date: Thu, 29 Dec 2022 07:50:51 +0100 Subject: [PATCH] Optimization - save 30B --- src/modules/idler.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/idler.cpp b/src/modules/idler.cpp index e746455..d8711c6 100644 --- a/src/modules/idler.cpp +++ b/src/modules/idler.cpp @@ -53,10 +53,11 @@ bool Idler::FinishHomingAndPlanMoveToParkPos() { void Idler::FinishMove() { currentlyEngaged = plannedMove; + hal::tmc2130::MotorCurrents c = mm::motion.CurrentsForAxis(axis); if (Disengaged()) // reduce power into the Idler motor when disengaged (less force necessary) - SetCurrents(mm::motion.CurrentsForAxis(axis).iRun, mm::motion.CurrentsForAxis(axis).iHold); + SetCurrents(c.iRun, c.iHold); else if (Engaged()) { // maximum motor power when the idler is engaged - SetCurrents(mm::motion.CurrentsForAxis(axis).iRun, mm::motion.CurrentsForAxis(axis).iRun); + SetCurrents(c.iRun, c.iRun); } }