From 31b36a9a4fce22c3ae986dda74f0536d680f7bed Mon Sep 17 00:00:00 2001 From: "D.R.racer" Date: Wed, 28 Dec 2022 10:00:43 +0100 Subject: [PATCH] Distinguish iRun<32 as per suggestion from @leptun --- src/modules/movable_base.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/modules/movable_base.cpp b/src/modules/movable_base.cpp index a26a48a..5d3d19f 100644 --- a/src/modules/movable_base.cpp +++ b/src/modules/movable_base.cpp @@ -25,8 +25,15 @@ void MovableBase::PlanHome() { void MovableBase::SetCurrents(uint8_t iRun, uint8_t iHold) { hal::tmc2130::MotorCurrents tempCurrent = mm::axisParams[axis].currents; - tempCurrent.iRun = iRun; - tempCurrent.iHold = iHold; + if (iRun < 32) { + tempCurrent.vSense = 1; + tempCurrent.iRun = iRun; + tempCurrent.iHold = iHold; + } else { + tempCurrent.vSense = 0; + tempCurrent.iRun = iRun >> 1; + tempCurrent.iHold = iHold >> 1; + } mm::motion.DriverForAxis(axis).SetCurrents(mm::axisParams[axis].params, tempCurrent); }