toolhead: Pass set_position() homing_axes parameter as a string
Use strings such as "xyz" to specify which axes are to be considered homing during a set_position() call. This makes the parameter a little less cryptic. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
@@ -136,7 +136,7 @@ class ForceMove:
|
||||
clear_axes = [axes.index(a) for a in axes if a in clear]
|
||||
logging.info("SET_KINEMATIC_POSITION pos=%.3f,%.3f,%.3f clear=%s",
|
||||
x, y, z, ','.join((axes[i] for i in clear_axes)))
|
||||
toolhead.set_position([x, y, z, curpos[3]], homing_axes=(0, 1, 2))
|
||||
toolhead.set_position([x, y, z, curpos[3]], homing_axes="xyz")
|
||||
toolhead.get_kinematics().clear_homing_state(clear_axes)
|
||||
|
||||
def load_config(config):
|
||||
|
||||
@@ -187,7 +187,8 @@ class Homing:
|
||||
# Notify of upcoming homing operation
|
||||
self.printer.send_event("homing:home_rails_begin", self, rails)
|
||||
# Alter kinematics class to think printer is at forcepos
|
||||
homing_axes = [axis for axis in range(3) if forcepos[axis] is not None]
|
||||
force_axes = [axis for axis in range(3) if forcepos[axis] is not None]
|
||||
homing_axes = "".join(["xyz"[i] for i in force_axes])
|
||||
startpos = self._fill_coord(forcepos)
|
||||
homepos = self._fill_coord(movepos)
|
||||
self.toolhead.set_position(startpos, homing_axes=homing_axes)
|
||||
@@ -231,7 +232,7 @@ class Homing:
|
||||
+ self.adjust_pos.get(s.get_name(), 0.))
|
||||
for s in kin.get_steppers()}
|
||||
newpos = kin.calc_position(kin_spos)
|
||||
for axis in homing_axes:
|
||||
for axis in force_axes:
|
||||
homepos[axis] = newpos[axis]
|
||||
self.toolhead.set_position(homepos)
|
||||
|
||||
|
||||
@@ -46,11 +46,11 @@ class HomingOverride:
|
||||
# Calculate forced position (if configured)
|
||||
toolhead = self.printer.lookup_object('toolhead')
|
||||
pos = toolhead.get_position()
|
||||
homing_axes = []
|
||||
homing_axes = ""
|
||||
for axis, loc in enumerate(self.start_pos):
|
||||
if loc is not None:
|
||||
pos[axis] = loc
|
||||
homing_axes.append(axis)
|
||||
homing_axes += "xyz"[axis]
|
||||
toolhead.set_position(pos, homing_axes=homing_axes)
|
||||
# Perform homing
|
||||
context = self.template.create_template_context()
|
||||
|
||||
@@ -109,7 +109,7 @@ class ManualStepper:
|
||||
self.sync_print_time()
|
||||
def get_position(self):
|
||||
return [self.rail.get_commanded_position(), 0., 0., 0.]
|
||||
def set_position(self, newpos, homing_axes=()):
|
||||
def set_position(self, newpos, homing_axes=""):
|
||||
self.do_set_position(newpos[0])
|
||||
def get_last_move_time(self):
|
||||
self.sync_print_time()
|
||||
|
||||
@@ -37,7 +37,7 @@ class SafeZHoming:
|
||||
if 'z' not in kin_status['homed_axes']:
|
||||
# Always perform the z_hop if the Z axis is not homed
|
||||
pos[2] = 0
|
||||
toolhead.set_position(pos, homing_axes=[2])
|
||||
toolhead.set_position(pos, homing_axes="z")
|
||||
toolhead.manual_move([None, None, self.z_hop],
|
||||
self.z_hop_speed)
|
||||
toolhead.get_kinematics().clear_homing_state((2,))
|
||||
|
||||
Reference in New Issue
Block a user