aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/stepper.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2016-07-07 16:57:25 -0400
committerKevin O'Connor <kevin@koconnor.net>2016-07-10 22:49:02 -0400
commit4a527a46cedaa4a7932ba5c1080b7133c69602cd (patch)
treed1d1b92419716f00a353e50374a6090ed89a0f7e /klippy/stepper.py
parent5829aa8bd796358ce7880dbb6e9574589e62a927 (diff)
downloadkutter-4a527a46cedaa4a7932ba5c1080b7133c69602cd.tar.gz
kutter-4a527a46cedaa4a7932ba5c1080b7133c69602cd.tar.xz
kutter-4a527a46cedaa4a7932ba5c1080b7133c69602cd.zip
stepper: Store max_velocity/max_accel instead of max_step_velocity/accel
All users of max_step_velocity and max_step_accel end up multiplying by step_dist anyway, so it's easier to store max_velocity and max_accel. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/stepper.py')
-rw-r--r--klippy/stepper.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/klippy/stepper.py b/klippy/stepper.py
index 61faaee0..5a05e910 100644
--- a/klippy/stepper.py
+++ b/klippy/stepper.py
@@ -13,10 +13,8 @@ class PrinterStepper:
self.step_dist = config.getfloat('step_distance')
self.inv_step_dist = 1. / self.step_dist
- max_velocity = config.getfloat('max_velocity')
- self.max_step_velocity = max_velocity * self.inv_step_dist
- max_accel = config.getfloat('max_accel')
- self.max_step_accel = max_accel * self.inv_step_dist
+ self.max_velocity = config.getfloat('max_velocity')
+ self.max_accel = config.getfloat('max_accel')
self.homing_speed = config.getfloat('homing_speed', 5.0)
self.homing_positive_dir = config.getboolean(
@@ -36,7 +34,8 @@ class PrinterStepper:
step_pin = self.config.get('step_pin')
dir_pin = self.config.get('dir_pin')
jc = 0.005 # XXX
- min_stop_interval = int((math.sqrt(1./self.max_step_accel + jc**2) - jc)
+ inv_max_step_accel = self.step_dist / self.max_accel
+ min_stop_interval = int((math.sqrt(inv_max_step_accel + jc**2) - jc)
* self.clock_ticks) - max_error
min_stop_interval = max(0, min_stop_interval)
mcu = self.printer.mcu