aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-09-26 13:07:18 -0400
committerKevinOConnor <kevin@koconnor.net>2018-10-01 11:12:30 -0400
commit33887b8c396c5933cf6bd3ad653eec32834f2c9f (patch)
treec37b0c049088529b123dfadb64a8f13af1cdc564
parent0e9b8abde2940eb17aad0337cb0dd55f6fadffb9 (diff)
downloadkutter-33887b8c396c5933cf6bd3ad653eec32834f2c9f.tar.gz
kutter-33887b8c396c5933cf6bd3ad653eec32834f2c9f.tar.xz
kutter-33887b8c396c5933cf6bd3ad653eec32834f2c9f.zip
probe: Support manual probing at runtime
Don't require the config file to specify manual probing. Instead, allow the user to select manual probing on each ProbePointsHelper invocation. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--config/example-delta.cfg8
-rw-r--r--config/example-extras.cfg11
-rw-r--r--docs/Delta_Calibrate.md2
-rw-r--r--docs/G-Codes.md20
-rw-r--r--klippy/extras/bed_mesh.py8
-rw-r--r--klippy/extras/bed_tilt.py2
-rw-r--r--klippy/extras/delta_calibrate.py2
-rw-r--r--klippy/extras/probe.py38
-rw-r--r--klippy/extras/quad_gantry_level.py2
-rw-r--r--klippy/extras/z_tilt.py2
10 files changed, 41 insertions, 54 deletions
diff --git a/config/example-delta.cfg b/config/example-delta.cfg
index 1b577224..858716e5 100644
--- a/config/example-delta.cfg
+++ b/config/example-delta.cfg
@@ -121,14 +121,6 @@ radius: 50
#horizontal_move_z: 5
# The height (in mm) that the head should be commanded to move to
# just prior to starting a probe operation. The default is 5.
-#manual_probe:
-# If true, then DELTA_CALIBRATE will perform manual probing. If
-# false, then a PROBE command will be run at each probe
-# point. Manual probing is accomplished by manually jogging the Z
-# position of the print head at each probe point and then issuing a
-# NEXT extended g-code command to record the position at that
-# point. The default is false if a [probe] config section is present
-# and true otherwise.
#samples: 1
# The number of times to probe each point. The probed z-values
# will be averaged. The default is to probe 1 time.
diff --git a/config/example-extras.cfg b/config/example-extras.cfg
index e893c07c..7257961e 100644
--- a/config/example-extras.cfg
+++ b/config/example-extras.cfg
@@ -63,14 +63,6 @@
#horizontal_move_z: 5
# The height (in mm) that the head should be commanded to move to
# just prior to starting a probe operation. The default is 5.
-#manual_probe:
-# If true, then BED_TILT_CALIBRATE will perform manual probing. If
-# false, then a PROBE command will be run at each probe
-# point. Manual probing is accomplished by manually jogging the Z
-# position of the print head at each probe point and then issuing a
-# NEXT extended g-code command to record the position at that
-# point. The default is false if a [probe] config section is present
-# and true otherwise.
#samples: 1
# The number of times to probe each point. The probed z-values
# will be averaged. The default is to probe 1 time.
@@ -140,9 +132,6 @@
# may be applied to change the amount of slope interpolated.
# Larger numbers will increase the amount of slope, which
# results in more curvature in the mesh. Default is .2.
-#manual_probe:
-# See the manual_probe option of [bed_tilt] for details. The default
-# is false if a [probe] config section is present and true otherwise.
# Multiple Z stepper tilt adjustment. This feature enables independent
diff --git a/docs/Delta_Calibrate.md b/docs/Delta_Calibrate.md
index e444f473..cec41863 100644
--- a/docs/Delta_Calibrate.md
+++ b/docs/Delta_Calibrate.md
@@ -46,7 +46,7 @@ eliminates error introduced by the probe.
To perform the basic probe, make sure the config has a
[delta_calibrate] section defined and run:
```
-DELTA_CALIBRATE
+DELTA_CALIBRATE METHOD=manual
```
After probing the seven points new delta parameters will be
calculated. Save and apply these parameters by running:
diff --git a/docs/G-Codes.md b/docs/G-Codes.md
index dcaa2b20..29e89a6b 100644
--- a/docs/G-Codes.md
+++ b/docs/G-Codes.md
@@ -147,8 +147,9 @@ enabled:
The following commands are available when the "delta_calibrate" config
section is enabled:
-- `DELTA_CALIBRATE`: This command will probe seven points on the bed
- and recommend updated endstop positions, tower angles, and radius.
+- `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.
@@ -159,8 +160,9 @@ section is enabled:
The following commands are available when the "bed_tilt" config
section is enabled:
-- `BED_TILT_CALIBRATE`: This command will probe the points specified
- in the config and then recommend updated x and y tilt adjustments.
+- `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.
@@ -169,9 +171,13 @@ section is enabled:
The following commands are available when the "bed_mesh" config
section is enabled:
-- `BED_MESH_CALIBRATE`: 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.
+- `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.
- `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/bed_mesh.py b/klippy/extras/bed_mesh.py
index d31c2609..5a7a622d 100644
--- a/klippy/extras/bed_mesh.py
+++ b/klippy/extras/bed_mesh.py
@@ -204,15 +204,15 @@ class BedMeshCalibrate:
cmd_BED_MESH_MAP_help = "Probe the bed and serialize output"
def cmd_BED_MESH_MAP(self, params):
self.build_map = True
- self.start_calibration()
+ self.start_calibration(params)
cmd_BED_MESH_CALIBRATE_help = "Perform Mesh Bed Leveling"
def cmd_BED_MESH_CALIBRATE(self, params):
self.build_map = False
- self.start_calibration()
- def start_calibration(self):
+ self.start_calibration(params)
+ def start_calibration(self, params):
self.bedmesh.set_mesh(None)
self.gcode.run_script_from_command("G28")
- self.probe_helper.start_probe()
+ self.probe_helper.start_probe(params)
def print_probed_positions(self, print_func):
if self.probed_z_table is not None:
msg = "Mesh Leveling Probed Z positions:\n"
diff --git a/klippy/extras/bed_tilt.py b/klippy/extras/bed_tilt.py
index 558047cc..67c61a62 100644
--- a/klippy/extras/bed_tilt.py
+++ b/klippy/extras/bed_tilt.py
@@ -56,7 +56,7 @@ class BedTiltCalibrate:
cmd_BED_TILT_CALIBRATE_help = "Bed tilt calibration script"
def cmd_BED_TILT_CALIBRATE(self, params):
self.gcode.run_script_from_command("G28")
- self.probe_helper.start_probe()
+ self.probe_helper.start_probe(params)
def probe_finalize(self, offsets, positions):
z_offset = offsets[2]
logging.info("Calculating bed_tilt with: %s", positions)
diff --git a/klippy/extras/delta_calibrate.py b/klippy/extras/delta_calibrate.py
index 78a46586..b30ffaf2 100644
--- a/klippy/extras/delta_calibrate.py
+++ b/klippy/extras/delta_calibrate.py
@@ -275,7 +275,7 @@ class DeltaCalibrate:
cmd_DELTA_CALIBRATE_help = "Delta calibration script"
def cmd_DELTA_CALIBRATE(self, params):
self.gcode.run_script_from_command("G28")
- self.probe_helper.start_probe()
+ self.probe_helper.start_probe(params)
def do_extended_calibration(self):
# Extract distance positions
if len(self.delta_analyze_entry) <= 1:
diff --git a/klippy/extras/probe.py b/klippy/extras/probe.py
index 3b96a9a3..df5f9268 100644
--- a/klippy/extras/probe.py
+++ b/klippy/extras/probe.py
@@ -155,23 +155,10 @@ class ProbePointsHelper:
config.get_name()))
self.horizontal_move_z = config.getfloat('horizontal_move_z', 5.)
self.speed = self.lift_speed = config.getfloat('speed', 50., above=0.)
- # Lookup probe object
- self.probe = None
self.probe_offsets = (0., 0., 0.)
self.samples = config.getint('samples', 1, minval=1)
self.sample_retract_dist = config.getfloat(
'sample_retract_dist', 2., above=0.)
- manual_probe = config.getboolean('manual_probe', None)
- if manual_probe is None:
- manual_probe = not config.has_section('probe')
- if not manual_probe:
- self.printer.try_load_module(config, 'probe')
- self.probe = self.printer.lookup_object('probe')
- self.lift_speed = min(self.speed, self.probe.speed)
- self.probe_offsets = self.probe.get_offsets()
- if self.horizontal_move_z < self.probe_offsets[2]:
- raise config.error("horizontal_move_z can't be less than probe's"
- " z_offset in %s" % (config.get_name()))
# Internal probing state
self.results = []
self.busy = False
@@ -179,10 +166,10 @@ class ProbePointsHelper:
def get_lift_speed(self):
return self.lift_speed
def get_last_xy_home_positon(self):
- if self.probe is not None:
- return self.probe.last_home_position()
- else:
+ probe = self.printer.lookup_object('probe', None)
+ if probe is None:
return None
+ return probe.last_home_position()
def _lift_z(self, z_pos, add=False, speed=None):
# Lift toolhead
curpos = self.toolhead.get_position()
@@ -232,15 +219,28 @@ class ProbePointsHelper:
avg_pos = [sum([pos[i] for pos in positions]) / self.samples
for i in range(3)]
self.results.append(avg_pos)
- def start_probe(self):
- # Begin probing
+ def start_probe(self, params):
+ # Lookup objects
self.toolhead = self.printer.lookup_object('toolhead')
self.gcode = self.printer.lookup_object('gcode')
+ 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.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.lift_speed = self.speed
+ self.probe_offsets = (0., 0., 0.)
+ # Start probe
self.results = []
self.busy = True
self._lift_z(self.horizontal_move_z, speed=self.speed)
self._move_next()
- if self.probe is None:
+ if probe is None:
# Setup for manual probing
self.gcode.register_command('NEXT', None)
self.gcode.register_command('NEXT', self.cmd_NEXT,
diff --git a/klippy/extras/quad_gantry_level.py b/klippy/extras/quad_gantry_level.py
index 9eb1810c..b9f91f1f 100644
--- a/klippy/extras/quad_gantry_level.py
+++ b/klippy/extras/quad_gantry_level.py
@@ -38,7 +38,7 @@ class QuadGantryLevel:
self.z_steppers = z_steppers
cmd_QUAD_GANTRY_LEVEL_help = "Conform a moving, twistable gantry to the shape of a stationary bed"
def cmd_QUAD_GANTRY_LEVEL(self, params):
- self.probe_helper.start_probe()
+ self.probe_helper.start_probe(params)
def probe_finalize(self, offsets, positions):
logging.info("quad_gantry_level Calculating gantry geometry with: %s", positions)
p1 = [positions[0][0] + offsets[0],positions[0][2]]
diff --git a/klippy/extras/z_tilt.py b/klippy/extras/z_tilt.py
index f5c4614d..e6e1aab8 100644
--- a/klippy/extras/z_tilt.py
+++ b/klippy/extras/z_tilt.py
@@ -39,7 +39,7 @@ class ZTilt:
self.z_steppers = z_steppers
cmd_Z_TILT_ADJUST_help = "Adjust the Z tilt"
def cmd_Z_TILT_ADJUST(self, params):
- self.probe_helper.start_probe()
+ self.probe_helper.start_probe(params)
def probe_finalize(self, offsets, positions):
z_offset = offsets[2]
logging.info("Calculating bed tilt with: %s", positions)