aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--klippy/cartesian.py10
-rw-r--r--klippy/corexy.py8
-rw-r--r--klippy/delta.py4
-rw-r--r--klippy/toolhead.py5
4 files changed, 14 insertions, 13 deletions
diff --git a/klippy/cartesian.py b/klippy/cartesian.py
index 1786c63f..f0d2e258 100644
--- a/klippy/cartesian.py
+++ b/klippy/cartesian.py
@@ -21,11 +21,11 @@ class CartKinematics:
self.need_motor_enable = True
self.limits = [(1.0, -1.0)] * 3
# Setup stepper max halt velocity
- max_xy_halt_velocity = toolhead.get_max_axis_halt(max_accel)
- self.steppers[0].set_max_jerk(max_xy_halt_velocity, max_accel)
- self.steppers[1].set_max_jerk(max_xy_halt_velocity, max_accel)
- max_z_halt_velocity = toolhead.get_max_axis_halt(self.max_z_accel)
- self.steppers[2].set_max_jerk(max_z_halt_velocity, self.max_z_accel)
+ max_halt_velocity = toolhead.get_max_axis_halt()
+ self.steppers[0].set_max_jerk(max_halt_velocity, max_accel)
+ self.steppers[1].set_max_jerk(max_halt_velocity, max_accel)
+ self.steppers[2].set_max_jerk(
+ min(max_halt_velocity, self.max_z_velocity), max_accel)
def set_position(self, newpos):
for i in StepList:
self.steppers[i].mcu_stepper.set_position(newpos[i])
diff --git a/klippy/corexy.py b/klippy/corexy.py
index a730e933..286811d9 100644
--- a/klippy/corexy.py
+++ b/klippy/corexy.py
@@ -23,12 +23,12 @@ class CoreXYKinematics:
self.need_motor_enable = True
self.limits = [(1.0, -1.0)] * 3
# Setup stepper max halt velocity
- max_xy_halt_velocity = toolhead.get_max_axis_halt(max_accel)
- max_xy_halt_velocity *= math.sqrt(2.)
+ max_halt_velocity = toolhead.get_max_axis_halt()
+ max_xy_halt_velocity = max_halt_velocity * math.sqrt(2.)
self.steppers[0].set_max_jerk(max_xy_halt_velocity, max_accel)
self.steppers[1].set_max_jerk(max_xy_halt_velocity, max_accel)
- max_z_halt_velocity = toolhead.get_max_axis_halt(self.max_z_accel)
- self.steppers[2].set_max_jerk(max_z_halt_velocity, self.max_z_accel)
+ self.steppers[2].set_max_jerk(
+ min(max_halt_velocity, self.max_z_velocity), self.max_z_accel)
def set_position(self, newpos):
pos = (newpos[0] + newpos[1], newpos[0] - newpos[1], newpos[2])
for i in StepList:
diff --git a/klippy/delta.py b/klippy/delta.py
index e3ec0123..8eddc3c9 100644
--- a/klippy/delta.py
+++ b/klippy/delta.py
@@ -32,9 +32,9 @@ class DeltaKinematics:
self.max_z_velocity = config.getfloat(
'max_z_velocity', self.max_velocity,
above=0., maxval=self.max_velocity)
- max_xy_halt_velocity = toolhead.get_max_axis_halt(self.max_accel)
+ max_halt_velocity = toolhead.get_max_axis_halt()
for s in self.steppers:
- s.set_max_jerk(max_xy_halt_velocity, self.max_accel)
+ s.set_max_jerk(max_halt_velocity, self.max_accel)
# Determine tower locations in cartesian space
angles = [config.getsection('stepper_a').getfloat('angle', 210.),
config.getsection('stepper_b').getfloat('angle', 330.),
diff --git a/klippy/toolhead.py b/klippy/toolhead.py
index 6ed6099e..6df5e17f 100644
--- a/klippy/toolhead.py
+++ b/klippy/toolhead.py
@@ -381,11 +381,12 @@ class ToolHead:
logging.exception("Exception in force_shutdown")
def get_max_velocity(self):
return self.max_velocity, self.max_accel
- def get_max_axis_halt(self, max_accel):
+ def get_max_axis_halt(self):
# Determine the maximum velocity a cartesian axis could halt
# at due to the junction_deviation setting. The 8.0 was
# determined experimentally.
- return math.sqrt(8. * self.junction_deviation * max_accel)
+ return min(self.max_velocity,
+ math.sqrt(8. * self.junction_deviation * self.max_accel))
def add_printer_objects(printer, config):
printer.add_object('toolhead', ToolHead(printer, config))