manual_probe: Add extra checks to catch manual probe not finishing correctly

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-06-04 20:36:30 -04:00 committed by KevinOConnor
parent 40f73dd7f4
commit 49a3083d6a
2 changed files with 15 additions and 8 deletions

View File

@ -41,6 +41,16 @@ class ManualProbe:
def cmd_Z_ENDSTOP_CALIBRATE(self, params):
ManualProbeHelper(self.printer, params, self.z_endstop_finalize)
# Verify that a manual probe isn't already in progress
def verify_no_manual_probe(printer):
gcode = printer.lookup_object('gcode')
try:
gcode.register_command('ACCEPT', 'dummy')
except printer.config_error as e:
raise gcode.error(
"Already in a manual Z probe. Use ABORT to abort it.")
gcode.register_command('ACCEPT', None)
Z_BOB_MINIMUM = 0.500
BISECT_MAX = 0.200
@ -55,14 +65,9 @@ class ManualProbeHelper:
self.past_positions = []
self.last_toolhead_pos = self.last_kinematics_pos = None
# Register commands
try:
verify_no_manual_probe(printer)
self.gcode.register_command('ACCEPT', self.cmd_ACCEPT,
desc=self.cmd_ACCEPT_help)
except self.printer.config_error as e:
self.gcode.respond_error(
"Already in a manual Z probe. Use ABORT to abort it.")
self.finalize_callback(None)
return
self.gcode.register_command('NEXT', self.cmd_ACCEPT)
self.gcode.register_command('ABORT', self.cmd_ABORT,
desc=self.cmd_ABORT_help)

View File

@ -175,6 +175,7 @@ class PrinterProbe:
configfile.set(self.name, 'z_offset', "%.3f" % (z_offset,))
cmd_PROBE_CALIBRATE_help = "Calibrate the probe's z_offset"
def cmd_PROBE_CALIBRATE(self, params):
manual_probe.verify_no_manual_probe(self.printer)
# Perform initial probe
curpos = self.run_probe()
# Move away from the bed
@ -292,6 +293,7 @@ class ProbePointsHelper:
self.gcode.reset_last_position()
return False
def start_probe(self, params):
manual_probe.verify_no_manual_probe(self.printer)
# Lookup objects
probe = self.printer.lookup_object('probe', None)
method = self.gcode.get_str('METHOD', params, 'automatic').lower()