Skip to main content

Homing Override Configuration

Overview

This page provides two Klipper Homing Override reference configurations for optimizing the 3D printer homing process, improving safety and precision.

Configuration List

ConfigurationFeature DescriptionApplicable Scenario
Configuration OneBasic homing override + hotbed centeringStandard homing process optimization
Configuration TwoNozzle temperature check + safe homingSafe homing in high-temperature environments

Configuration One: Basic Homing Override

Feature Description

  • Automatically detects if the Z-axis has been homed; if not, sets a virtual Z position first
  • Automatically moves to the hotbed center before homing the Z-axis
  • Supports independent X, Y, Z homing commands
  • Reads printer maximum travel using printer.configfile.config

Full 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 hotbed 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 hotbed before homing the Z-axis.

  • X{max_x / 2}: Moves the X-axis to half of the maximum travel (hotbed center X coordinate)
  • Y{max_y / 2}: Moves the Y-axis to half of the maximum travel (hotbed center Y coordinate)
  • F3600: Movement speed of 3600mm/min (60mm/s), fast movement

Why is moving to the hotbed center necessary?

  1. Avoid Collisions: Prevents the nozzle from hitting leveling knobs or other obstacles when homing at the hotbed edge
  2. Improve Accuracy: The hotbed center is usually the flattest area, resulting in more accurate homing
  3. Compatibility: Supports ALPS, BL-Touch, EDDY, and other probes

How to modify the movement speed?

  • Find the line G0 X{max_x / 2} Y{max_y / 2} F3600
  • Change F3600 to 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 Two: Homing Override with Temperature Protection

Feature Description

  • Includes all features of Configuration One
  • Adds nozzle temperature check
  • Automatically cools down to a safe temperature when too high
  • Restores original temperature settings after homing completes

Full 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 hotbed 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

  1. Check Temperature: Determines if the 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 Cooling: M109 S150 waits for the nozzle to cool to 150°C
  4. Turn off Fan: M106 S0 turns off the fan to prepare for homing
  5. Execute Homing: Move center → Home Z → Raise
  6. Restore State: Restores to original target temperature and fan speed

How to Modify the Temperature Threshold

  1. Find the two places marked [Modifiable]
  2. Change 150 to your desired temperature value
  3. Both places must be changed to the same value simultaneously
  4. Save and restart Klipper

Usage Example

G28 ; Home all → temperature check → cool down (if needed) → move center → home Z → restore temperature


Loading...