diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-11-24 19:16:21 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2019-11-24 20:21:13 -0500 |
commit | 36832739369ab2f66beb1bad732523b5c3687ff7 (patch) | |
tree | f98e7c34c8da7c55590e451fff95c83f540c4123 /klippy | |
parent | 282af0220e2622fbba304f66f001f442b9f3ca8d (diff) | |
download | kutter-36832739369ab2f66beb1bad732523b5c3687ff7.tar.gz kutter-36832739369ab2f66beb1bad732523b5c3687ff7.tar.xz kutter-36832739369ab2f66beb1bad732523b5c3687ff7.zip |
toolhead: Report which axes are homed via get_status()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy')
-rw-r--r-- | klippy/extras/safe_z_home.py | 6 | ||||
-rw-r--r-- | klippy/kinematics/cartesian.py | 7 | ||||
-rw-r--r-- | klippy/kinematics/corexy.py | 7 | ||||
-rw-r--r-- | klippy/kinematics/delta.py | 4 | ||||
-rw-r--r-- | klippy/kinematics/none.py | 2 | ||||
-rw-r--r-- | klippy/kinematics/polar.py | 7 | ||||
-rw-r--r-- | klippy/kinematics/winch.py | 4 | ||||
-rw-r--r-- | klippy/toolhead.py | 12 |
8 files changed, 25 insertions, 24 deletions
diff --git a/klippy/extras/safe_z_home.py b/klippy/extras/safe_z_home.py index a392535b..a49f6b9a 100644 --- a/klippy/extras/safe_z_home.py +++ b/klippy/extras/safe_z_home.py @@ -30,14 +30,14 @@ class SafeZHoming: def cmd_G28(self, params): toolhead = self.printer.lookup_object('toolhead') - kinematics = toolhead.get_kinematics() # Perform Z Hop if necessary if self.z_hop != 0.0: pos = toolhead.get_position() - kin_status = kinematics.get_status() + curtime = self.printer.get_reactor().monotonic() + kin_status = toolhead.get_kinematics().get_status(curtime) # Check if Z axis is homed or has a known position - if 'Z' in kin_status['homed_axes']: + if 'z' in kin_status['homed_axes']: # Check if the zhop would exceed the printer limits if pos[2] + self.z_hop > self.max_z: self.gcode.respond_info( diff --git a/klippy/kinematics/cartesian.py b/klippy/kinematics/cartesian.py index ee65d4ba..c44ad857 100644 --- a/klippy/kinematics/cartesian.py +++ b/klippy/kinematics/cartesian.py @@ -116,10 +116,9 @@ class CartKinematics: z_ratio = move.move_d / abs(move.axes_d[2]) move.limit_speed( self.max_z_velocity * z_ratio, self.max_z_accel * z_ratio) - def get_status(self): - return {'homed_axes': "".join([a - for a, (l, h) in zip("XYZ", self.limits) if l <= h]) - } + def get_status(self, eventtime): + axes = [a for a, (l, h) in zip("xyz", self.limits) if l <= h] + return { 'homed_axes': "".join(axes) } # Dual carriage support def _activate_carriage(self, carriage): toolhead = self.printer.lookup_object('toolhead') diff --git a/klippy/kinematics/corexy.py b/klippy/kinematics/corexy.py index aa88406d..98c66dd5 100644 --- a/klippy/kinematics/corexy.py +++ b/klippy/kinematics/corexy.py @@ -93,10 +93,9 @@ class CoreXYKinematics: z_ratio = move.move_d / abs(move.axes_d[2]) move.limit_speed( self.max_z_velocity * z_ratio, self.max_z_accel * z_ratio) - def get_status(self): - return {'homed_axes': "".join([a - for a, (l, h) in zip("XYZ", self.limits) if l <= h]) - } + def get_status(self, eventtime): + axes = [a for a, (l, h) in zip("xyz", self.limits) if l <= h] + return {'homed_axes': "".join(axes)} def load_kinematics(toolhead, config): return CoreXYKinematics(toolhead, config) diff --git a/klippy/kinematics/delta.py b/klippy/kinematics/delta.py index ee01be56..73a987d3 100644 --- a/klippy/kinematics/delta.py +++ b/klippy/kinematics/delta.py @@ -144,8 +144,8 @@ class DeltaKinematics: move.limit_speed(max_velocity * r, self.max_accel * r) limit_xy2 = -1. self.limit_xy2 = min(limit_xy2, self.slow_xy2) - def get_status(self): - return {'homed_axes': '' if self.need_home else 'XYZ'} + def get_status(self, eventtime): + return {'homed_axes': '' if self.need_home else 'xyz'} # Helper function for DELTA_CALIBRATE script def get_calibrate_params(self): diff --git a/klippy/kinematics/none.py b/klippy/kinematics/none.py index 6fe9884f..7df1010a 100644 --- a/klippy/kinematics/none.py +++ b/klippy/kinematics/none.py @@ -17,7 +17,7 @@ class NoneKinematics: pass def check_move(self, move): pass - def get_status(self): + def get_status(self, eventtime): return {'homed_axes': ''} def load_kinematics(toolhead, config): diff --git a/klippy/kinematics/polar.py b/klippy/kinematics/polar.py index 3a043ab3..4201978d 100644 --- a/klippy/kinematics/polar.py +++ b/klippy/kinematics/polar.py @@ -104,9 +104,10 @@ class PolarKinematics: z_ratio = move.move_d / abs(move.axes_d[2]) move.limit_speed( self.max_z_velocity * z_ratio, self.max_z_accel * z_ratio) - def get_status(self): - return {'homed_axes': (("XY" if self.limit_xy2 >= 0. else "") + - ("Z" if self.limit_z[0] <= self.limit_z[1] else ""))} + def get_status(self, eventtime): + xy_home = "xy" if self.limit_xy2 >= 0. else "" + z_home = "z" if self.limit_z[0] <= self.limit_z[1] else "" + return {'homed_axes': xy_home + z_home} def load_kinematics(toolhead, config): return PolarKinematics(toolhead, config) diff --git a/klippy/kinematics/winch.py b/klippy/kinematics/winch.py index 6792dbd7..37494c4e 100644 --- a/klippy/kinematics/winch.py +++ b/klippy/kinematics/winch.py @@ -45,9 +45,9 @@ class WinchKinematics: def check_move(self, move): # XXX - boundary checks and speed limits not implemented pass - def get_status(self): + def get_status(self, eventtime): # XXX - homed_checks and rail limits not implemented - return {'homed_axes': 'XYZ'} + return {'homed_axes': 'xyz'} def load_kinematics(toolhead, config): return WinchKinematics(toolhead, config) diff --git a/klippy/toolhead.py b/klippy/toolhead.py index 55f1bb36..51d39148 100644 --- a/klippy/toolhead.py +++ b/klippy/toolhead.py @@ -482,11 +482,13 @@ class ToolHead: status = "Printing" else: status = "Ready" - return { 'status': status, 'print_time': print_time, - 'estimated_print_time': estimated_print_time, - 'extruder': self.extruder.get_name(), - 'position': homing.Coord(*self.commanded_pos), - 'printing_time': print_time - last_print_start_time } + res = dict(self.kin.get_status(eventtime)) + res.update({ 'status': status, 'print_time': print_time, + 'estimated_print_time': estimated_print_time, + 'extruder': self.extruder.get_name(), + 'position': homing.Coord(*self.commanded_pos), + 'printing_time': print_time - last_print_start_time }) + return res def _handle_shutdown(self): self.can_pause = False self.move_queue.reset() |