Homing Override - Homing Override Configuration
Overview
This page provides two Klipper Homing Override reference configurations for optimizing the homing process of 3D printers, improving safety and precision.
Configuration List
| Configuration | Function Description | Applicable Scenarios |
|---|---|---|
| Configuration One | Basic Homing Override + Bed Centering | Standard homing process optimization |
| Configuration Two | Nozzle Temperature Check + Safe Homing | Safe homing in high-temperature environments |
Configuration One: Basic Homing Override
Function Description
- Automatically detects if the Z-axis is homed; if not, sets a virtual Z position first.
- Automatically moves to the center of the heated bed before homing the Z-axis.
- Supports independent X, Y, Z homing commands.
- Uses
printer.configfile.configto read the printer's maximum travel.
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 lift
{% 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】 Prevents collision during Z homing
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 moves the nozzle to the center of the heated bed before homing the Z-axis.
X{max_x / 2}: Move X-axis to half of its maximum travel (bed center X coordinate)Y{max_y / 2}: Move Y-axis to half of its maximum travel (bed center Y coordinate)- F3600: Move speed is 3600 mm/min (60 mm/s), a fast move.
Why move to the bed center?
- Avoid Collisions: Prevents the nozzle from hitting leveling knobs or other obstacles at the bed edges during homing.
- Improve Accuracy: The bed center is typically the flattest area, ensuring more accurate homing.
- Compatibility: Supports various probes like ALPS, BL-Touch, EDDY, etc.
How to modify the move 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-60 mm/s)
Usage Example
G28 ; Home all → Check Z → Home XY → Move to center → Home Z → Lift
Configuration Two: Homing Override with Temperature Protection
Function Description
- Includes all features from Configuration One.
- Adds nozzle temperature check.
- Automatically cools down to a safe temperature if too hot.
- Restores original temperature settings after homing.
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 lift
{% 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 assist cooling
M109 S150 ; Wait for temperature to drop to 150°C 【Modifiable】
{% endif %}
M106 S0 ; Turn off fan
; Move to bed center 【Important】 Prevents collision during Z homing
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: Determines if nozzle target or actual temperature is ≥ 150°C.
- Turn On Fan: M106 S255 turns on the cooling fan at full speed.
- Wait for Cooldown: M109 S150 waits for the nozzle to cool down to 150°C.
- Turn Off Fan: M106 S0 turns off the fan in preparation for homing.
- Execute Homing: Move to center → Home Z → Lift.
- Restore State: Restore original target temperature and fan speed.
How to Modify the Temperature Threshold
- Locate the two places marked 【Modifiable】.
- Change
150to your desired temperature value. - Both places must be modified to the same value.
- Save and restart Klipper.
Usage Example
G28 ; Home all → Temperature check → Cool down (if needed) → Move to center → Home Z → Restore temperature
Related Resources
- Klipper Official Documentation - Homing Override
- Klipper Official Documentation - Force Move
- G-code Command Reference
Loading...