1
0
Эх сурвалжийг харах

change movement to non-blocking

Tuan Nguyen 1 жил өмнө
parent
commit
0fafabb334

+ 7 - 2
arduino_code_TMC2209/arduino_code_TMC2209.ino

@@ -349,8 +349,13 @@ void movePolar(float theta, float rho)
 
     // Move both motors synchronously
     multiStepper.moveTo(targetPositions);
-    multiStepper.runSpeedToPosition(); // Blocking call
-
+    isRunning = true;
+    
+    while (rotStepper.distanceToGo() != 0 || inOutStepper.distanceToGo() != 0)
+    {
+        multiStepper.run(); // Non-Blocking call
+    }
+    isRunning = false;
     // Update the current coordinates
     currentTheta = theta;
     currentRho = rho;