stepper: Add a get_range() method to PrinterHomingStepper
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
b96542f0e5
commit
968ed58b61
|
@ -59,18 +59,17 @@ class CartKinematics:
|
||||||
s = self.steppers[i]
|
s = self.steppers[i]
|
||||||
s.set_position(newpos[i])
|
s.set_position(newpos[i])
|
||||||
if i in homing_axes:
|
if i in homing_axes:
|
||||||
self.limits[i] = (s.position_min, s.position_max)
|
self.limits[i] = s.get_range()
|
||||||
def _home_axis(self, homing_state, axis, stepper):
|
def _home_axis(self, homing_state, axis, stepper):
|
||||||
s = stepper
|
s = stepper
|
||||||
# Determine moves
|
# Determine moves
|
||||||
|
position_min, position_max = s.get_range()
|
||||||
if s.homing_positive_dir:
|
if s.homing_positive_dir:
|
||||||
pos = s.position_endstop - 1.5*(
|
pos = s.position_endstop - 1.5*(s.position_endstop - position_min)
|
||||||
s.position_endstop - s.position_min)
|
|
||||||
rpos = s.position_endstop - s.homing_retract_dist
|
rpos = s.position_endstop - s.homing_retract_dist
|
||||||
r2pos = rpos - s.homing_retract_dist
|
r2pos = rpos - s.homing_retract_dist
|
||||||
else:
|
else:
|
||||||
pos = s.position_endstop + 1.5*(
|
pos = s.position_endstop + 1.5*(position_max - s.position_endstop)
|
||||||
s.position_max - s.position_endstop)
|
|
||||||
rpos = s.position_endstop + s.homing_retract_dist
|
rpos = s.position_endstop + s.homing_retract_dist
|
||||||
r2pos = rpos + s.homing_retract_dist
|
r2pos = rpos + s.homing_retract_dist
|
||||||
# Initial homing
|
# Initial homing
|
||||||
|
@ -165,8 +164,7 @@ class CartKinematics:
|
||||||
extruder_pos = toolhead.get_position()[3]
|
extruder_pos = toolhead.get_position()[3]
|
||||||
toolhead.set_position(self.get_position() + [extruder_pos])
|
toolhead.set_position(self.get_position() + [extruder_pos])
|
||||||
if self.limits[dc_axis][0] <= self.limits[dc_axis][1]:
|
if self.limits[dc_axis][0] <= self.limits[dc_axis][1]:
|
||||||
self.limits[dc_axis] = (
|
self.limits[dc_axis] = dc_stepper.get_range()
|
||||||
dc_stepper.position_min, dc_stepper.position_max)
|
|
||||||
self.need_motor_enable = True
|
self.need_motor_enable = True
|
||||||
cmd_SET_DUAL_CARRIAGE_help = "Set which carriage is active"
|
cmd_SET_DUAL_CARRIAGE_help = "Set which carriage is active"
|
||||||
def cmd_SET_DUAL_CARRIAGE(self, params):
|
def cmd_SET_DUAL_CARRIAGE(self, params):
|
||||||
|
|
|
@ -52,20 +52,21 @@ class CoreXYKinematics:
|
||||||
s = self.steppers[i]
|
s = self.steppers[i]
|
||||||
s.set_position(pos[i])
|
s.set_position(pos[i])
|
||||||
if i in homing_axes:
|
if i in homing_axes:
|
||||||
self.limits[i] = (s.position_min, s.position_max)
|
self.limits[i] = s.get_range()
|
||||||
def home(self, homing_state):
|
def home(self, homing_state):
|
||||||
# Each axis is homed independently and in order
|
# Each axis is homed independently and in order
|
||||||
for axis in homing_state.get_axes():
|
for axis in homing_state.get_axes():
|
||||||
s = self.steppers[axis]
|
s = self.steppers[axis]
|
||||||
# Determine moves
|
# Determine moves
|
||||||
|
position_min, position_max = s.get_range()
|
||||||
if s.homing_positive_dir:
|
if s.homing_positive_dir:
|
||||||
pos = s.position_endstop - 1.5*(
|
pos = s.position_endstop - 1.5*(
|
||||||
s.position_endstop - s.position_min)
|
s.position_endstop - position_min)
|
||||||
rpos = s.position_endstop - s.homing_retract_dist
|
rpos = s.position_endstop - s.homing_retract_dist
|
||||||
r2pos = rpos - s.homing_retract_dist
|
r2pos = rpos - s.homing_retract_dist
|
||||||
else:
|
else:
|
||||||
pos = s.position_endstop + 1.5*(
|
pos = s.position_endstop + 1.5*(
|
||||||
s.position_max - s.position_endstop)
|
position_max - s.position_endstop)
|
||||||
rpos = s.position_endstop + s.homing_retract_dist
|
rpos = s.position_endstop + s.homing_retract_dist
|
||||||
r2pos = rpos + s.homing_retract_dist
|
r2pos = rpos + s.homing_retract_dist
|
||||||
# Initial homing
|
# Initial homing
|
||||||
|
|
|
@ -170,6 +170,8 @@ class PrinterHomingStepper(PrinterStepper):
|
||||||
ffi_main, ffi_lib = chelper.get_ffi()
|
ffi_main, ffi_lib = chelper.get_ffi()
|
||||||
self.setup_itersolve(ffi_main.gc(
|
self.setup_itersolve(ffi_main.gc(
|
||||||
ffi_lib.cartesian_stepper_alloc(axis), ffi_lib.free))
|
ffi_lib.cartesian_stepper_alloc(axis), ffi_lib.free))
|
||||||
|
def get_range(self):
|
||||||
|
return self.position_min, self.position_max
|
||||||
def get_endstops(self):
|
def get_endstops(self):
|
||||||
return [(self.mcu_endstop, self.get_name(short=True))]
|
return [(self.mcu_endstop, self.get_name(short=True))]
|
||||||
def get_homed_offset(self):
|
def get_homed_offset(self):
|
||||||
|
|
Loading…
Reference in New Issue