# Print end macro error

**URL:** https://klipper.discourse.group/t/print-end-macro-error/10009
**Category:** General Discussion
**Created:** [August 19, 2023, 4:16pm UTC](https://klipper.discourse.group/t/print-end-macro-error/10009 "2023-08-19T16:16:06Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Pbonamy](https://avatars.discourse-cdn.com/v4/letter/p/ea666f/32.png) [@Pbonamy](https://klipper.discourse.group/u/Pbonamy)
#### Post date: [August 19, 2023, 4:16pm UTC](https://klipper.discourse.group/t/print-end-macro-error/10009/1 "2023-08-19T16:16:06Z")

</div>

Hello,

### Basic Information:

Printer Model: Ender 5 pro  
 MCU / Printerboard: BTT mini E3 V2  
 `klippy.log`  
[klippy.log](https://klipper.discourse.group/uploads/short-url/rfQN1drSZrbg0CyH4E45QRIbYfe.log) (3.0 MB)

### Describe your issue:

I Have a Print end macro like this:

```auto
[gcode_macro PRINT_END]
# Use PRINT_END for the slicer ending script - please customize for your slicer of choice
gcode:
    M400 ; wait for buffer to clear
    G91 ; Relative positioning
    G1 E-2 F2700 ; Retract a bit
    G1 E-2 Z0.2 F2400 ; Retract and raise Z
    G1 X5 Y5 F3000 ; Wipe out
    G1 Z10 ; Raise Z more
    G28 X0 Y0 ; Present print
    G90 ; Absolute positioning
    SFS_DISABLE ; disable smart filament sensor
    M106 S0 ; Turn-off fan
    M104 S0 ; Turn-off hotend
    M140 S0 ; Turn-off bed
    M84 X Y E ; Disable all steppers but Z

```

…At the end off the print I have this Error "!! Must home axis first: 0.000 0.000 0.200 [0.000]  
The print is good only this error, The nozzle

Before I have that print end in my Cura Slicer Printer’s settings and I have no problem.  
Can you help?  
Thanks  
Pat

---

<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: [August 19, 2023, 4:51pm UTC](https://klipper.discourse.group/t/print-end-macro-error/10009/2 "2023-08-19T16:51:30Z")

</div>

Hello @Pbonamy !

In the klippy.log there is more:

```auto
[gcode_macro PRINT_END]
gcode = 
	M400 ; wait for buffer to clear
	G91 ; Relative positioning
	G1 E-2 F2700 ; Retract a bit
	G1 E-2 Z0.2 F2400 ; Retract and raise Z
	G1 X5 Y5 F3000 ; Wipe out
	G1 Z10 ; Raise Z more
	G28 X0 Y0 ; Present print
	G90 ; Absolute positioning
	SFS_DISABLE ; disable smart filament sensor
	M106 S0 ; Turn-off fan
	M104 S0 ; Turn-off hotend
	M140 S0 ; Turn-off bed
	M84 X Y E ; Disable all steppers but Z # <-----------
	{% set max_x = printer.configfile.config["stepper_x"]["position_max"]|float %}
	{% set max_y = printer.configfile.config["stepper_y"]["position_max"]|float %}
	{% set max_z = printer.configfile.config["stepper_z"]["position_max"]|float %}
	{% if printer.toolhead.position.x < (max_x - 20) %}
	{% set x_safe = 20.0 %}
	{% else %}
	{% set x_safe = -20.0 %}
	{% endif %}
	{% if printer.toolhead.position.y < (max_y - 20) %}
	{% set y_safe = 20.0 %}
	{% else %}
	{% set y_safe = -20.0 %}
	{% endif %}
	{% if printer.toolhead.position.z < (max_z - 2) %}
	{% set z_safe = 2.0 %}
	{% else %}
	{% set z_safe = max_z - printer.toolhead.position.z %}
	{% endif %}
	G0 Z{z_safe} F3600 ; move nozzle up
	G0 X{x_safe} Y{y_safe} F20000 ; move nozzle to remove stringing
	TURN_OFF_HEATERS
	M107 ; turn off fan
	G90 ; absolute positioning
	G0 X60 Y{max_y} F3600 ; park nozzle at rear

```

Can you imagine what this line does?

> [@Pbonamy](#):
>
> ` M84 X Y E ; Disable all steppers but Z`

After disabling the motors you **always** have to home before doing any move.

---

<div class="post-metadata">

### Author: ![Pbonamy](https://avatars.discourse-cdn.com/v4/letter/p/ea666f/32.png) [@Pbonamy](https://klipper.discourse.group/u/Pbonamy)
#### Post date: [August 19, 2023, 7:17pm UTC](https://klipper.discourse.group/t/print-end-macro-error/10009/3 "2023-08-19T19:17:03Z")

</div>

Thank you very much,  
I will try in the next print and tell to you.  
Have a nice weekend.  
Pat

---

<div class="post-metadata">

### Author: ![Pbonamy](https://avatars.discourse-cdn.com/v4/letter/p/ea666f/32.png) [@Pbonamy](https://klipper.discourse.group/u/Pbonamy)
#### Post date: [August 20, 2023, 9:03am UTC](https://klipper.discourse.group/t/print-end-macro-error/10009/4 "2023-08-20T09:03:39Z")

</div>

Hello EddyMI3D,  
Now end print is OK, I have just to adapt to my printer for parking the nozzle in front, particularly of my Ender 5 pro, front and rear are inverted.  
Thank for your help.  
Have a great day.  
Pat

---

<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: [December 22, 2025, 4:51pm UTC](https://klipper.discourse.group/t/print-end-macro-error/10009/5 "2025-12-22T16:51:22Z")

</div>


