Homing Override - Homing Override Configuration
Overview
This page provides two Klipper Homing Override reference configurations to optimize the 3D printer homing process, improving safety and accuracy.
Configuration List
| Configuration | Feature Description | Applicable Scenario |
|---|---|---|
| Configuration 1 | Basic homing override + bed centering | Standard homing process optimization |
| Configuration 2 | Nozzle temperature check + safe homing | Safe homing in high-temperature environments |
Configuration 1: Basic Homing Override
Feature Description
- Automatically detects if Z-axis is homed; sets a virtual Z position if not
- Automatically moves to the center of the bed before homing the Z-axis
- Supports independent X, Y, Z homing commands
- Reads printer maximum travel using printer.configfile.config
Complete Configuration
[force_move]
enable_force_move: true
[homing_override]
axes: z
gcode:
{% set max_x = printer.configfile.config["stepper_x"]["position_max"]|float %}
{% set max_y = printer.configfile.config["stepper_y"]["position_max"]|float %}
; If Z axis is not homed, set virtual position and raise
{% if 'z' not in printer.toolhead.homed_axes %}
SET_KINEMATIC_POSITION Z=0
G90
G0 Z5 F600
{% endif %}
{% set home_all = 'X' not in params and 'Y' not in params and 'Z' not in params %}
{% if home_all or 'X' in params %}
G28 X
{% endif %}
{% if home_all or 'Y' in params %}
G28 Y
{% endif %}
{% if home_all or 'Z' in params %}
; Move to bed center [Important] Prevent collision when homing Z
G0 X{max_x / 2} Y{max_y / 2} F3600
G28 Z
G1 Z10 F2000
{% endif %}
Key Code Explanation
G0 X{max_x / 2} Y{max_y / 2} F3600
This line of code moves the nozzle to the center of the bed before homing the Z-axis.
X{max_x / 2}: X-axis moves to half of the maximum travel (bed center X coordinate)Y{max_y / 2}: Y-axis moves to half of the maximum travel (bed center Y coordinate)- F3600: Movement speed of 3600mm/min (60mm/s), rapid movement
Why is moving to the bed center necessary?
- Avoid Collisions: Prevents the nozzle from hitting leveling knobs or other obstacles at the edge of the bed during homing
- Improve Accuracy: The bed center is usually the flattest area, resulting in more accurate homing
- Compatibility: Supports various probes like ALPS, BL-Touch, EDDY
How to modify the movement speed?
- Locate the line
G0 X{max_x / 2} Y{max_y / 2} F3600 - Change
F3600to your desired speed value - Recommended range: F1800-F3600 (30-60mm/s)
Usage Example
G28 ; Home all → Check Z → Home XY → Move center → Home Z → Raise
Configuration 2: Homing Override with Temperature Protection
Feature Description
- Includes all features of Configuration 1
- Adds nozzle temperature check
- Automatically cools down to a safe temperature when too high
- Restores original temperature settings after homing is complete
Complete Configuration
[force_move]
enable_force_move: true
[homing_override]
axes: z
gcode:
{% set max_x = printer.configfile.config["stepper_x"]["position_max"]|float %}
{% set max_y = printer.configfile.config["stepper_y"]["position_max"]|float %}
{% set e_target = printer.extruder.target %} ; Save target temperature
{% set fan_speed = printer.fan.speed %} ; Save fan speed
; If Z axis is not homed, set virtual position and raise
{% if 'z' not in printer.toolhead.homed_axes %}
SET_KINEMATIC_POSITION Z=0
G90
G0 Z5 F600
{% endif %}
{% set home_all = 'X' not in params and 'Y' not in params and 'Z' not in params %}
{% if home_all or 'X' in params %}
G28 X
{% endif %}
{% if home_all or 'Y' in params %}
G28 Y
{% endif %}
{% if home_all or 'Z' in params %}
; Temperature check [Modifiable] Change 150 to your temperature threshold
{% if e_target >= 150 or printer.extruder.temperature >= 150 %}
M106 S255 ; Turn on fan to aid cooling
M109 S150 ; Wait for cooling to 150°C [Modifiable]
{% endif %}
M106 S0 ; Turn off fan
; Move to bed center [Important] Prevent collision when homing Z
G0 X{max_x / 2} Y{max_y / 2} F3600
G28 Z
G1 Z10 F2000
; Restore temperature and fan speed
M109 S{e_target}
M106 S{fan_speed}
{% endif %}
Temperature Protection Logic
- Check Temperature: Checks if the nozzle target or actual temperature is ≥ 150°C
- Turn on Fan: M106 S255 turns on the cooling fan at full speed
- Wait for Cooling: M109 S150 waits for the nozzle to cool to 150°C
- Turn off Fan: M106 S0 turns off the fan to prepare for homing
- Execute Homing: Move center → Home Z → Raise
- Restore State: Restores original target temperature and fan speed
How to Modify the Temperature Threshold
- Find the two locations marked [Modifiable]
- Change
150to your desired temperature value - Both locations must be changed to the same value simultaneously
- Save and restart Klipper
Usage Example
G28 ; Home all → Check temperature → Cool down (if needed) → Move center → Home Z → Restore temperature
Related Resources
- Klipper Official Documentation - Homing Override
- Klipper Official Documentation - Force Move
- G-code Command Reference
Loading...