aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-02-09 22:54:24 -0500
committerKevin O'Connor <kevin@koconnor.net>2019-02-12 13:20:32 -0500
commitb0b9fc6f4a8a0cf16166b1ea2f29fb4747873d30 (patch)
tree64652fe1cbeae97d0e666c582ad0407de5a2959c
parent35ea4a137d15c04f2997315002928dd049bb0536 (diff)
downloadkutter-b0b9fc6f4a8a0cf16166b1ea2f29fb4747873d30.tar.gz
kutter-b0b9fc6f4a8a0cf16166b1ea2f29fb4747873d30.tar.xz
kutter-b0b9fc6f4a8a0cf16166b1ea2f29fb4747873d30.zip
probe: Use manual_probe helper when performing manual probes
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--docs/G-Codes.md24
-rw-r--r--klippy/extras/probe.py27
2 files changed, 24 insertions, 27 deletions
diff --git a/docs/G-Codes.md b/docs/G-Codes.md
index 58c7a75d..38b90a13 100644
--- a/docs/G-Codes.md
+++ b/docs/G-Codes.md
@@ -190,10 +190,10 @@ The following commands are available when the "delta_calibrate" config
section is enabled:
- `DELTA_CALIBRATE [METHOD=manual]`: This command will probe seven
points on the bed and recommend updated endstop positions, tower
- angles, and radius.
- - `NEXT`: If manual bed probing is enabled, then one can use this
- command to move to the next probing point during a DELTA_CALIBRATE
- operation.
+ angles, and radius. If METHOD=manual is specified then the manual
+ probing tool is activated - see the MANUAL_PROBE command above for
+ details on the additional commands available while this tool is
+ active.
- `DELTA_ANALYZE`: This command is used during enhanced delta
calibration. See [Delta Calibrate](Delta_Calibrate.md) for details.
@@ -203,10 +203,10 @@ The following commands are available when the "bed_tilt" config
section is enabled:
- `BED_TILT_CALIBRATE [METHOD=manual]`: This command will probe the
points specified in the config and then recommend updated x and y
- tilt adjustments.
- - `NEXT`: If manual bed probing is enabled, then one can use this
- command to move to the next probing point during a
- BED_TILT_CALIBRATE operation.
+ tilt adjustments. If METHOD=manual is specified then the manual
+ probing tool is activated - see the MANUAL_PROBE command above for
+ details on the additional commands available while this tool is
+ active.
## Mesh Bed Leveling
@@ -215,10 +215,10 @@ section is enabled:
- `BED_MESH_CALIBRATE [METHOD=manual]`: This command probes the bed
using generated points specified by the parameters in the
config. After probing, a mesh is generated and z-movement is
- adjusted according to the mesh.
- - `NEXT`: If manual bed probing is enabled, then one can use this
- command to move to the next probing point during a
- BED_MESH_CALIBRATE operation.
+ adjusted according to the mesh. If METHOD=manual is specified then
+ the manual probing tool is activated - see the MANUAL_PROBE command
+ above for details on the additional commands available while this
+ tool is active.
- `BED_MESH_OUTPUT`: This command outputs the current probed z values
and current mesh values to the terminal.
- `BED_MESH_MAP`: This command probes the bed in a similar fashion
diff --git a/klippy/extras/probe.py b/klippy/extras/probe.py
index 27cd3877..3d0bf775 100644
--- a/klippy/extras/probe.py
+++ b/klippy/extras/probe.py
@@ -169,7 +169,7 @@ class ProbePointsHelper:
'sample_retract_dist', 2., above=0.)
# Internal probing state
self.results = []
- self.busy = False
+ self.busy = self.manual_probe = False
self.gcode = self.toolhead = None
def get_lift_speed(self):
return self.lift_speed
@@ -207,6 +207,9 @@ class ProbePointsHelper:
self._finalize(False)
raise self.gcode.error(str(e))
self.gcode.reset_last_position()
+ if self.manual_probe:
+ manual_probe.ManualProbeHelper(self.printer, {},
+ self._manual_probe_finalize)
def _automatic_probe_point(self):
positions = []
for i in range(self.samples):
@@ -229,13 +232,14 @@ class ProbePointsHelper:
probe = self.printer.lookup_object('probe', None)
method = self.gcode.get_str('METHOD', params, 'automatic').lower()
if probe is not None and method == 'automatic':
+ self.manual_probe = False
self.lift_speed = min(self.speed, probe.speed)
self.probe_offsets = probe.get_offsets()
if self.horizontal_move_z < self.probe_offsets[2]:
raise self.gcode.error("horizontal_move_z can't be less than"
" probe's z_offset")
else:
- probe = None
+ self.manual_probe = True
self.lift_speed = self.speed
self.probe_offsets = (0., 0., 0.)
# Start probe
@@ -243,27 +247,20 @@ class ProbePointsHelper:
self.busy = True
self._lift_z(self.horizontal_move_z, speed=self.speed)
self._move_next()
- if probe is None:
- # Setup for manual probing
- self.gcode.register_command('NEXT', None)
- self.gcode.register_command('NEXT', self.cmd_NEXT,
- desc=self.cmd_NEXT_help)
- else:
+ if not self.manual_probe:
# Perform automatic probing
while self.busy:
self._automatic_probe_point()
self._move_next()
- cmd_NEXT_help = "Move to the next XY position to probe"
- def cmd_NEXT(self, params):
- # Record current position for manual probe
- self.toolhead.get_last_move_time()
- self.results.append(self.toolhead.get_kinematics().calc_position())
- # Move to next position
+ def _manual_probe_finalize(self, kin_pos):
+ if kin_pos is None:
+ self._finalize(False)
+ return
+ self.results.append(kin_pos)
self._move_next()
def _finalize(self, success):
self.busy = False
self.gcode.reset_last_position()
- self.gcode.register_command('NEXT', None)
if success:
self.finalize_callback(self.probe_offsets, self.results)