# \[QUESTION\] Setting specific procedure for each homing axis

**URL:** <https://klipper.discourse.group/t/question-setting-specific-procedure-for-each-homing-axis/13233>\
**Category:** General Discussion\
**Created:** [January 16, 2024, 4:35pm UTC](https://klipper.discourse.group/t/question-setting-specific-procedure-for-each-homing-axis/13233 "2024-01-16T16:35:44Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![JOSEDELLABOSCA](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/josedellabosca/32/9491_2.png) [@JOSEDELLABOSCA](https://klipper.discourse.group/u/JOSEDELLABOSCA)\
**Post date:** [January 16, 2024, 4:35pm UTC](https://klipper.discourse.group/t/question-setting-specific-procedure-for-each-homing-axis/13233/1 "2024-01-16T16:35:44Z")

</div>

### Basic Information:

Printer Model: Custom core XY  
 MCU / Printerboard: Smoothieboard 120mhz  
 `klippy.log` [https://drive.google.com/file/d/1wzNFDGWRqKWr8Ufj7zj-TzxWNqEPkFFF/view?usp=sharing](https://drive.google.com/file/d/1wzNFDGWRqKWr8Ufj7zj-TzxWNqEPkFFF/view?usp=sharing)

### Describe your issue:

I want to specify a procedure for homing each axis. Specially Z because there are obstacles.  
I tried various configuration found with google, but i always have the error: "Source contains parsing errors: ‘/home/pi/printer\_data/config/printer.cfg’ " even with configuration files that other users say that works.

This is what i must do when homing Z:

```auto
[homing_override]
gcode:
G91
G0 Z20 F2000
G90
G28 XY
G0 X20 Y105
G28 Z
G92 Z1.25
G0 Z20
G0 X55 Y100

```

Photo of the machine for better understanding:

> **[IMG\_20240116\_134649637.jpg](https://drive.google.com/file/d/1wvsw2qoOV6-TESmJo3b3OVWfBiM3w-v6/view?usp=sharing)**
>
> Google Drive file.

thanks in advance

---

<div class="post-metadata">

**Author:** ![EddyMI3D](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/eddymi3d/32/1981_2.png) [@EddyMI3D](https://klipper.discourse.group/u/EddyMI3D)\
**Post date:** [January 16, 2024, 4:45pm UTC](https://klipper.discourse.group/t/question-setting-specific-procedure-for-each-homing-axis/13233/2 "2024-01-16T16:45:53Z")

</div>

Hello @JOSEDELLABOSCA !

Please set your code snippet at preformatted text  
 ![Format](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/6/643ab9def96b03089cfb0c194628129fcc96b3f8.png)

Without, the parsing issues are formatted away and we can’t tell.

BTW: you can upload your log here:  
 ![Upload](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/f/f4bca94c8dcd7674a4931461997a8435c81e5495.png)

---

<div class="post-metadata">

**Author:** ![JOSEDELLABOSCA](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/josedellabosca/32/9491_2.png) [@JOSEDELLABOSCA](https://klipper.discourse.group/u/JOSEDELLABOSCA)\
**Post date:** [January 16, 2024, 4:52pm UTC](https://klipper.discourse.group/t/question-setting-specific-procedure-for-each-homing-axis/13233/3 "2024-01-16T16:52:22Z")

</div>

Ok, already done.

---

<div class="post-metadata">

**Author:** ![Sineos](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/sineos/32/18_2.png) [@Sineos](https://klipper.discourse.group/u/Sineos)\
**Post date:** [January 16, 2024, 4:58pm UTC](https://klipper.discourse.group/t/question-setting-specific-procedure-for-each-homing-axis/13233/4 "2024-01-16T16:58:31Z")

</div>

Post your printer.cfg file, please

---

<div class="post-metadata">

**Author:** ![LifeOfBrian](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/lifeofbrian/32/2380_2.png) [@LifeOfBrian](https://klipper.discourse.group/u/LifeOfBrian)\
**Post date:** [January 16, 2024, 4:59pm UTC](https://klipper.discourse.group/t/question-setting-specific-procedure-for-each-homing-axis/13233/5 "2024-01-16T16:59:15Z")

</div>

You can try like the following:

```auto
[homing_override]
axes: xyz
gcode:
  {% set home_all = 'X' not in params and 'Y' not in params and 'Z' not in params %}

  {% if home_all or 'X' in params %}
    _HOME_X
  {% endif %}
  
  {% if home_all or 'Y' in params %}
    _HOME_Y
  {% endif %}
  
  {% if home_all or 'Z' in params %}
    M117 Homing Z...
    G90
    G0 X121 Y132 F6000 #move print head to safe position in the center of the bed
    G28 Z
    G0 Z5 F600
    M117
  {% endif %}

```

---

<div class="post-metadata">

**Author:** ![JOSEDELLABOSCA](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/josedellabosca/32/9491_2.png) [@JOSEDELLABOSCA](https://klipper.discourse.group/u/JOSEDELLABOSCA)\
**Post date:** [January 16, 2024, 5:01pm UTC](https://klipper.discourse.group/t/question-setting-specific-procedure-for-each-homing-axis/13233/6 "2024-01-16T17:01:38Z")

</div>

```auto
[include fluidd.cfg]

[mcu]

serial: /dev/serial/by-id/usb-Klipper_lpc1769_0FF0000DC384C8AEA5D8C156C62000F5-if00

[virtual_sdcard]

path: /home/pi/printer_data/gcodes

on_error_gcode: CANCEL_PRINT

[printer]

kinematics: corexy

max_velocity: 1000

max_accel: 1000

max_z_velocity: 200

max_z_accel: 200

[stepper_x]

step_pin: P2.3

dir_pin: !P0.22

enable_pin: !P0.21

microsteps: 16

rotation_distance: 40

endstop_pin: P1.25

position_endstop: 0

position_min: 0

position_max: 295

homing_speed: 50

[stepper_y]

step_pin: P2.2

dir_pin: !P0.20

enable_pin: !P0.19

microsteps: 16

rotation_distance: 40

endstop_pin: P1.29

position_endstop: 0

position_max: 200

homing_speed: 50

[stepper_z]

step_pin: P2.1

dir_pin: !P0.11

enable_pin: !P0.10

microsteps: 16

rotation_distance: 8

endstop_pin: ^!P1.28

position_endstop: 0.5

position_max: 350

[extruder]

step_pin: P2.0

dir_pin: P0.5

enable_pin: !P0.4

microsteps: 16

rotation_distance: 7.200

nozzle_diameter: 0.400

filament_diameter: 1.750

heater_pin: P2.5

sensor_type: EPCOS 100K B57560G104F

sensor_pin: P0.23

control: pid

pid_Kp: 29.7

pid_Ki: 1.783

pid_Kd: 124

min_temp: 0

max_temp: 250

[heater_bed]

heater_pin: P2.7

sensor_type: Honeywell 100K 135-104LAG-J01

sensor_pin: P0.24

control: pid

pid_Kd: 872

pid_Ki: 13.252

pid_Kp: 215

min_temp: 0

max_temp: 110

[fan]

pin: P2.4

[static_digital_output leds]

pins: P1.18, P1.19, P1.20, P1.21, P4.28

[mcp4451 stepper_digipot1]

i2c_address: 44

# Scale the config so that wiper values can be specified in amps.

scale: 2.25

# wiper 0 is X (aka alpha), 1 is Y, 2 is Z, 3 is E0

wiper_0: 0.8

wiper_1: 0.8

wiper_2: 1.8

wiper_3: 1.0

[mcp4451 stepper_digipot2]

i2c_address: 45

scale: 2.25

# wiper 0 is E1

wiper_0: 1.0

[force_move]

enable_force_move: true

# Set to true to enable FORCE_MOVE and SET_KINEMATIC_POSITION

# extended G-Code commands. The default is false.

```

i ommited the [homing\_override] section posted in the first post.

---

<div class="post-metadata">

**Author:** ![Sineos](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/sineos/32/18_2.png) [@Sineos](https://klipper.discourse.group/u/Sineos)\
**Post date:** [January 16, 2024, 5:02pm UTC](https://klipper.discourse.group/t/question-setting-specific-procedure-for-each-homing-axis/13233/7 "2024-01-16T17:02:13Z")

</div>

Attach the file, please.

---

<div class="post-metadata">

**Author:** ![JOSEDELLABOSCA](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/josedellabosca/32/9491_2.png) [@JOSEDELLABOSCA](https://klipper.discourse.group/u/JOSEDELLABOSCA)\
**Post date:** [January 16, 2024, 5:03pm UTC](https://klipper.discourse.group/t/question-setting-specific-procedure-for-each-homing-axis/13233/8 "2024-01-16T17:03:59Z")

</div>

should i replace \_HOME\_X and \_HOME\_Y with the specific gcode?

---

<div class="post-metadata">

**Author:** ![JOSEDELLABOSCA](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/josedellabosca/32/9491_2.png) [@JOSEDELLABOSCA](https://klipper.discourse.group/u/JOSEDELLABOSCA)\
**Post date:** [January 16, 2024, 5:05pm UTC](https://klipper.discourse.group/t/question-setting-specific-procedure-for-each-homing-axis/13233/9 "2024-01-16T17:05:49Z")

</div>

[printer.cfg](https://klipper.discourse.group/uploads/short-url/lWM5POSSD66czaitzhEayG1p53T.cfg) (1.8 KB)

---

<div class="post-metadata">

**Author:** ![Sineos](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/sineos/32/18_2.png) [@Sineos](https://klipper.discourse.group/u/Sineos)\
**Post date:** [January 16, 2024, 5:08pm UTC](https://klipper.discourse.group/t/question-setting-specific-procedure-for-each-homing-axis/13233/10 "2024-01-16T17:08:20Z")

</div>

Well, the file apparently does not contain the statements that are causing your issue, so I cannot provide further insights.

---

<div class="post-metadata">

**Author:** ![JOSEDELLABOSCA](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/josedellabosca/32/9491_2.png) [@JOSEDELLABOSCA](https://klipper.discourse.group/u/JOSEDELLABOSCA)\
**Post date:** [January 16, 2024, 5:15pm UTC](https://klipper.discourse.group/t/question-setting-specific-procedure-for-each-homing-axis/13233/11 "2024-01-16T17:15:30Z")

</div>

[printer.cfg](https://klipper.discourse.group/uploads/short-url/vP6zrEamuNxUvQPkEvXb0Vp1sY1.cfg) (1.9 KB)  
there you go with the non working section successfully added

---

<div class="post-metadata">

**Author:** ![Sineos](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/sineos/32/18_2.png) [@Sineos](https://klipper.discourse.group/u/Sineos)\
**Post date:** [January 16, 2024, 5:17pm UTC](https://klipper.discourse.group/t/question-setting-specific-procedure-for-each-homing-axis/13233/12 "2024-01-16T17:17:39Z")

</div>

You are missing the required indentation. Replace by:

```auto
[homing_override]
gcode:
    G91
    G0 Z20 F2000
    G90
    G28 XY
    G0 X20 Y105
    G28 Z
    G92 Z1.25
    G0 Z20
    G0 X55 Y100

```

---

<div class="post-metadata">

**Author:** ![LifeOfBrian](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/lifeofbrian/32/2380_2.png) [@LifeOfBrian](https://klipper.discourse.group/u/LifeOfBrian)\
**Post date:** [January 16, 2024, 5:23pm UTC](https://klipper.discourse.group/t/question-setting-specific-procedure-for-each-homing-axis/13233/13 "2024-01-16T17:23:02Z")

</div>

We should highlight this more.  
Wanted to point towards this as well but thought it was missing only due to copying here as he tested a working config as well…

So never assume anything but verify everything!

---

<div class="post-metadata">

**Author:** ![JOSEDELLABOSCA](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/josedellabosca/32/9491_2.png) [@JOSEDELLABOSCA](https://klipper.discourse.group/u/JOSEDELLABOSCA)\
**Post date:** [January 16, 2024, 5:23pm UTC](https://klipper.discourse.group/t/question-setting-specific-procedure-for-each-homing-axis/13233/14 "2024-01-16T17:23:38Z")

</div>

Perfect. now i got this error when trying to home any axis are all of them:

> 14:22:50  
> $ G28  
> 14:22:50  
> !! Must home axis first: 0.000 0.000 20.000 [0.000]  
> 14:22:50  
> !! Must home axis first: 0.000 0.000 20.000 [0.000]

---

<div class="post-metadata">

**Author:** ![Sineos](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/sineos/32/18_2.png) [@Sineos](https://klipper.discourse.group/u/Sineos)\
**Post date:** [January 16, 2024, 5:30pm UTC](https://klipper.discourse.group/t/question-setting-specific-procedure-for-each-homing-axis/13233/15 "2024-01-16T17:30:26Z")

</div>

I do not know your printer nor your requirements. Generally:

- You need to home first before issuing any G0 / G1 commands
- You can work around this by `SET_KINEMATIC_POSITION`
- After using `SET_KINEMATIC_POSITION` nevertheless a G28 is needed
- A safer alternative is using `set_position_` in [homing\_override](https://www.klipper3d.org/Config_Reference.html#homing_override)

---

<div class="post-metadata">

**Author:** ![JOSEDELLABOSCA](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/josedellabosca/32/9491_2.png) [@JOSEDELLABOSCA](https://klipper.discourse.group/u/JOSEDELLABOSCA)\
**Post date:** [January 16, 2024, 5:37pm UTC](https://klipper.discourse.group/t/question-setting-specific-procedure-for-each-homing-axis/13233/17 "2024-01-16T17:37:23Z")

</div>

> [@JOSEDELLABOSCA](#):
>
> have you looked at the picture?  
> [IMG\_20240116\_134649637.jpg - Google Drive](https://drive.google.com/file/d/1wvsw2qoOV6-TESmJo3b3OVWfBiM3w-v6/view)
> 
> as you can see, inductive sensor needs to be positioned where the steel rectangle is, because the base is made of aluminum. And the piece of steel is higher than the print surface, so first i need to move the base down (or increse Z position) regardless of the homing axis

have you looked at the picture?

> **[IMG\_20240116\_134649637.jpg](https://drive.google.com/file/d/1wvsw2qoOV6-TESmJo3b3OVWfBiM3w-v6/view)**
>
> Google Drive file.

as you can see, inductive sensor needs to be positioned where the steel rectangle is, because the base is made of aluminum. And the piece of steel is higher than the print surface, so first i need to move the base down (or increse Z position) regardless of the homing axis

---

<div class="post-metadata">

**Author:** ![Sineos](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/sineos/32/18_2.png) [@Sineos](https://klipper.discourse.group/u/Sineos)\
**Post date:** [January 16, 2024, 5:48pm UTC](https://klipper.discourse.group/t/question-setting-specific-procedure-for-each-homing-axis/13233/18 "2024-01-16T17:48:48Z")

</div>

> [@JOSEDELLABOSCA](#):
>
> have you looked at the picture?

You honestly think that, without any explanation, someone is able to guess your requirements from this picture for a completely foreign printer?

I’m not going to suggest anything here as all these shenanigans might lead to crashing your head in the one or the other way.

- Seems like [safe\_z\_home](https://www.klipper3d.org/Config_Reference.html#safe_z_home) could do the job (likely the only safe variant)
- `SET_KINEMATIC_POSITION Z=<value>` will allow you to “fake” a homed Z-axis and you can then move it with `G0 Z... F....` but be aware that the axis can now be crashed at will
- `homing_override` with `set_position_z` and potentially a limitation on `axes: xy` should go into the same direction

You will need to figure out what is the best approach for you.

---

<div class="post-metadata">

**Author:** ![JOSEDELLABOSCA](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/josedellabosca/32/9491_2.png) [@JOSEDELLABOSCA](https://klipper.discourse.group/u/JOSEDELLABOSCA)\
**Post date:** [January 16, 2024, 6:03pm UTC](https://klipper.discourse.group/t/question-setting-specific-procedure-for-each-homing-axis/13233/19 "2024-01-16T18:03:34Z")

</div>

I understand this, obviously, thats why i’ve been testing different settings two days now before asking.  
I read the documentation but i couldn’t find something related to coding things like " {% set home\_all = ‘X’ not in params and ‘Y’ not in params and ‘Z’ not in params %} " what the reserved words and variables are, etc etc. I even do not know what languaje is used here. Even that the config file is indentation dependient.

i can use [safe\_z\_home] but i need to set an offset of 1.25mm from Z probe to Noozle position.

---

<div class="post-metadata">

**Author:** ![Sineos](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/sineos/32/18_2.png) [@Sineos](https://klipper.discourse.group/u/Sineos)\
**Post date:** [January 16, 2024, 6:22pm UTC](https://klipper.discourse.group/t/question-setting-specific-procedure-for-each-homing-axis/13233/20 "2024-01-16T18:22:06Z")

</div>

> [@JOSEDELLABOSCA](#):
>
> i can use [safe\_z\_home] but i need to set an offset of 1.25mm from Z probe to Noozle position.

Likely, you can use 3 approaches:

- Determine your “regular” z-offset as [described here](https://www.klipper3d.org/Probe_Calibrate.html#calibrating-probe-z-offset) after homing and on the printer bed → Now your 1.25mm should be already compensated
- Determine your probe’s z-offset on your special landing place, safe it and later correct it by your 1.25mm
- Add a [SET\_GCODE\_OFFSET](https://www.klipper3d.org/G-Codes.html#set_gcode_offset) to your slicer’s starting gcode

---

<div class="post-metadata">

**Author:** ![Sineos](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/sineos/32/18_2.png) [@Sineos](https://klipper.discourse.group/u/Sineos)\
**Post date:** [January 16, 2024, 6:55pm UTC](https://klipper.discourse.group/t/question-setting-specific-procedure-for-each-homing-axis/13233/21 "2024-01-16T18:55:23Z")

</div>

Just out of curiosity:  
Your setup seems not to allow using your probe for building a bed-mesh, correct?  
If so, why the hell do you fight around with it? It just

- makes your printing head more bulky and heavy
- adds meaningless complexity
- is less precise than a simple microswitch

If all this is the case, I honestly would recommend exchanging it for a simple z-axis microswitch or any probe that can deal with the material combination.

[Next page](https://klipper.discourse.group/t/question-setting-specific-procedure-for-each-homing-axis/13233.md?page=2)
