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