From 97d976fc53f897ad57db963078bcbf5018d34968 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 4 Dec 2019 18:42:59 -0500 Subject: stepper: Track if using units of radians instead of millimeters The STEPPER_BUZZ command needs to know if the axis is using radians instead of millimeters so that it can move a more appropriate distance. Signed-off-by: Kevin O'Connor --- klippy/extras/force_move.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'klippy/extras/force_move.py') diff --git a/klippy/extras/force_move.py b/klippy/extras/force_move.py index 0f58ad03..d051622f 100644 --- a/klippy/extras/force_move.py +++ b/klippy/extras/force_move.py @@ -6,7 +6,10 @@ import math, logging import chelper -BUZZ_VELOCITY = 4. +BUZZ_DISTANCE = 1. +BUZZ_VELOCITY = BUZZ_DISTANCE / .250 +BUZZ_RADIANS_DISTANCE = math.radians(1.) +BUZZ_RADIANS_VELOCITY = BUZZ_RADIANS_DISTANCE / .250 STALL_TIME = 0.100 # Calculate a move's accel_t, cruise_t, and cruise_v @@ -95,10 +98,13 @@ class ForceMove: logging.info("Stepper buzz %s", stepper.get_name()) was_enable = self.force_enable(stepper) toolhead = self.printer.lookup_object('toolhead') + dist, speed = BUZZ_DISTANCE, BUZZ_VELOCITY + if stepper.units_in_radians(): + dist, speed = BUZZ_RADIANS_DISTANCE, BUZZ_RADIANS_VELOCITY for i in range(10): - self.manual_move(stepper, 1., BUZZ_VELOCITY) + self.manual_move(stepper, dist, speed) toolhead.dwell(.050) - self.manual_move(stepper, -1., BUZZ_VELOCITY) + self.manual_move(stepper, -dist, speed) toolhead.dwell(.450) self.restore_enable(stepper, was_enable) cmd_FORCE_MOVE_help = "Manually move a stepper; invalidates kinematics" -- cgit v1.2.3-70-g09d2