Skip to main content

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

ConfigurationFunction DescriptionApplicable Scenarios
Configuration OneBasic Homing Override + Bed CenteringStandard homing process optimization
Configuration TwoNozzle Temperature Check + Safe HomingSafe 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.config to 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?

  1. Avoid Collisions: Prevents the nozzle from hitting leveling knobs or other obstacles at the bed edges during homing.
  2. Improve Accuracy: The bed center is typically the flattest area, ensuring more accurate homing.
  3. 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 F3600 to 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

  1. Check Temperature: Determines if nozzle target or actual temperature is ≥ 150°C.
  2. Turn On Fan: M106 S255 turns on the cooling fan at full speed.
  3. Wait for Cooldown: M109 S150 waits for the nozzle to cool down to 150°C.
  4. Turn Off Fan: M106 S0 turns off the fan in preparation for homing.
  5. Execute Homing: Move to center → Home Z → Lift.
  6. Restore State: Restore original target temperature and fan speed.

How to Modify the Temperature Threshold

  1. Locate the two places marked 【Modifiable】.
  2. Change 150 to your desired temperature value.
  3. Both places must be modified to the same value.
  4. Save and restart Klipper.

Usage Example

G28 ; Home all → Temperature check → Cool down (if needed) → Move to center → Home Z → Restore temperature


Loading...