aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/Command_Templates.md2
-rw-r--r--klippy/extras/probe.py5
2 files changed, 6 insertions, 1 deletions
diff --git a/docs/Command_Templates.md b/docs/Command_Templates.md
index ea4c03b9..125436ee 100644
--- a/docs/Command_Templates.md
+++ b/docs/Command_Templates.md
@@ -214,6 +214,8 @@ The following are common printer attributes:
as "triggered" during the last QUERY_PROBE command. Note, due to the
order of template expansion (see above), the QUERY_PROBE command
must be run prior to the macro containing this reference.
+- `printer.probe.last_z_result`: Returns the Z result value of the last
+ PROBE command.
- `printer.configfile.settings.<section>.<option>`: Returns the given
config file setting (or default value) during the last software
start or restart. (Any settings changed at run-time will not be
diff --git a/klippy/extras/probe.py b/klippy/extras/probe.py
index fe6cb151..f99bd455 100644
--- a/klippy/extras/probe.py
+++ b/klippy/extras/probe.py
@@ -26,6 +26,7 @@ class PrinterProbe:
self.probe_calibrate_z = 0.
self.multi_probe_pending = False
self.last_state = False
+ self.last_z_result = 0.
# Infer Z position to move to during a probe
if config.has_section('stepper_z'):
zconfig = config.getsection('stepper_z')
@@ -185,6 +186,7 @@ class PrinterProbe:
def cmd_PROBE(self, gcmd):
pos = self.run_probe(gcmd)
gcmd.respond_info("Result is z=%.6f" % (pos[2],))
+ self.last_z_result = pos[2]
cmd_QUERY_PROBE_help = "Return the status of the z-probe"
def cmd_QUERY_PROBE(self, gcmd):
toolhead = self.printer.lookup_object('toolhead')
@@ -193,7 +195,8 @@ class PrinterProbe:
self.last_state = res
gcmd.respond_info("probe: %s" % (["open", "TRIGGERED"][not not res],))
def get_status(self, eventtime):
- return {'last_query': self.last_state}
+ return {'last_query': self.last_state,
+ 'last_z_result': self.last_z_result}
cmd_PROBE_ACCURACY_help = "Probe Z-height accuracy at current XY position"
def cmd_PROBE_ACCURACY(self, gcmd):
speed = gcmd.get_float("PROBE_SPEED", self.speed, above=0.)