kgleason / klipper.macro.g28_override

Homing (G28) override for Klipper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Homing (G28) override for Klipper [v.3]

This macro overrides the default homing process to allow for better customisation.

Dependencies

Requires having the following directives in your printer configuration:

# Force move & respond directives in printer.cfg
[force_move]
enable_force_move: true

[respond]

In addition, you'll need an [include] directive pointing to the files in this repo. Below is an example. You can include each file individually, or use a completely different pattern.

# Include directive in printer.cfg
[include macros/*.macro.cfg]

How to install

  1. Save the files on the computer running klipper.
  2. Ensure that all of the required directives are in your printer.cfg
  3. Add the [include] directive in your printer.cfg
  4. Tweak the custom_homing_config.macro.cfg to get the settings how you want them to be

Features

By editing adding the following configuration in your custom_homing_config.macro.cfg, you can alter how your printer homes according to your specific needs.

HOME_OVERRIDE_CONFIG

The HOME_OVERRIDE_CONFIG macro can be used to configure homing order and homing dependencies

Homing Order

[gcode_macro HOMING_OVERRIDE_CONFIG]
variable_order: "x,y,z"
gcode:
  RESPOND PREFIX="info" MSG="Homing config"

Edit the variable_order setting to configure any order you want. Use lowercase letters for all axes. Make sure all axes you want to home are set there. Skipping one will cause it not to be homed.

Homing Dependencies

Sometimes homing an axis requires another one to be also homed, for example you want to home X before Y every time. In this case G28 Y should home X before homing Y. Since the default order is X Y Z, this example is somewhat redundant. However, it will force the status of X to be checked before homing Y.

[gcode_macro HOMING_OVERRIDE_CONFIG]
variable_dowith_y: "x"
gcode:
  RESPOND PREFIX="info" MSG="Homing config"

If you don't want or need a dependency for any given axis, just comment or remove that line

Homing Z-hop start

If you want to start homing by moving the bed and the nozzle away from each other, you can use this setting

[gcode_macro HOMING_OVERRIDE_CONFIG]
variable_start_zhop: 20
gcode:
  RESPOND PREFIX="info" MSG="Homing config"

Overriding individual axis homing

For each axis you can create a macro named "HOMING_OVERRIDE_<axis_name>" like below. Each gcode must contain G990028 A0 gcode command - replace A with the axis you're overriding

[gcode_macro HOMING_OVERRIDE_X]
gcode:
  RESPOND PREFIX="info" MSG="Homing > X"
  G90
  G990028 X0
  G91
  G0 X5 F2000
  G90
  
[gcode_macro HOMING_OVERRIDE_Y]
gcode:
  RESPOND PREFIX="info" MSG="Home > Y"
  G90
  G990028 Y0
  G91
  G0 Y-5 F2000
  G90
  
[gcode_macro HOMING_OVERRIDE_Z]
gcode:
  RESPOND PREFIX="info" MSG="Homing > Z"
  G90
  G0 X100 Y100
  G990028 Z0
  G91
  G0 Z20
  G90

You can override only the axes you need custom homing for.

Overriding initial Z hop

[gcode_macro HOMING_OVERRIDE_ZHOP]
gcode:
  RESPOND PREFIX="info" MSG="Homing > Z Hop"
  SET_KINEMATIC_POSITION Z=0
  G91
  G0 Z{printer['gcode_macro HOMING_CONFIG'].start_zhop|int}
  G90

Run gcode before and after homing

These macros are called with paremeters X=0/1 Y=0/1 Z=0/1. Axes to be homed will be set to 1, axes not to be homed will be set to 0.

[gcode_macro HOMING_OVERRIDE_BEFORE]
gcode:
  RESPOND PREFIX="info" MSG="Homing > Before G-code"
  

[gcode_macro HOMING_OVERRIDE_AFTER]
gcode:
  RESPOND PREFIX="info" MSG="Homing > After G-code"

About

Homing (G28) override for Klipper