From 644c13332681f4b4e290481dc402ba0a7c7c7848 Mon Sep 17 00:00:00 2001 From: xushenghao Date: Tue, 14 Jan 2025 13:58:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A9=B1=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 2 +- driver/tmc2240.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index fd17536..8959a70 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,7 +4,7 @@ "C_Cpp_Runner.debuggerPath": "gdb", "C_Cpp_Runner.cStandard": "", "C_Cpp_Runner.cppStandard": "", - "C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/VR_NR/Community/VC/Auxiliary/Build/vcvarsall.bat", + "C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvarsall.bat", "C_Cpp_Runner.useMsvc": false, "C_Cpp_Runner.warnings": [ "-Wall", diff --git a/driver/tmc2240.c b/driver/tmc2240.c index d4e2296..5221d18 100644 --- a/driver/tmc2240.c +++ b/driver/tmc2240.c @@ -299,6 +299,10 @@ void tmc2240_motor_set_angle(tmc2240_index_e index, int32_t angle) return; } + tmc->params.enable = FALSE; + _tmc2240_enable(index, tmc->params.enable); + tmc->motor.pulse_count = 0; + if (angle > 0) { tmc->params.direction = TMC2240_FORWARD;