Custom macros

****TEST YOUR REORIENTATION MACROS/PROCEDURE WITHOUT A PRINT ON THE BED BEFORE TRYING A RESUME FAILED PRINT AND HAVE THE POWER BUTTON WITHIN REACH******

Qidi plus4 – Resume_Home_ALL_QIDI

full klipper reorientation of toolhead by tapping one or two buttons and done!

Here we see the difference between an open source user friendly firmware machine package where we can move that toolhead anywhere and make it believe it is whereever we want it to believe it is for any reason. So be careful. It only asks to be told something before moving the z axis out of safety.

For Klipper the bread and butter command for informing your machine is SET_KINEMATIC_POSITION x= y= z=

Enter the coordinates that you want the printer to believe as its reality even if it is just a close guess so you can unlock the toolhead and use endstops to find true x and y and raise the bed to the tip of the nozzle which is z=0. That is the heart of reorientation for any machine.

To make a way to safely do those things with a print still on the bed and or have a designated parking spot where you know the coordinates AHEAD OF TIME, such as I use in the example below the parking spot for when Stop Print command is given. Same as Print complete, So if it thinks the print is complete and it is not, or i walk in on it ghosting far above the print and snagged off course 4 inches, the process is the same as when I hit stop print I know where the print head will park and a way to make sure incase of a snagged off path toolhead by rehoming all axis in that corner away from the print. All done by tapping two buttons on your fluidd or octoapp UI under Macros. These are custom macros entered into my printer.cfg or macro.cfg

This macro is designed to safely home x and y and to raise the bed from the stop position of 10 10 200 to 10 10 0 and allow the probe to rehome z in the front left hand corner so as not to collide with any print left on the bed.

This can be done manually through the console by entering SET-KINEMATIC-POSITION x=10 y=10 z=200 which i make a macro named SET_KINEMATIC_STOP just so I don’t have to type that out every time, and if I am sure that the tool-head did not get yanked or snagged off of the path then this one button can be and often is my entire reorientation. One button Reorientation done. If I wanted to be super precise or if I think it is possible the tool-head was snagged and skipped some belt teeth then press two buttons and done first by tapping SET_KINEMATIC_STOP macro followed by the RESUME_HOME_ALL_QIDI macro. Tool-head will bump the end-stops in the corner then lift the bed to the probe and bounce a few times and once z=0 is established the bed lowers back down to z=200.

From this point we now have absolute alignment with the printed part, the machines internal spatial geometry and the G-code.

So all that to say I press two custom buttons, now i simply upload the original G-code into Lazarus, enter the layer height from the slicer and take a measurement of the print height to the nearest tenth of a millimeter as you can and hit preview and generate resume G-code.

Upload after you checked it, make sure temps are set , slow down speed on your slider in Fluidd/Octoapp/mainsail whatever and be prepared to be amazed or really pissed off which is why your hand is within reach of power off and your speed is slow. Have a little 0.05 Z toggle ready if you are super pick.

Lazarus is just math, and logic, perfect in and of themselves but the results are dependent on the inputs, the machine and its calibration. As long as you enter you print height within a tolerance that is equal to your layer height then the printer will continue at the exact layer sequence and height as it left off. Use your flow slider and z toggle to make up the difference in the partial layer for perfection if you wish.

——–qidiplus4 custom macro to SET_KINEMATIC_POSITION x=10 y=10 z=200 ——————————————————————————————————————————————-

[gcode_macro SET_KINEMATIC_POSITION_STOP]
description: Assume toolhead is at stop parked position
gcode:
RESPOND PREFIX=”LAZARUS” MSG=”Assuming toolhead parked at x10 y10 z200″
SET_KINEMATIC_POSITION X=10 Y=10 Z=200

——————————————————————————————————————————————————

[gcode_macro RESUME_HOME_ALL_QIDI]
description: Lazarus prep for Qidi CoreXY: Home XY, go to pad, enable probe, set safe Z, run Qidi get_zoffset, then drop to safe Z.
variable_pad_x: 10
variable_pad_y: 10
variable_safe_z: 200
variable_assume_z: 202
variable_xy_feed: 7800
variable_z_feed: 900
gcode:
RESPOND PREFIX=”LAZARUS” MSG=”RESUME_HOME_ALL_QIDI: Enabling probe + establishing safe temporary Z…”
QIDI_PROBE_PIN_2
SET_KINEMATIC_POSITION Z={printer[‘gcode_macro RESUME_HOME_ALL_QIDI’].assume_z}

# Safety lift away from the bed (relative) now that Z is “known”
G91
G1 Z5 F600
G90

RESPOND PREFIX=”LAZARUS” MSG=”Homing XY…”
G28 X Y

RESPOND PREFIX=”LAZARUS” MSG=”Moving to pad X{printer[‘gcode_macro RESUME_HOME_ALL_QIDI’].pad_x} Y{printer[‘gcode_macro RESUME_HOME_ALL_QIDI’].pad_y}…”
G90
G1 X{printer[‘gcode_macro RESUME_HOME_ALL_QIDI’].pad_x} Y{printer[‘gcode_macro RESUME_HOME_ALL_QIDI’].pad_y} F{printer[‘gcode_macro RESUME_HOME_ALL_QIDI’].xy_feed}

# Ensure probe is enabled before running the Qidi Z routine
QIDI_PROBE_PIN_2

RESPOND PREFIX=”LAZARUS” MSG=”Running Qidi get_zoffset (probe + kinematic Z set)…”
get_zoffset

RESPOND PREFIX=”LAZARUS” MSG=”Dropping to safe Z={printer[‘gcode_macro RESUME_HOME_ALL_QIDI’].safe_z}…”
G90
G1 Z{printer[‘gcode_macro RESUME_HOME_ALL_QIDI’].safe_z} F{printer[‘gcode_macro RESUME_HOME_ALL_QIDI’].z_feed}

QIDI_PROBE_PIN_2
RESPOND PREFIX=”LAZARUS” MSG=”Done. XY re-homed, Z re-established, parked at pad + safe Z.”