probe: Check for toolhead movement during activate/deactivate_gcode scripts

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-06-03 18:10:29 -04:00 committed by KevinOConnor
parent df80d96ae6
commit 40f73dd7f4
1 changed files with 10 additions and 0 deletions

View File

@ -221,10 +221,20 @@ class ProbeEndstopWrapper:
for stepper in kin.get_steppers('Z'): for stepper in kin.get_steppers('Z'):
stepper.add_to_endstop(self) stepper.add_to_endstop(self)
def home_prepare(self): def home_prepare(self):
toolhead = self.printer.lookup_object('toolhead')
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]:
raise homing.CommandError(
"Toolhead moved during probe activate_gcode script")
self.mcu_endstop.home_prepare() self.mcu_endstop.home_prepare()
def home_finalize(self): def home_finalize(self):
toolhead = self.printer.lookup_object('toolhead')
start_pos = toolhead.get_position()
self.deactivate_gcode.run_gcode_from_command() self.deactivate_gcode.run_gcode_from_command()
if toolhead.get_position()[:3] != start_pos[:3]:
raise homing.CommandError(
"Toolhead moved during probe deactivate_gcode script")
self.mcu_endstop.home_finalize() self.mcu_endstop.home_finalize()
def get_position_endstop(self): def get_position_endstop(self):
return self.position_endstop return self.position_endstop