homing: Pass the HomingMove class to homing_move_begin/end events
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
37a263c0b9
commit
58a0eb76c5
|
@ -177,7 +177,7 @@ class BLTouchEndstopWrapper:
|
||||||
self.raise_probe()
|
self.raise_probe()
|
||||||
self.sync_print_time()
|
self.sync_print_time()
|
||||||
self.multi = 'OFF'
|
self.multi = 'OFF'
|
||||||
def probe_prepare(self):
|
def probe_prepare(self, hmove):
|
||||||
if self.multi == 'OFF' or self.multi == 'FIRST':
|
if self.multi == 'OFF' or self.multi == 'FIRST':
|
||||||
self.lower_probe()
|
self.lower_probe()
|
||||||
if self.multi == 'FIRST':
|
if self.multi == 'FIRST':
|
||||||
|
@ -187,7 +187,7 @@ class BLTouchEndstopWrapper:
|
||||||
toolhead.flush_step_generation()
|
toolhead.flush_step_generation()
|
||||||
self.start_mcu_pos = [(s, s.get_mcu_position())
|
self.start_mcu_pos = [(s, s.get_mcu_position())
|
||||||
for s in self.mcu_endstop.get_steppers()]
|
for s in self.mcu_endstop.get_steppers()]
|
||||||
def probe_finish(self):
|
def probe_finish(self, hmove):
|
||||||
if self.multi == 'OFF':
|
if self.multi == 'OFF':
|
||||||
self.raise_probe()
|
self.raise_probe()
|
||||||
self.sync_print_time()
|
self.sync_print_time()
|
||||||
|
|
|
@ -25,6 +25,8 @@ class HomingMove:
|
||||||
toolhead = printer.lookup_object('toolhead')
|
toolhead = printer.lookup_object('toolhead')
|
||||||
self.toolhead = toolhead
|
self.toolhead = toolhead
|
||||||
self.end_mcu_pos = []
|
self.end_mcu_pos = []
|
||||||
|
def get_mcu_endstops(self):
|
||||||
|
return [es for es, name in self.endstops]
|
||||||
def _calc_endstop_rate(self, mcu_endstop, movepos, speed):
|
def _calc_endstop_rate(self, mcu_endstop, movepos, speed):
|
||||||
startpos = self.toolhead.get_position()
|
startpos = self.toolhead.get_position()
|
||||||
axes_d = [mp - sp for mp, sp in zip(movepos, startpos)]
|
axes_d = [mp - sp for mp, sp in zip(movepos, startpos)]
|
||||||
|
@ -40,8 +42,7 @@ class HomingMove:
|
||||||
def homing_move(self, movepos, speed, probe_pos=False,
|
def homing_move(self, movepos, speed, probe_pos=False,
|
||||||
triggered=True, check_triggered=True):
|
triggered=True, check_triggered=True):
|
||||||
# Notify start of homing/probing move
|
# Notify start of homing/probing move
|
||||||
self.printer.send_event("homing:homing_move_begin",
|
self.printer.send_event("homing:homing_move_begin", self)
|
||||||
[es for es, name in self.endstops])
|
|
||||||
# Note start location
|
# Note start location
|
||||||
self.toolhead.flush_step_generation()
|
self.toolhead.flush_step_generation()
|
||||||
kin = self.toolhead.get_kinematics()
|
kin = self.toolhead.get_kinematics()
|
||||||
|
@ -85,8 +86,7 @@ class HomingMove:
|
||||||
self.toolhead.set_position(movepos)
|
self.toolhead.set_position(movepos)
|
||||||
# Signal homing/probing move complete
|
# Signal homing/probing move complete
|
||||||
try:
|
try:
|
||||||
self.printer.send_event("homing:homing_move_end",
|
self.printer.send_event("homing:homing_move_end", self)
|
||||||
[es for es, name in self.endstops])
|
|
||||||
except self.printer.command_error as e:
|
except self.printer.command_error as e:
|
||||||
if error is None:
|
if error is None:
|
||||||
error = str(e)
|
error = str(e)
|
||||||
|
|
|
@ -52,15 +52,15 @@ class HomingHeaters:
|
||||||
for es in endstops
|
for es in endstops
|
||||||
for s in es.get_steppers()]
|
for s in es.get_steppers()]
|
||||||
return any(x in self.flaky_steppers for x in steppers_being_homed)
|
return any(x in self.flaky_steppers for x in steppers_being_homed)
|
||||||
def handle_homing_move_begin(self, endstops):
|
def handle_homing_move_begin(self, hmove):
|
||||||
if not self.check_eligible(endstops):
|
if not self.check_eligible(hmove.get_mcu_endstops()):
|
||||||
return
|
return
|
||||||
for heater_name in self.disable_heaters:
|
for heater_name in self.disable_heaters:
|
||||||
heater = self.pheaters.lookup_heater(heater_name)
|
heater = self.pheaters.lookup_heater(heater_name)
|
||||||
self.target_save[heater_name] = heater.get_temp(0)[1]
|
self.target_save[heater_name] = heater.get_temp(0)[1]
|
||||||
heater.set_temp(0.)
|
heater.set_temp(0.)
|
||||||
def handle_homing_move_end(self, endstops):
|
def handle_homing_move_end(self, hmove):
|
||||||
if not self.check_eligible(endstops):
|
if not self.check_eligible(hmove.get_mcu_endstops()):
|
||||||
return
|
return
|
||||||
for heater_name in self.disable_heaters:
|
for heater_name in self.disable_heaters:
|
||||||
heater = self.pheaters.lookup_heater(heater_name)
|
heater = self.pheaters.lookup_heater(heater_name)
|
||||||
|
|
|
@ -70,12 +70,12 @@ class PrinterProbe:
|
||||||
desc=self.cmd_PROBE_CALIBRATE_help)
|
desc=self.cmd_PROBE_CALIBRATE_help)
|
||||||
self.gcode.register_command('PROBE_ACCURACY', self.cmd_PROBE_ACCURACY,
|
self.gcode.register_command('PROBE_ACCURACY', self.cmd_PROBE_ACCURACY,
|
||||||
desc=self.cmd_PROBE_ACCURACY_help)
|
desc=self.cmd_PROBE_ACCURACY_help)
|
||||||
def _handle_homing_move_begin(self, endstops):
|
def _handle_homing_move_begin(self, hmove):
|
||||||
if self.mcu_probe in endstops:
|
if self.mcu_probe in hmove.get_mcu_endstops():
|
||||||
self.mcu_probe.probe_prepare()
|
self.mcu_probe.probe_prepare(hmove)
|
||||||
def _handle_homing_move_end(self, endstops):
|
def _handle_homing_move_end(self, hmove):
|
||||||
if self.mcu_probe in endstops:
|
if self.mcu_probe in hmove.get_mcu_endstops():
|
||||||
self.mcu_probe.probe_finish()
|
self.mcu_probe.probe_finish(hmove)
|
||||||
def _handle_home_rails_begin(self, homing_state, rails):
|
def _handle_home_rails_begin(self, homing_state, rails):
|
||||||
endstops = [es for rail in rails for es, name in rail.get_endstops()]
|
endstops = [es for rail in rails for es, name in rail.get_endstops()]
|
||||||
if self.mcu_probe in endstops:
|
if self.mcu_probe in endstops:
|
||||||
|
@ -296,14 +296,14 @@ class ProbeEndstopWrapper:
|
||||||
pass
|
pass
|
||||||
def multi_probe_end(self):
|
def multi_probe_end(self):
|
||||||
pass
|
pass
|
||||||
def probe_prepare(self):
|
def probe_prepare(self, hmove):
|
||||||
toolhead = self.printer.lookup_object('toolhead')
|
toolhead = self.printer.lookup_object('toolhead')
|
||||||
start_pos = toolhead.get_position()
|
start_pos = toolhead.get_position()
|
||||||
self.activate_gcode.run_gcode_from_command()
|
self.activate_gcode.run_gcode_from_command()
|
||||||
if toolhead.get_position()[:3] != start_pos[:3]:
|
if toolhead.get_position()[:3] != start_pos[:3]:
|
||||||
raise self.printer.command_error(
|
raise self.printer.command_error(
|
||||||
"Toolhead moved during probe activate_gcode script")
|
"Toolhead moved during probe activate_gcode script")
|
||||||
def probe_finish(self):
|
def probe_finish(self, hmove):
|
||||||
toolhead = self.printer.lookup_object('toolhead')
|
toolhead = self.printer.lookup_object('toolhead')
|
||||||
start_pos = toolhead.get_position()
|
start_pos = toolhead.get_position()
|
||||||
self.deactivate_gcode.run_gcode_from_command()
|
self.deactivate_gcode.run_gcode_from_command()
|
||||||
|
|
|
@ -360,8 +360,8 @@ class TMCVirtualPinHelper:
|
||||||
self.handle_homing_move_end)
|
self.handle_homing_move_end)
|
||||||
self.mcu_endstop = ppins.setup_pin('endstop', self.diag_pin)
|
self.mcu_endstop = ppins.setup_pin('endstop', self.diag_pin)
|
||||||
return self.mcu_endstop
|
return self.mcu_endstop
|
||||||
def handle_homing_move_begin(self, endstops):
|
def handle_homing_move_begin(self, hmove):
|
||||||
if self.mcu_endstop not in endstops:
|
if self.mcu_endstop not in hmove.get_mcu_endstops():
|
||||||
return
|
return
|
||||||
reg = self.fields.lookup_register("en_pwm_mode", None)
|
reg = self.fields.lookup_register("en_pwm_mode", None)
|
||||||
if reg is None:
|
if reg is None:
|
||||||
|
@ -376,8 +376,8 @@ class TMCVirtualPinHelper:
|
||||||
self.mcu_tmc.set_register("GCONF", val)
|
self.mcu_tmc.set_register("GCONF", val)
|
||||||
tc_val = self.fields.set_field("TCOOLTHRS", 0xfffff)
|
tc_val = self.fields.set_field("TCOOLTHRS", 0xfffff)
|
||||||
self.mcu_tmc.set_register("TCOOLTHRS", tc_val)
|
self.mcu_tmc.set_register("TCOOLTHRS", tc_val)
|
||||||
def handle_homing_move_end(self, endstops):
|
def handle_homing_move_end(self, hmove):
|
||||||
if self.mcu_endstop not in endstops:
|
if self.mcu_endstop not in hmove.get_mcu_endstops():
|
||||||
return
|
return
|
||||||
reg = self.fields.lookup_register("en_pwm_mode", None)
|
reg = self.fields.lookup_register("en_pwm_mode", None)
|
||||||
if reg is None:
|
if reg is None:
|
||||||
|
|
Loading…
Reference in New Issue