Skip to content
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ See the [Kalico Additions document](https://docs.kalico.gg/Kalico_Additions.html

- [probe: z_calibration](https://github.com/KalicoCrew/kalico/pull/31) ([klipper#4614](https://github.com/Klipper3d/klipper/pull/4614) / [protoloft/z_calibration](https://github.com/protoloft/klipper_z_calibration))

- [probe: multiple probes](https://github.com/KalicoCrew/kalico/pull/972)

- [z_tilt: z-tilt calibration](https://github.com/KalicoCrew/kalico/pull/105) ([klipper3d#4083](https://github.com/Klipper3d/klipper/pull/4083) / [dk/ztilt_calibration](https://github.com/KalicoCrew/kalico/pull/54))

- [stepper: home_current](https://github.com/KalicoCrew/kalico/pull/65)
Expand Down
34 changes: 27 additions & 7 deletions docs/Config_Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2484,12 +2484,13 @@ pins:
Z height probe. One may define this section to enable Z height probing
hardware. When this section is enabled, PROBE and QUERY_PROBE extended
[g-code commands](G-Codes.md#probe) become available. Also, see the
[probe calibrate guide](Probe_Calibrate.md). The probe section also
creates a virtual "probe:z_virtual_endstop" pin. One may set the
stepper_z endstop_pin to this virtual pin on cartesian style printers
that use the probe in place of a z endstop. If using
"probe:z_virtual_endstop" then do not define a position_endstop in the
stepper_z config section.
[probe calibrate guide](Probe_Calibrate.md). The probe section, and all
other probe types, also create virtual endstops by the name of
`<probe name>:z_virtual_endstop`. The default probe additionally registers
itself as `probe:z_virtual_endstop`. One may set the stepper_z endstop_pin
to such a virtual pin on cartesian style printers that use the probe in
place of a z endstop. If using "probe:z_virtual_endstop" then do not define
a position_endstop in the stepper_z config section.

```
[probe]
Expand Down Expand Up @@ -2537,6 +2538,11 @@ z_offset:
# not obtained in the given number of retries then an error is
# reported. The default is zero which causes an error to be reported
# on the first sample that exceeds samples_tolerance.
#register_as_probe: True
# If this probe should be automatically registered as the default one.
# Defaults to true. When using multiple probes, only a single probe is
# allowed to register as the default, and all other probe configuration
# blocks must set this to false.
#activate_gcode:
# A list of G-Code commands to execute prior to each probe attempt.
# See docs/Command_Templates.md for G-Code format. This may be
Expand Down Expand Up @@ -2584,6 +2590,14 @@ z_offset:
# 0 will disable scrubbing. The default is 0.
```

It is also possible to create named probes.
```
[probe named_probe]
# All options from [probe] are accepted.
```
At most one probe may set `register_as_probe: True`. If an unnamed `[probe]`
is present, no other probe may set `register_as_probe: True`.

### [nozzle_cleanup]

Enables the [NOZZLE_CLEANUP](G-Codes.md#nozzle_cleanup) gcode command. This
Expand All @@ -2600,7 +2614,8 @@ quality detection, such as the [load_cell_probe](#load_cell_probe).
# Number of probe locations along the X axis. Can be negative. Default is 10.
#pattern_y: 4
# Number of probe locations along the Y axis. Can be negative. Default is 4.
#
#probe:
# Probe to use, if not the default probe.
#These config values are inherited from [probe] if not specified:
#speed:
#lift_speed:
Expand Down Expand Up @@ -2666,6 +2681,7 @@ control_pin:
#samples_result:
#samples_tolerance:
#samples_tolerance_retries:
#register_as_probe:
# See the "probe" section for information on these parameters.
```

Expand Down Expand Up @@ -2776,6 +2792,7 @@ detach_position: 0,0,0
#samples_result:
#samples_tolerance:
#samples_tolerance_retries:
#register_as_probe:
#activate_gcode:
#deactivate_gcode:
# See the "probe" section for information on these parameters.
Expand Down Expand Up @@ -2829,6 +2846,7 @@ z_offset:
#samples_result:
#samples_tolerance:
#samples_tolerance_retries:
#register_as_probe:
#activate_gcode:
#deactivate_gcode:
#deactivate_on_each_sample:
Expand Down Expand Up @@ -2872,6 +2890,7 @@ sensor_type: ldc1612
#samples_result:
#samples_tolerance:
#samples_tolerance_retries:
#register_as_probe:
# See the "probe" section for information on these parameters.
```

Expand Down Expand Up @@ -6229,6 +6248,7 @@ sensor_type:
#samples_result:
#samples_tolerance:
#samples_tolerance_retries:
#register_as_probe:
#activate_gcode:
#deactivate_gcode:
# See the "[probe]" section for a description of the above parameters.
Expand Down
21 changes: 13 additions & 8 deletions docs/G-Codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ The following commands are available when the
section](Config_Reference.md#axis_twist_compensation) is enabled.

#### AXIS_TWIST_COMPENSATION_CALIBRATE
`AXIS_TWIST_COMPENSATION_CALIBRATE [AXIS=<X|Y>]
`AXIS_TWIST_COMPENSATION_CALIBRATE [PROBE=<name>] [AXIS=<X|Y>]
[SAMPLE_COUNT=<value>] [<probe_parameter>=<value>]`:

Calibrates axis twist compensation by specifying the target axis or
Expand Down Expand Up @@ -1561,7 +1561,7 @@ The following commands are available when a
see the [probe calibrate guide](Probe_Calibrate.md)).

#### PROBE
`PROBE [PROBE_SPEED=<mm/s>] [LIFT_SPEED=<mm/s>] [SAMPLES=<count>]
`PROBE [PROBE=<name>] [PROBE_SPEED=<mm/s>] [LIFT_SPEED=<mm/s>] [SAMPLES=<count>]
[SAMPLE_RETRACT_DIST=<mm>] [SAMPLES_TOLERANCE=<mm>]
[SAMPLES_TOLERANCE_RETRIES=<count>] [SAMPLES_RESULT=median|average]
[BAD_PROBE_STRATEGY=<FAIL|IGNORE|RETRY|CIRCLE>] [BAD_PROBE_RETRIES=<count>]
Expand All @@ -1570,6 +1570,8 @@ Move the nozzle downwards until the probe triggers. If any of the
optional parameters are provided they override their equivalent
setting in the [probe config section](Config_Reference.md#probe).
- `HOME`: Set the value `z` to home the z axis from the probe result
- `PROBE`: Name of probe to use for this operation. Leave out to use the
default probe.
The following optional parameters control probe quality handling (for probes
that support quality detection): ⚠️
- `BAD_PROBE_STRATEGY`: Strategy to use when a bad probe is detected.
Expand All @@ -1580,19 +1582,22 @@ that support quality detection): ⚠️
- `PATTERN_SPACING`: Spacing (in mm) for the circular retry pattern when
using CIRCLE strategy.

#### LIST_PROBES
`LIST_PROBES`: List the registered probes.

#### QUERY_PROBE
`QUERY_PROBE`: Report the current status of the probe ("triggered" or
`QUERY_PROBE [PROBE=<name>]`: Report the current status of the probe ("triggered" or
"open").

#### PROBE_ACCURACY
`PROBE_ACCURACY [PROBE_SPEED=<mm/s>] [SAMPLES=<count>]
`PROBE_ACCURACY [PROBE=<name>] [PROBE_SPEED=<mm/s>] [SAMPLES=<count>]
[SAMPLE_RETRACT_DIST=<mm>]`: Calculate the maximum, minimum, average,
median, and standard deviation of multiple probe samples. By default,
10 SAMPLES are taken. Otherwise the optional parameters default to
their equivalent setting in the probe config section.

#### PROBE_CALIBRATE
`PROBE_CALIBRATE [SPEED=<speed>] [<probe_parameter>=<value>]`: Run a
`PROBE_CALIBRATE [PROBE=<name>] [SPEED=<speed>] [<probe_parameter>=<value>]`: Run a
helper script useful for calibrating the probe's z_offset. See the
PROBE command for details on the optional probe parameters. See the
MANUAL_PROBE command for details on the SPEED parameter and the
Expand All @@ -1601,7 +1606,7 @@ the PROBE_CALIBRATE command uses the speed variable to move in XY
direction as well as Z.

#### Z_OFFSET_APPLY_PROBE
`Z_OFFSET_APPLY_PROBE`: Take the current Z Gcode offset (aka,
`Z_OFFSET_APPLY_PROBE [PROBE=<name>]`: Take the current Z Gcode offset (aka,
babystepping), and subtract if from the probe's z_offset. This acts
to take a frequently used babystepping value, and "make it permanent".
Requires a `SAVE_CONFIG` to take effect.
Expand Down Expand Up @@ -2319,9 +2324,9 @@ automatically upon homing.
The following commands are available when a
[z_calibration config section](Config_Reference.md#z_calibration) is enabled
(also see the [Z-Calibration guide](Z_Calibration.md)):
- `CALIBRATE_Z`: This calibrates the current offset between the nozzle and
- `CALIBRATE_Z [PROBE=<probe>]`: This calibrates the current offset between the nozzle and
the print surface.
- `PROBE_Z_ACCURACY [PROBE_SPEED=<mm/s>] [LIFT_SPEED=<mm/s>] [SAMPLES=<count>]
- `PROBE_Z_ACCURACY [PROBE=<probe>] [PROBE_SPEED=<mm/s>] [LIFT_SPEED=<mm/s>] [SAMPLES=<count>]
[SAMPLE_RETRACT_DIST=<mm>]`: Calculate the maximum, minimum,
average, median, and standard deviation of multiple probe
samples. By default, 10 SAMPLES are taken. Otherwise the optional
Expand Down
1 change: 1 addition & 0 deletions docs/Kalico_Additions.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
## Probes and Probing

- [`[probe] drop_first_result: True`](./Config_Reference.md#probe) will drop the first result when probing. This can improve probe accuracy for printers that have an outlier for the first sample.
- [`[probe <name>]`](./Config_Reference.md#probe) adds named probes, so a printer can have more than one. Pick one with `PROBE=<name>` on probing commands and list them with [`LIST_PROBES`](./G-Codes.md#list_probes).
- [`[dockable_probe]`](./Config_Reference.md#dockable_probe) brings helpful native support for docked probes, such as the Annex Quickdraw, Klicky/Unklicky, and countless others.
- [`[z_calibration]`](./Config_Reference.md#z_calibration) enables automatic probe Z offset calibration using a reference endstop like the Voron 2.4 nozzle endstop.
- [`[z_tilt_ng]`](./Config_Reference.md#z_tilt_ng) adds enforced 3-point z tilt calibration
Expand Down
18 changes: 6 additions & 12 deletions klippy/extras/axis_twist_compensation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import math

from klippy.extras.probe import ProbeList

from . import bed_mesh, manual_probe

DEFAULT_SAMPLE_COUNT = 3
Expand Down Expand Up @@ -140,9 +142,6 @@ def __init__(self, compensation, config):
None,
None,
)
self.printer.register_event_handler(
"klippy:connect", self._handle_connect
)
self.speed = compensation.speed
self.horizontal_move_z = compensation.horizontal_move_z
self.x_start_point = (
Expand All @@ -169,15 +168,6 @@ def __init__(self, compensation, config):
# register gcode handlers
self._register_gcode_handlers()

def _handle_connect(self):
self.probe = self.printer.lookup_object("probe", None)
if self.probe is None:
raise self.printer.config_error(
"AXIS_TWIST_COMPENSATION requires [probe] to be defined"
)
self.lift_speed = self.probe.get_lift_speed()
self.probe_x_offset, self.probe_y_offset, _ = self.probe.get_offsets()

def _register_gcode_handlers(self):
# register gcode handlers
self.gcode = self.printer.lookup_object("gcode")
Expand All @@ -194,6 +184,10 @@ def _register_gcode_handlers(self):
"""

def cmd_AXIS_TWIST_COMPENSATION_CALIBRATE(self, gcmd):
self.probe = ProbeList.get_list(self.printer).get_command_probe(gcmd)
self.lift_speed = self.probe.get_lift_speed()
self.probe_x_offset, self.probe_y_offset, _ = self.probe.get_offsets()

self.gcmd = gcmd
sample_count = gcmd.get_int("SAMPLE_COUNT", DEFAULT_SAMPLE_COUNT)
axis = gcmd.get("AXIS", "X")
Expand Down
6 changes: 3 additions & 3 deletions klippy/extras/bed_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,9 +622,9 @@ def _generate_points(self, error, probe_method="automatic"):

def print_generated_points(self, print_func, truncate=False):
x_offset = y_offset = 0.0
probe = self.printer.lookup_object("probe", None)
if probe is not None:
x_offset, y_offset = probe.get_offsets()[:2]
pprobe = probe.ProbeList.get_list(self.printer).get_default_probe()
if pprobe is not None:
x_offset, y_offset = pprobe.get_offsets()[:2]
print_func(
"bed_mesh: generated points\nIndex | Tool Adjusted | Probe"
)
Expand Down
2 changes: 1 addition & 1 deletion klippy/extras/bltouch.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,5 +342,5 @@ def load_config(config):
global ENDSTOP_SAMPLE_COUNT
ENDSTOP_SAMPLE_COUNT = get_danger_options().endstop_sample_count
blt = BLTouchEndstopWrapper(config)
config.get_printer().add_object("probe", probe.PrinterProbe(config, blt))
probe.PrinterProbe(config, blt)
return blt
2 changes: 1 addition & 1 deletion klippy/extras/dockable_probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -945,5 +945,5 @@ def probing_move(self, pos, speed, gcmd):

def load_config(config):
msp = DockableProbe(config)
config.get_printer().add_object("probe", probe.PrinterProbe(config, msp))
probe.PrinterProbe(config, msp)
return msp
3 changes: 1 addition & 2 deletions klippy/extras/load_cell/load_cell_probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -1008,8 +1008,7 @@ def __init__(
wrapper = LoadCellEndstopWrapper(
config, homing_move, self._tapping_move
)
printer_probe = PrinterProbe(config, wrapper)
self._printer.add_object("probe", printer_probe)
PrinterProbe(config, wrapper)

def get_status(self, eventtime):
return self._tapping_move.get_status(eventtime)
18 changes: 12 additions & 6 deletions klippy/extras/nozzle_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@

from klippy import Printer
from klippy.configfile import ConfigWrapper
from klippy.extras.probe import GcodeNozzleScrubber, PrinterProbe, RetryPolicy
from klippy.extras.probe import (
GcodeNozzleScrubber,
PrinterProbe,
ProbeList,
RetryPolicy,
)
from klippy.gcode import GCodeCommand, GCodeDispatch
from klippy.toolhead import ToolHead

Expand All @@ -21,9 +26,7 @@ class NozzleCleanupOptions:
pattern_x: int
pattern_y: int

def __init__(self, config: ConfigWrapper):
printer: Printer = config.get_printer()
probe: PrinterProbe = printer.lookup_object("probe")
def __init__(self, probe: PrinterProbe, config: ConfigWrapper):
self._cfg_probe_speed = config.getfloat("speed", probe.speed, above=0.0)
self._cfg_lift_speed = config.getfloat(
"lift_speed", probe.lift_speed, above=0.0
Expand Down Expand Up @@ -105,15 +108,18 @@ def __init__(self, config: ConfigWrapper):
self.cmd_NOZZLE_CLEANUP,
desc=self.cmd_NOZZLE_CLEANUP_help,
)
self.options = NozzleCleanupOptions(config)
self.probe: PrinterProbe = ProbeList.get_list(
self.printer
).get_config_probe(config)
self.options = NozzleCleanupOptions(self.probe, config)
self.retry_policy: RetryPolicy = RetryPolicy(config)
self.nozzle_scrubber: GcodeNozzleScrubber = GcodeNozzleScrubber(config)

def _get_toolhead(self) -> ToolHead:
return self.printer.lookup_object("toolhead")

def _get_probe(self) -> PrinterProbe:
return self.printer.lookup_object("probe")
return self.probe

def horizontal_move(self, pos: tuple[float, float]):
self._get_toolhead().manual_move(
Expand Down
Loading
Loading