06 Deploy & Retract Strategies

The overall concept to deploying and retracting Euclid Probe is to approach the probe dock from the side, move over the probe so that the magnets pick up the probe out of the well in the dock, pause for the firmware to recognize that the probe state has changed, then exit the dock. When the magnets have picked up the probe, the probe is aligned with the exit gate so the probe can travel out of the dock.

To retract or dock the probe, the process is reversed: approach and then enter the dock, park the carriage over the dock well, move quickly to the side, swiping the magnets apart. When the magnets are detached, the probe will drop into the well, below the level of the exit gate and be secure.

Care must be taken to consider the order of operations in the overall homing and bed leveling scheme. It is recommended that a different macro be written to deeply and retract the probe, and to call them when homing, probing or bed leveling.

RepRap Firmware version 2.x does not have the logic capability to perform checks as to whether or not the probe is deployed. While Euclid Probe has proven itself to be reliable for probe deployments and retractions, users are advised to observe and not leave their printer unattended.
The deploy and retract macros are give for a fixed doc located at X5 Y290.
The homez.g macro and the 4-point bed leveling macro are provided as examples illustrating the eschema.

RepRap Firmware version 3.x can utilize gcode meta commands, which are highly recommended to perform logic checks as to whether or not the probe is deployed.
The deploy and retract macros are give for a fixed dock located at X5 Y290. The homez.g macro and the 4-point bed leveling macro are provided as examples illustrating the eschema.

Examples are given for both fixed docks (X, Y, Z constant) and docks that bed attached and can move in the Z axis (X & Y constant, varying Z).

Klipper macros can be very simple and straight forward. There is no need for complicated macros, docking sensors or other extraneous bits or bobs.

Insert the following into the head of the main printer.cfg file to include the dock and position locations.

...
[include euclid.cfg]
...

The following are the definitions of the carriage position points and the Probe Deploy & Probe Retract Macros. We have provided them as euclig.cfg file for download.

/00-euclid_exampleV2.cfg

#  __________________________________________________________________________
#  |                                                                        |
#  |                                                                        |
#  |                                                                        |
#  |                                                                        |
#  |                                                                        |
#  |                                                                        |
#  |                                                                        |
#  |                                                                        |
#  |                                                                        |
#  |                                                                        |
#  |                                * Probe Ready Position                  |
#  |                                  X150 Y150                             |
#  |                                                                        |
#  |                                                                        |
#  | * Dock Re-entry staging  position                                      |
#  |   X0 Y70                                                               |
#  |                                                                        |
#  |                                                                        |
#  | * Dock Exit Position                                                   | 
#  |   X0 Y40                                                               |
#  |                                                                        |
#  |                                                                        |
#  |                                                                        |
#  |                                                                        |
#  |                                                                        |
#  |   X0 Y0    X30 Y0       X100 Y0                                        |
#  | * Dock   * Dock Side  * Dock Preflight                                 |
#  |________________________________________________________________________| 
#
# Above is example 300x300 bed to coorelate with macros and movements below.
# This example is for a fixed dock, fixed gantry/carraige and moving bed motion system. 
# RailCore, Ender5, V-Core3, etc...
# For moving gantry sytem like Voron 2.4, there are some subltle things to change.
# We have attempetd indicate those in the comments throughout the example code.   
# Z elevation is shown in movements to ensure adequate Z elevation to avoid crashes. 
# With the coupling magnets +/- 2mm of the nozzlem the probe trigger height is on the
# ordeer of 12mm, so 15mm is used as a safe height.
#
# the printer.cfg-snip.txt has the following config settings 
# # 
# #...
# # ad this include statement at the head of the config file
# [include euclid.cfg]
# #
#
# #
# # enable enable_force_move to enable FORCE_MOVE and SET_KINEMATIC_POSIITION
# enable_force_move:true
# # ...
#
# It is assumed that there is a seperate Z-endstop that is used to home Z
# IF YOU ARE USING PROBE AS ENDSTOP AND PROBE homing_overide must be altered
#
# some configurtions may need FORCE_MOVE enabled for kinematic position functionS
# https://www.klipper3d.org/Config_Reference.html?h=force_move#force_move
#
# Movement Locations:
#    Users need to identify these locations and customize for their deployment: 
#       Pre-flight position X100 Y20 located to ensure clear travel path to dock
#       Dock Adjacent position X30 Y0 to provide short lateral travel for pickup and swipe off
#       Probe pickup over dock X0 Y0
#       Dock exit Position X0 Y40
#       Probe Ready Position X150 Y0 center of bed
#
# the above list of coordiantes get used in the movement macros below
#


[probe]
##    Euclid Probe
pin: ^PA0                    ; use pin PA0 and enable internal pullup resistor as this is an NC switch  use ! to invert if needed
x_offset: 2.0                ; probe is offset 2.0mm from nozzle
y_offset: 25.0               ; probe is +25mm from nozzle in Y direction
z_offset: 11.35              ; trigger point is 9.5mm below nozzle. larger numbers move effective Z0 CLOSER to the nozzle
speed: 5                     ; probing speed of 5mm/second ideal is <10mm/sec  
samples: 2                   ; number of probes to perform per sample
samples_result: average      ; normalization method: see config reference
sample_retract_dist: 3.0
samples_tolerance: 0.0075
samples_tolerance_retries: 3

#
# example homing overide to use Euclid as an endstop and Z-probe
# example assumes that the bed is 300x300
# assumes homing Z at center of bed
# assumes that macro for probe deploy and retract below are called M401 and M402
#
#
[homing_override]
gcode: SET_KINEMATIC_POSITION Z=0
 G0 Z15 F500           ; raise bed to 15
 G28 X Y               ; home Y & Y
 M401                  ; deploy Euclid Probe
 G0 X150 Y150 F6000    ; move to X150 Y150
 G28 Z                 ; home Z
 G0 Z15 F500           ; raise bed to 15
 M402                  ; retract Euclid Probe
axes: z
set_position_z: -5

# Macro to Deploy Bed Probe
[gcode_macro M401]
gcode:
    G90
    {action_respond_info("Entering M401")}
    error_if_probe_deployed    ; check to make sure that the probe is not already attached
    _M401

[gcode_macro error_if_probe_deployed]
gcode:
    QUERY_PROBE                 ; check probe status
    do_error_if_probe_deployed  ; logic check to verify probe is not already deployed

[gcode_macro do_error_if_probe_deployed]
gcode:
    {% if not printer.probe.last_query %}
      {action_raise_error("Euclid Probe is already deployed - Remove and Return it to the dock")}
    {% endif %}

# Macro to Deploy Bed Probe
[gcode_macro _M401]
gcode:
    G90
    {% if printer.probe.last_query %} 
      G0 Z15 F3000         ;  set approach elevation of Z15 to clear probe over bed on fixed gantry machine
      #                       for moving gantry machine this may need to be adjusted
      G0 X100 Y0          ;  move the carraige to safe position to move from
      G0 X30 Y0            ;  move to the side of the dock
      G4 P250              ;  wait 1/4 second 
      G0 X0 Y0             ;  move sideways over the dock to pick up probe
      M400                 ;  wait for moves to finish
      G4 P250              ;  pause 1/4 sec for detection
      G0 X0 Y40            ;  move out of the dock in a straight line 
      G0 Z15               ;  move up to clear the probe over the bed of moving gantry or provide clearance for fixed gantry
      G0 X150 Y150         ;  move probe to center of bed in ready position 
    {% endif %}
    error_if_probe_not_deployed
    {action_respond_info("Exiting M401")}

[gcode_macro error_if_probe_not_deployed]
gcode:
    QUERY_PROBE
    do_error_if_probe_not_deployed

[gcode_macro do_error_if_probe_not_deployed]
gcode:
    {% if printer.probe.last_query %}
      {action_raise_error("Euclid Probe failed to deploy!")}
    {% endif %}

# Macro to retract Bed Probe
[gcode_macro M402]
gcode:
    G90
    {action_respond_info("Entering M402")}
    error_if_probe_not_deployed
    _M402

# Macro to Stow Bed Leveling Probe
[gcode_macro _M402]
gcode:
    G90
    {% if not printer.probe.last_query %} ; the logic on this needs function check
     G0 Z15 F2400                  ;  set approach elevation of Z15 for fixed gantry system to clear probe over bed
     #                           ;  for moving gantry system this may have to be altered
     G0 X150 Y150 F3000          ;  start movements at center of the bed 
     G0 X0 Y70 F3000             ;  move to the re-entry staging position
     G0 X0 Y40 F3000             ;  move to a position in front of the dock so simple linear movement into dock 
     G0 X0 Y0 F240               ;  slowly move into dock 
     M400                        ;  wait for moves to finish
     G4 P250                     ;  forced pause here so motion is definite 90 tavel to swipe
     G0 X30 Y0 F6000             ;  quick swipe off 
     G0 X150 Y0                  ;  move to front center of bed                   
     G0 Z20 F500               ;  move up to elevation of Z20
     error_if_probe_not_deployed
    {action_respond_info("Exiting M402")}

# Macro to perform a bed mesh calibration by wrapping it between M401/M402 macros
[gcode_macro BED_MESH_CALIBRATE]
rename_existing:    BED_MESH_CALIBRATE_ORIGINAL
gcode:
  M401                           ; deploy Euclid Probe if needed
  BED_MESH_CALIBRATE_ORIGINAL    ; check bed level
  M402                           ; dock Euclid Probe

# Macro to perform a modified z_tilt  by wrapping it between M401/M402 macros
[gcode_macro QUAD_GANTRY_LEVEL]
rename_existing:    _QUAD_GANTRY_LEVEL_ORIGINAL
gcode:
  M401                           ; deploy Euclid Probe if needed
  _QUAD_GANTRY_LEVEL_ORIGINAL         ; check bed level
  M402                           ; dock Euclid Probe

Then to utilize or implement Euclid Probe, you invoke the M401 and M402 routines-

[homing_override]
gcode: SET_KINEMATIC_POSITION Z=0
 G0 Z10 F500           ; raise bed to 10
 G28 X Y               ; home Y & Y
 M401                  ; deploy Euclid Probe
 G0 X200 Y235 F12000   ; move to X200 Y235
 G28 Z                 ; home Z
 G0 Z10 F500           ; raise bed to 10
 M402                  ; retract Euclid Probe
axes: z
set_position_z: -5

The following strategy is based on the Allen Key Probe function predefined in Marlin.

/
// For Z_PROBE_ALLEN_KEY see the Delta example configurations.
//
// 
/**
 * Allen key retractable z-probe as seen on many Kossel delta printers - https://reprap.org/wiki/Kossel#Automatic_bed_leveling_probe
 * Deploys by touching z-axis belt. Retracts by pushing the probe down. Uses Z_MIN_PIN.
 */
#define Z_PROBE_ALLEN_KEY

#if ENABLED(Z_PROBE_ALLEN_KEY)
  // 2 or 3 sets of coordinates for deploying and retracting the spring loaded touch probe on G29,
  // if servo actuated touch probe is not defined. Uncomment as appropriate for your printer/probe.

  #define Z_PROBE_ALLEN_KEY_DEPLOY_1 { 165, 50, 10 }  // Dock side approach position
  #define Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE XY_PROBE_FEEDRATE

  #define Z_PROBE_ALLEN_KEY_DEPLOY_2 { 165, 14, 0 }  // Mount over dock position for probe coupling
  #define Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE (XY_PROBE_FEEDRATE)/10

  #define Z_PROBE_ALLEN_KEY_DEPLOY_3 { 130, 14, 0 } // Translate probe out of dock 
  #define Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE XY_PROBE_FEEDRATE

  #define Z_PROBE_ALLEN_KEY_DEPLOY_4 { 130, 14, 15 } // Vertically lift probe up to clear bed & dock 
  #define Z_PROBE_ALLEN_KEY_DEPLOY_4_FEEDRATE XY_PROBE_FEEDRATE

  #define Z_PROBE_ALLEN_KEY_STOW_1 { 130, 14.0, 10.0 } // Move the probe into X,Y dock approach position
  #define Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE XY_PROBE_FEEDRATE

  #define Z_PROBE_ALLEN_KEY_STOW_2 { 130, 14.0, 0.0 } // Move probe down to dock entry position
  #define Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE (XY_PROBE_FEEDRATE)/10

  #define Z_PROBE_ALLEN_KEY_STOW_3 { 165.0, 14.0, 0.0 } // Move probe into dock
  #define Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE XY_PROBE_FEEDRATE

  #define Z_PROBE_ALLEN_KEY_STOW_4 { 165.0, 50.0, 0.0 } // Swipe probe off of mount 
  #define Z_PROBE_ALLEN_KEY_STOW_4_FEEDRATE XY_PROBE_FEEDRATE

#endif // Z_PROBE_ALLEN_KEY

⇦ Previous Step Firmware Configuration