diff --git a/klippy/extras/probe.py b/klippy/extras/probe.py index fdf35b0f..4c62b891 100644 --- a/klippy/extras/probe.py +++ b/klippy/extras/probe.py @@ -221,10 +221,20 @@ class ProbeEndstopWrapper: for stepper in kin.get_steppers('Z'): stepper.add_to_endstop(self) def home_prepare(self): + 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 homing.CommandError( + "Toolhead moved during probe activate_gcode script") self.mcu_endstop.home_prepare() def home_finalize(self): + toolhead = self.printer.lookup_object('toolhead') + start_pos = toolhead.get_position() 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() def get_position_endstop(self): return self.position_endstop