From 90f08ae581ffe8686182f18ef9502ea6a08ac54b Mon Sep 17 00:00:00 2001 From: zhaohe Date: Tue, 4 Mar 2025 02:32:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=94=B5=E6=9C=BA=E5=99=AA?= =?UTF-8?q?=E5=A3=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tmcdriver/tmc51x0/tmc51x0.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tmcdriver/tmc51x0/tmc51x0.cpp b/tmcdriver/tmc51x0/tmc51x0.cpp index 5dc0ba7..9193dcc 100644 --- a/tmcdriver/tmc51x0/tmc51x0.cpp +++ b/tmcdriver/tmc51x0/tmc51x0.cpp @@ -208,10 +208,12 @@ void TMC51X0::stop() { int mode = readInt(TMC5130_RAMPMODE); if (mode == TMC5130_MODE_POSITION) { // writeInt(TMC5130_RAMPMODE, TMC5130_MODE_POSITION); - writeInt(TMC5130_VMAX, 0); - while (getVACTUAL() > 5) { + rotate(0); + while (getVACTUAL() > 0) { osDelay(2); } + writeInt(TMC5130_RAMPMODE, TMC5130_MODE_POSITION); + writeInt(TMC5130_VMAX, 1); writeInt(TMC5130_XTARGET, readInt(TMC5130_XACTUAL)); } else { rotate(0);