aboutsummaryrefslogtreecommitdiffstats
path: root/klippy
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-09-26 10:21:05 -0400
committerKevinOConnor <kevin@koconnor.net>2018-10-01 11:12:30 -0400
commitae4eb35a707fe588b77806bc77a2515b1d1a2d01 (patch)
treeb3f70683961bd21e600910889e2a5ffc5f4cc25b /klippy
parentc68c0c6526c0fc55af4a37080aaaa4cde916f218 (diff)
downloadkutter-ae4eb35a707fe588b77806bc77a2515b1d1a2d01.tar.gz
kutter-ae4eb35a707fe588b77806bc77a2515b1d1a2d01.tar.xz
kutter-ae4eb35a707fe588b77806bc77a2515b1d1a2d01.zip
delta_calibrate: Use kin.calc_position() in get_probed_position() callback
It's possible (and a little simpler) to use cartesian coordinates when calculating a stable position. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy')
-rw-r--r--klippy/extras/delta_calibrate.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/klippy/extras/delta_calibrate.py b/klippy/extras/delta_calibrate.py
index 0db7436e..d079eac5 100644
--- a/klippy/extras/delta_calibrate.py
+++ b/klippy/extras/delta_calibrate.py
@@ -49,13 +49,6 @@ def get_position_from_stable(stable_position, delta_params):
dp.stepdists, dp.towers, dp.abs_endstops, stable_position) ]
return mathutil.trilateration(sphere_coords, [a**2 for a in dp.arms])
-# Return a stable position from the nominal delta tower positions
-def get_stable_position(stepper_position, delta_params):
- dp = delta_params
- return [int((ep - sp) / sd + .5)
- for sd, ep, sp in zip(
- dp.stepdists, dp.abs_endstops, stepper_position)]
-
# Return a stable position from a cartesian coordinate
def calc_stable_position(coord, delta_params):
dp = delta_params
@@ -201,13 +194,13 @@ class DeltaCalibrate:
"%.3f,%.3f,%.3f" % tuple(spos2))
def get_probed_position(self):
kin = self.printer.lookup_object('toolhead').get_kinematics()
- return [s.get_commanded_position() for s in kin.get_steppers()]
+ return kin.calc_position()
def finalize(self, offsets, positions):
# Convert positions into (z_offset, stable_position) pairs
z_offset = offsets[2]
kin = self.printer.lookup_object('toolhead').get_kinematics()
delta_params = build_delta_params(kin.get_calibrate_params())
- probe_positions = [(z_offset, get_stable_position(p, delta_params))
+ probe_positions = [(z_offset, calc_stable_position(p, delta_params))
for p in positions]
# Perform analysis
self.calculate_params(probe_positions, self.last_distances)