stepper: Adding support for a second_homing_speed parameter (#677)
Signed-off-by: Chris Whiteford <chris@chrisandtennille.com>
This commit is contained in:
parent
97927172f1
commit
b0d859f220
|
@ -49,6 +49,11 @@ position_max: 200
|
|||
#homing_speed: 5.0
|
||||
# Maximum velocity (in mm/s) of the stepper when homing. The default
|
||||
# is 5mm/s.
|
||||
#second_homing_speed: 5.0
|
||||
# Maximum velocity (in mm/s) of the stepper when performing the second
|
||||
# stage of homing (the move off the endstop and then back towards for the
|
||||
# second trigger). This parameter is optional, and defaults to
|
||||
# homing_speed/2.0
|
||||
#homing_retract_dist: 5.0
|
||||
# Distance to backoff (in mm) before homing a second time during
|
||||
# homing. The default is 5mm.
|
||||
|
|
|
@ -68,6 +68,7 @@ class CartKinematics:
|
|||
r2pos = rpos + hi.retract_dist
|
||||
# Initial homing
|
||||
homing_speed = hi.speed
|
||||
second_homing_speed = hi.second_homing_speed
|
||||
if axis == 2:
|
||||
homing_speed = min(homing_speed, self.max_z_velocity)
|
||||
homepos = [None, None, None, None]
|
||||
|
@ -77,11 +78,11 @@ class CartKinematics:
|
|||
homing_state.home(coord, homepos, rail.get_endstops(), homing_speed)
|
||||
# Retract
|
||||
coord[axis] = rpos
|
||||
homing_state.retract(coord, homing_speed)
|
||||
homing_state.retract(coord, second_homing_speed)
|
||||
# Home again
|
||||
coord[axis] = r2pos
|
||||
homing_state.home(coord, homepos, rail.get_endstops(),
|
||||
homing_speed/2.0, second_home=True)
|
||||
second_homing_speed, second_home=True)
|
||||
# Set final homed position
|
||||
coord[axis] = hi.position_endstop + rail.get_homed_offset()
|
||||
homing_state.set_homed_position(coord)
|
||||
|
|
|
@ -63,6 +63,7 @@ class CoreXYKinematics:
|
|||
r2pos = rpos + hi.retract_dist
|
||||
# Initial homing
|
||||
homing_speed = hi.speed
|
||||
second_homing_speed = hi.second_homing_speed
|
||||
if axis == 2:
|
||||
homing_speed = min(homing_speed, self.max_z_velocity)
|
||||
homepos = [None, None, None, None]
|
||||
|
@ -72,11 +73,11 @@ class CoreXYKinematics:
|
|||
homing_state.home(coord, homepos, rail.get_endstops(), homing_speed)
|
||||
# Retract
|
||||
coord[axis] = rpos
|
||||
homing_state.retract(coord, homing_speed)
|
||||
homing_state.retract(coord, second_homing_speed)
|
||||
# Home again
|
||||
coord[axis] = r2pos
|
||||
homing_state.home(coord, homepos, rail.get_endstops(),
|
||||
homing_speed/2.0, second_home=True)
|
||||
second_homing_speed, second_home=True)
|
||||
if axis == 2:
|
||||
# Support endstop phase detection on Z axis
|
||||
coord[axis] = hi.position_endstop + rail.get_homed_offset()
|
||||
|
|
|
@ -101,17 +101,18 @@ class DeltaKinematics:
|
|||
# Initial homing - assume homing speed same for all steppers
|
||||
hi = self.rails[0].get_homing_info()
|
||||
homing_speed = min(hi.speed, self.max_z_velocity)
|
||||
second_homing_speed = min(hi.second_homing_speed, self.max_z_velocity)
|
||||
homepos = [0., 0., self.max_z, None]
|
||||
coord = list(homepos)
|
||||
coord[2] = -1.5 * math.sqrt(max(self.arm2)-self.max_xy2)
|
||||
homing_state.home(coord, homepos, endstops, homing_speed)
|
||||
# Retract
|
||||
coord[2] = homepos[2] - hi.retract_dist
|
||||
homing_state.retract(coord, homing_speed)
|
||||
homing_state.retract(coord, second_homing_speed)
|
||||
# Home again
|
||||
coord[2] -= hi.retract_dist
|
||||
homing_state.home(coord, homepos, endstops,
|
||||
homing_speed/2.0, second_home=True)
|
||||
second_homing_speed, second_home=True)
|
||||
# Set final homed position
|
||||
spos = [ep + rail.get_homed_offset()
|
||||
for ep, rail in zip(self.abs_endstops, self.rails)]
|
||||
|
|
|
@ -145,6 +145,7 @@ class PrinterRail:
|
|||
" position_min and position_max" % config.get_name())
|
||||
# Homing mechanics
|
||||
self.homing_speed = config.getfloat('homing_speed', 5.0, above=0.)
|
||||
self.second_homing_speed = config.getfloat('second_homing_speed', self.homing_speed/2., above=0.)
|
||||
self.homing_retract_dist = config.getfloat(
|
||||
'homing_retract_dist', 5., minval=0.)
|
||||
self.homing_positive_dir = config.getboolean(
|
||||
|
@ -220,9 +221,9 @@ class PrinterRail:
|
|||
return self.position_min, self.position_max
|
||||
def get_homing_info(self):
|
||||
homing_info = collections.namedtuple('homing_info', [
|
||||
'speed', 'position_endstop', 'retract_dist', 'positive_dir'])(
|
||||
'speed', 'position_endstop', 'retract_dist', 'positive_dir', 'second_homing_speed'])(
|
||||
self.homing_speed, self.position_endstop,
|
||||
self.homing_retract_dist, self.homing_positive_dir)
|
||||
self.homing_retract_dist, self.homing_positive_dir, self.second_homing_speed)
|
||||
return homing_info
|
||||
def get_steppers(self):
|
||||
return list(self.steppers)
|
||||
|
|
Loading…
Reference in New Issue