aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/stepper.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2016-12-01 15:29:26 -0500
committerKevin O'Connor <kevin@koconnor.net>2016-12-01 18:17:54 -0500
commitc49d3fdb17d6ba8f90099826355200d5219ab6b6 (patch)
treead12f524dab0e3d100adcb8c12c603a686c7b7d9 /klippy/stepper.py
parentfcaf359e897cea792ac28fc9140316c76eb87c40 (diff)
downloadkutter-c49d3fdb17d6ba8f90099826355200d5219ab6b6.tar.gz
kutter-c49d3fdb17d6ba8f90099826355200d5219ab6b6.tar.xz
kutter-c49d3fdb17d6ba8f90099826355200d5219ab6b6.zip
toolhead: Specify maximum acceleration and velocity in toolhead class
Change the config file so the maximum accel and velocity are specified in the "printer" section instead of the individual "stepper" sections. The underlying code limits the velocity and accel of the toolhead relative to the print object, so it makes sense to configure the system that was as well. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/stepper.py')
-rw-r--r--klippy/stepper.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/klippy/stepper.py b/klippy/stepper.py
index f770afdb..71a5c8c6 100644
--- a/klippy/stepper.py
+++ b/klippy/stepper.py
@@ -15,9 +15,7 @@ class PrinterStepper:
self.step_dist = config.getfloat('step_distance')
self.inv_step_dist = 1. / self.step_dist
- self.max_velocity = config.getfloat('max_velocity')
- self.max_accel = config.getfloat('max_accel')
- self.max_jerk = 0.
+ self.min_stop_interval = 0.
self.homing_speed = config.getfloat('homing_speed', 5.0)
self.homing_positive_dir = config.getboolean(
@@ -47,17 +45,16 @@ class PrinterStepper:
self.position_max = config.getfloat('position_max', 0.)
self.need_motor_enable = True
- def set_max_jerk(self, max_jerk):
- self.max_jerk = max_jerk
+ def set_max_jerk(self, max_halt_velocity, max_accel):
+ jc = max_halt_velocity / max_accel
+ inv_max_step_accel = self.step_dist / max_accel
+ self.min_stop_interval = (math.sqrt(3.*inv_max_step_accel + jc**2)
+ - math.sqrt(inv_max_step_accel + jc**2))
def build_config(self):
max_error = self.config.getfloat('max_error', 0.000050)
step_pin = self.config.get('step_pin')
dir_pin = self.config.get('dir_pin')
- jc = self.max_jerk / self.max_accel
- inv_max_step_accel = self.step_dist / self.max_accel
- min_stop_interval = (math.sqrt(3.*inv_max_step_accel + jc**2)
- - math.sqrt(inv_max_step_accel + jc**2)) - max_error
- min_stop_interval = max(0., min_stop_interval)
+ min_stop_interval = max(0., self.min_stop_interval - max_error)
mcu = self.printer.mcu
self.mcu_stepper = mcu.create_stepper(
step_pin, dir_pin, min_stop_interval, max_error)