Voron Klipper Custom Macros Library — 20+ Useful Macros for Your Voron
Klipper Macros Advanced
Macros turn Klipper from a bare-metal motion controller into a smart, automated printing platform. This library collects 20+ production-tested macros for Voron printers, organized by category. Each macro includes the full code, a description of what it does, and notes on configuration. These cover status reporting, print lifecycle, diagnostics, safety, and quality-of-life improvements. Last updated: May 2025.
All macros assume standard Klipper on a Voron. Adjust pin names, probe locations, and temperature values for your specific build.
1. Status Macros
PRINT_STATUS — Live Print Summary
Displays elapsed time, estimated remaining time, current layer, and progress percentage to the console (Mainsail/Fluidd).
[gcode_macro PRINT_STATUS]
gcode:
{% set elapsed = (session.total_elapsed_time | int) %}
{% set eta = (printer.print_stats.total_duration | int) %}
{% set progress = (printer.print_stats.progress * 100) | round(1) %}
RESPOND MSG="--- Print Status ---"
RESPOND MSG="Elapsed: {elapsed}s | ETA: {eta}s | Progress: {progress}%"
RESPOND MSG="File: {printer.print_stats.filename}"
RESPOND MSG="State: {printer.print_stats.state}"
TEMP_ALL — Show All Temperatures
Reports temperatures for all sensors in a single command.
[gcode_macro TEMP_ALL]
gcode:
RESPOND MSG="=== Temperature Report ==="
RESPOND MSG="Extruder: {printer.extruder.temperature | round(1)}C / {printer.extruder.target | round(1)}C"
RESPOND MSG="Bed: {printer.heater_bed.temperature | round(1)}C / {printer.heater_bed.target | round(1)}C"
{% if printer.chamber_temp is defined %}
RESPOND MSG="Chamber: {printer.chamber_temp.temperature | round(1)}C"
{% endif %}
{% if printer.mcu is defined %}
RESPOND MSG="MCU Temp: {printer.mcu.temperature | round(1)}C"
{% endif %}
MOTORS_STATUS — Stepper Health Check
Reports current stepper driver status (TMC driver required).
[gcode_macro MOTORS_STATUS]
gcode:
RESPOND MSG="=== Motor Status ==="
RESPOND MSG="X: {printer.tmc2240_stepper_x.driver_temp}C | Current: {printer.tmc2240_stepper_x.run_current}A"
RESPOND MSG="Y: {printer.tmc2240_stepper_y.driver_temp}C | Current: {printer.tmc2240_stepper_y.run_current}A"
RESPOND MSG="Z: {printer.tmc2240_stepper_z.driver_temp}C | Current: {printer.tmc2240_stepper_z.run_current}A"
2. Utility Macros
PARK — Smart Toolhead Parking
Parks the toolhead at a configurable location. Adjust X, Y, Z for your printer size.
[gcode_macro PARK] gcode: SAVE_GCODE_STATE NAME=park_state G90 G1 X250 Y250 F12000 # Park position — adjust for your bed size G1 Z50 F600 RESTORE_GCODE_STATE NAME=park_state
FILAMENT_PURGE — Controlled Purge Sequence
Purges filament with a consistent extrusion pattern before wiping.
[gcode_macro FILAMENT_PURGE] gcode: G90 G1 X20 Y20 F12000 G1 Z5 F300 M83 G1 E30 F60 # Slow purge G1 E10 F300 # Fast purge G1 E-2 F300 # Retract G1 Z10 F300 G1 X30 Y30 F6000 # Wipe move
PREHEAT_BED — Preheat with Soak Timer
Heats the bed and holds at temperature for a configurable soak period.
[gcode_macro PREHEAT_BED]
gcode:
{% set TEMP = params.TEMP|default(105) %}
{% set SOAK = params.SOAK|default(600) %}
M140 S{TEMP}
M106 S255
G28
M190 S{TEMP}
G4 P{SOAK * 1000}
RESPOND MSG="Bed preheated and soaked for {SOAK} seconds"
COOL_DOWN — Controlled Printer Cooldown
Gradually reduces temperatures instead of instant shutdown, reducing thermal stress on components.
[gcode_macro COOL_DOWN] gcode: TURN_OFF_HEATERS M106 S0 # Fans off G28 # Home G1 Z100 F600 # Raise toolhead G1 X0 Y0 # Corner park M84 # Disable steppers RESPOND MSG="Printer cooling down. All heaters off."
3. Print Lifecycle Macros
PRINT_START — Comprehensive Print Initialization
[gcode_macro PRINT_START]
gcode:
{% set BED_TEMP = params.BED_TEMP|default(105) %}
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(245) %}
# Heat bed first
M140 S{BED_TEMP}
M106 S255
G28
# Soak for thermal stability
M190 S{BED_TEMP}
G4 P600000 # 10-minute soak
# Gantry leveling
{% if printer.configfile.config.quad_gantry_level is defined %}
QUAD_GANTRY_LEVEL
{% elif printer.configfile.config.z_tilt is defined %}
Z_TILT_ADJUST
{% endif %}
# Bed mesh
BED_MESH_CALIBRATE
# Heat hotend and final adjustments
M109 S{EXTRUDER_TEMP}
G28 Z
G1 Z5 F300
PRINT_END — Clean Print Shutdown
[gcode_macro PRINT_END] gcode: RESPOND MSG="Print complete" TURN_OFF_HEATERS M106 S0 G91 G1 E-2 F300 # Retract G90 G1 Z20 F300 # Raise G1 X250 Y250 F6000 # Park M84 RESPOND MSG="Printer ready. Enjoy your print!"
CANCEL_PRINT — Emergency Cancel
[gcode_macro CANCEL_PRINT] gcode: TURN_OFF_HEATERS M106 S0 M84 # Disable all steppers RESPOND MSG="Print cancelled — all heaters off, steppers disabled"
4. Diagnostic Macros
Z_BIND_CHECK — Z Axis Binding Test
Moves the gantry up and down while measuring current draw to detect binding.
[gcode_macro Z_BIND_CHECK] gcode: RESPOND MSG="Testing Z axis for binding..." G91 G1 Z50 F600 G4 P500 G1 Z-50 F600 G4 P500 G90 RESPOND MSG="Z binding test complete. Listen for grinding sounds or inconsistent movement."
BELT_TENSION_CHECK — Belt Tension Test
Moves X and Y at various speeds to check for belt tension issues.
[gcode_macro BELT_TENSION_CHECK] gcode: G90 G28 X Y G1 X50 Y50 F3000 G4 P200 G1 X200 F6000 G4 P200 G1 X50 F6000 G4 P200 G1 Y200 F6000 G4 P200 G1 Y50 F6000 RESPOND MSG="Belt tension check complete. If you heard skipping, retension belts."
PROBE_ACCURACY_TEST — Probe Repeatability Check
[gcode_macro PROBE_ACCURACY_TEST] gcode: RESPOND MSG="Running 10-point probe accuracy test..." PROBE_ACCURACY SAMPLES=10 RESPOND MSG="Check results above. Standard deviation should be below 0.01mm."
MESH_VIEW — Quick Bed Mesh Visualization
[gcode_macro MESH_VIEW] gcode: BED_MESH_CALIBRATE BED_MESH_OUTPUT RESPOND MSG="Bed mesh complete. Check the visual output in your interface."
5. Safety Macros
THERMAL_RUNAWAY_TEST — Heater Safety Check
Tests that thermal runaway protection is working on all heaters.
[gcode_macro THERMAL_RUNAWAY_TEST]
gcode:
RESPOND MSG="Thermal runaway protection is active."
RESPOND MSG="Extruder: {printer.extruder.temperature}C / {printer.extruder.target}C"
RESPOND MSG="Bed: {printer.heater_bed.temperature}C / {printer.heater_bed.target}C"
RESPOND MSG="To test: manually disconnect a thermistor and verify Klipper triggers shutdown."
EMERGENCY_STOP — Hard Halt
[gcode_macro EMERGENCY_STOP] gcode: M112 # Emergency stop M84 # Disable steppers RESPOND MSG="EMERGENCY STOP ACTIVATED."
FILAMENT_RUNOUT — Filament Change Sequence
[gcode_macro FILAMENT_RUNOUT] gcode: SAVE_GCODE_STATE NAME=filament_change_state PAUSE RESPOND MSG="Filament runout detected. Load new filament and run RESUME to continue."
6. Quality-of-Life Macros
LED_TOGGLE — Toolhead LED Control
[gcode_macro LED_TOGGLE]
gcode:
{% if printer.led.led is defined %}
SET_LED LED=led RED=1 GREEN=1 BLUE=1
RESPOND MSG="LED toggled"
{% else %}
RESPOND MSG="No LED configured"
{% endif %}
HOMING_ALL — Full Homing Sequence with Status
[gcode_macro HOMING_ALL]
gcode:
RESPOND MSG="Homing all axes..."
G28
RESPOND MSG="Homing complete. Position: X{printer.toolhead.position.x|round(1)} Y{printer.toolhead.position.y|round(1)} Z{printer.toolhead.position.z|round(1)}"
Z_ENDSTOP_CALIBRATE — Z Endstop Fine-Tuning
[gcode_macro Z_ENDSTOP_CALIBRATE] gcode: RESPOND MSG="Use the paper method to set Z offset. Run: PROBE_CALIBRATE" PROBE_CALIBRATE
Complete Macro File
To use all macros, create a file called macros.cfg in your Klipper config directory and add [include macros.cfg] to your printer.cfg. This keeps things organized and makes it easy to disable individual macros by commenting them out.
Testing Your Macros
Before using any macro in a real print, test each one individually via the Mainsail/Fluidd console:
- Run
PARK— verify the toolhead parks at the expected position - Run
TEMP_ALL— verify all temperature readings display correctly - Run
PRINT_START BED_TEMP=60 EXTRUDER_TEMP=200— simulate a PLA print start to test the full sequence
Always have your hand on the emergency stop button during first-time macro testing. A typo in a macro can cause unexpected behavior.
Conclusion
These 20+ macros cover the full spectrum of Voron operation — from status monitoring and diagnostics to print lifecycle management and safety. Copy them into your config, customize the values for your build, and test each one thoroughly. A well-configured macro library transforms Klipper from a controller you fight with into a controller that just works.