toolhead: Report which axes are homed via get_status()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
282af0220e
commit
3683273936
|
@ -157,6 +157,9 @@ The following are common printer attributes:
|
|||
extruder. For example, one could use
|
||||
`printer[printer.toolhead.extruder].target` to get the target
|
||||
temperature of the current extruder.
|
||||
- `printer.toolhead.homed_axes`: The current cartesian axes considered
|
||||
to be in a "homed" state. This is a string containing one or more of
|
||||
"x", "y", "z".
|
||||
|
||||
The above list is subject to change - if using an attribute be sure to
|
||||
review the [Config Changes document](Config_Changes.md) when upgrading
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -482,11 +482,13 @@ class ToolHead:
|
|||
status = "Printing"
|
||||
else:
|
||||
status = "Ready"
|
||||
return { 'status': status, 'print_time': print_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 }
|
||||
'printing_time': print_time - last_print_start_time })
|
||||
return res
|
||||
def _handle_shutdown(self):
|
||||
self.can_pause = False
|
||||
self.move_queue.reset()
|
||||
|
|
Loading…
Reference in New Issue