Duet 2 / RepRap Firmware 2.x gcode Macros

Reprap Firmware 2.x usage overview

RepRap Firmware version 2.x macros are simple motion routines as RRF2.x does not have the gcode meta capability to perform checks if the probe is deployed or not.

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 during operations.

The deploy and retract macros given in the examples are give for a fixed doc located at X0 Y0.

The homez.g macro and the 4-point bed leveling macros are provided as examples illustrating the general method of deploying and retracting the probe.

RRF employs a ‘probe deployed token’ and thus, if a gcode issued that relies on probe deployment, the system will deploy and retract it automatically.

If a series of probing commands is desired, then it is recommended that and M401 and M402 pair bracket the sequence of gcodes. See the example homez.g and bed4point.g macros for recommendations.

RRF2_Example_Manual_Deploy_Probe.g

; ***********************************************************
; Euclid Probe Manual Deploy Probe Macro M401
; RRF2.X Firmware Example
; saveas system/deployprobe.g
; comments and echo statements throughout are provided for convenience
; ***********************************************************

M564 H1 S0                   ; Allow movement BEYOND axes boundaries (for Y to reach probe dock)

G91                          ; relative positioning
echo "Lift Z in advance of deploy" 
G1 H2 Z15 F3000              ; move Z 15 for clearance above dock.
G90                          ; absolute positioning

M291 P"Attach Probe"  S3     ; Deploy Probe Display Message Box  "OK" and "Cancel" are displayed 

G1 X100 Y10 F3000           ; move adjacent to probe dock location
M400                         ; wait for moves to finish

M291 
M564 S1                      ; Restrict movement to within axes boundaries (for normal Y movement)

echo "Macro deployprobe.g complete"

RRF2_Example_Manual_Retract_Probe.g

; ***********************************************************
; Euclid Probe Manual Retract Probe Macro M402
; RRF2.X Firmware Example
; saveas system/retractprobe.g
; comments and echo statements throughout are provided for convenience
; ***********************************************************

M564 H1 S0                   ; Allow movement BEYOND axes boundaries (for Y to reach probe dock)

G91                          ; relative positioning
echo "Lift Z in advance of retract"
 
G1 H2 Z15 F3000              ; move Z 15 for clearance above dock.
G90                          ; absolute positioning

G1 XX100 Y10 F3000           ; move adjacent to probe dock location
M400                         ; wait for moves to finish

M291 P"Detach Probe"  S3     ; Deploy Probe Display Message Box  "OK" and "Cancel" are displayed 

M564 S1                      ; Restrict movement to within axes boundaries (for normal Y movement)

echo "Macro retractprobe.g complete"

RRF2_deployprobe.g

; ***********************************************************
; Euclid Probe Fixed Dock M401 Deploy Probe Macro
; RRF2.X Firmware Example
; saveas system/deployprobe.g
; comments and echo statements throughout are provided for convenience
; ***********************************************************
;  __________________________________________________________________________
;  |                                                                        |
;  |                                                                        |
;  |                                                                        |
;  |                                                                        |
;  |                                                                        |
;  |                                                                        |
;  |                                                                        |
;  |                                                                        |
;  |                                                                        |
;  |                                                                        |
;  |                                * 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...
; coordinates are re-written below above the macros

M564 H1 S0                   ; Allow movement BEYOND axes boundaries (for Y to reach probe dock)

G91                          ; relative positioning
echo "Lift Z in advance of deploy" 
G0 H2 Z15 F3000              ; move Z 15 for clearance above dock.
G90                          ; absolute positioning

; Preflight position is X100 Y0
; Dock Side position is at X30 Y0
; Docked probe postion is at X0 Y0 
; Dock exit point is at X65 Y0 
; Dock Re-Entry Staging Position is at X0 Y70
; Probe Ready Position X150 Y150 

G0 X100 Y0 G3000             ; move ot preflight position
M400                         ; wait for moves to finish

G0 X30 Y0 F3000              ; move adjacent to probe dock location
M400                         ; wait for moves to finish

G0 X0 Y0 F3000               ;  move over dock 
G4 P250                      ; pause for pickup

G0 X0 Y40 F300              ;  slide probe out of dock - slowly
G0 X0 Y70 F3000
M400                         ; wait for moves to finish

G0 X150 Y150 F6000           ; move to center of bed 
M400                         ; wait for moves to finish

M564 S1                      ; Restrict movement to within axes boundaries (for normal Y movement)

echo "Macro deployprobe.g complete"

RRF2_Example_Auto_Retract_Probe_Fixed_Dock.g

; ***********************************************************
; Euclid Probe Fixed Dock M402 retractprobe macro
; RRF 2x on Duet 2 hardware
; saveas system/retractprobe.g
; comments and echo statements throughout are provided for convenience
; ***********************************************************
;  __________________________________________________________________________
;  |                                                                        |
;  |                                                                        |
;  |                                                                        |
;  |                                                                        |
;  |                                                                        |
;  |                                                                        |
;  |                                                                        |
;  |                                                                        |
;  |                                                                        |
;  |                                                                        |
;  |                                * 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...
; coordinates are re-written below above the macros

; echo "running retractprobe.g macro"

; Preflight position is X100 Y0
; Dock Side position is at X30 Y0
; Docked probe postion is at X0 Y0 
; Dock exit point is at X65 Y0 
; Dock Re-Entry Staging Position is at X0 Y70
; Probe Ready Position X150 Y150 

G90	                           ; absolute positioning

M564 S0                        ; allow movement outside the boundaries

G0 X0 Y70 F3000                ; move to the re-entry staging position
M400                           ; wait for moves to finish

G0 X0 Y40 F3000                ; move to the dock re-entry position
M400                           ; wait for moves to finish

G0 X0 Y0 F300                  ; move into the dock position
M400                           ; wait for moves to finish
G4 P250                        ; pause 250 usecs 

G0 X30 Y0 F6000                ; move to the side swipe off probe
G0 X100 Y0  F3000             ; move away from the dock
M400                          ; wait for moves to finish

G0 X150.0 Y150.0 F3000           ; move to the center of the bed
M400

M564 S1                        ; set movement limit to axis boundaries

echo "Macro retractprobe.g complete"

RRF2_bed4point.g

; ***********************************************************
; Euclid Probe Fixed Dock M401 Deploy Probe Macro
; RRF2.X Firmware Example
; saveas system/deployprobe.g
; comments and echo statements throughout are provided for convenience
; ***********************************************************
; probe is -16.4 in X -29.4 in Y bed is 290 in X 325 in Y
; locations of probe points are at 
; (18, 285)     (270,285)
;
; (18,65)       (270,65)
;
; adjust coords so that probe hits symmetric points on bed and avoids dock

; echo "Running bed4point.g"
M558 F60 A3                              ; fix probe speed to 1mm/s
G90
G4 P250

; echo "Call deployprobe.g macro" 
M401                                            ; This runs macro file deployprobe
; echo "Return"

G30 P0 X18.0 Y65.0 F9000.0 Z-99999       ; probe front left PEI

G30 P1 X18.0 Y285.0 F9000.0 Z-99999      ; probe back left PEI

G30 P2 X270.0 Y285.0 F9000.0 Z-99999     ; probe back right PEI

G30 P3 X270.0 Y65.0 F9000.0 Z-99999 S3   ; probe near front right leadscrew and calibrate 3 motors PEI

; echo "Call retractprobe.g macro"
M402                                     ; retract probe
; echo "Return"

; echo "bed4point.g complete" 

RRF2_homez.g

; ***********************************************************
; Euclid Probe Fixed Dock homez.g example
; RRF 2x on Duet 2 hardware
; saveas system/homez.g
; comments and echo statements throughout are provided for convenience
; ***********************************************************
;

M561                                            ; clear any bed transforms
M290 S0 R0                                      ; clear baby steps

; G91                                             ; relative positioning
G1 H2 Z10 F6000                                ; lift Z relative to current position
M400

G90                                             ; absolute positioning

; echo "Call deployprobe.g macro" 
M401                                            ; This runs macro file deployprobe
; echo "Return"

G1 X145 Y162.5 F9000                            ; go to first probe point
M400

; echo "G30 S-2 Command"
G30 -2
G1 Z10
M400
G4 P500

; echo "Call bed4point.g macro"
M98 P"0:/sys/bed4point.g"                       ; tram bed
; echo "Return"

G1 X145 Y165 F9000                              ; go back to the first probe point and reprobe 0 in case it moved
G30

; echo "Call retractprobe.g macro"
M402 P0                                         ; retract probe
; echo "Return"

G1 Z10 F600                                     ; lift Z relative to current position
G90                                             ; absolute positioning
M564 S1 

; G1 X150 Y0 F9000                              ; move carraige to center front
Tags: