Z Axis Break management after homing Error

Basic Information:

Printer Model: Custom Cartesian 3D printer
MCU / Printerboard: Controllino Maxi Automation
Host / SBC Raspberry Pi 5

klippy_Klipper.log (991.5 KB)

klippy.log

Describe your issue:

My 3D printer uses ball screws for the Z-axes. These are very smooth-running and the print bed simply falls down when the motor is not active. That is why they have brakes installed. I switch these on manually via an output pin.
If the home process fails (error message: !! Endstop y still triggered after retract), the motors are deactivated, but the brakes are not activated. The print bed then falls down. This may damage the printer, the print bed is heavy.
Can I edit the command behind the error message? I would like to add the command for the brake here.

I know that I should design the home process so that the error no longer occurs, I am working on that. However, a defective driver, motor or end stop can trigger the error again. That is why it is important to me that it is resolved. I would appreciate any tips.

First, you may tell Klipper that this a gcode_macro

[pause_on_error]
gcode = 
	M118 ERROR erkannt – aktiviere Z-Bremse
	SET_PIN PIN=z_brake VALUE=0

Then you may try the [on_error_gcode] in [virtual_sdcard]: Configuration reference - Klipper documentation

[gcode_macro pause_on_error]
gcode:
    M118 ERROR erkannt – aktiviere Z-Bremse
    SET_PIN PIN=z_brake VALUE=0

Thanks, sometimes I’m blind for obvios mistakes.

It compiles now, but the bed still drops. How can i tell Klipper to use this macro, if the error occurs?

I mentioned this:

[virtual_sdcard]
path:
#   The path of the local directory on the host machine to look for
#   g-code files. This is a read-only directory (sdcard file writes
#   are not supported). One may point this to OctoPrint's upload
#   directory (generally ~/.octoprint/uploads/ ). This parameter must
#   be provided.
#on_error_gcode:
#   A list of G-Code commands to execute when an error is reported.
#   See docs/Command_Templates.md for G-Code format. The default is to
#   run TURN_OFF_HEATERS.
[virtual_sdcard]
path: /var/lib/Repetier-Server/database/virtual_sd
on_error_gcode:
    M118 ERROR erkannt – aktiviere Z-Bremse
    SET_PIN PIN=z_brake VALUE=0

I tried it, but the on_error_code is not executed in this situation.

There is one pointer I want to give all non native English speakers.

Always use English when dealing with OSes and software. English is the programming language. You’ll find help in the www much easier. I’m also a no native English speaker.

Kind of off topic but couldn’t you monitor the enable pin for the stepper driver? That would work any time the motor shuts down.

This should work during a print that is started from the virtual sd card. It wont work however if you are manually sending the home command via the console.

That would be an option, it should be possible to add a relay to that port. Some stepper driver support brake-management themself, but mine unfourtunatly don’t. I’ll try this if i don’t get a solution in software.

Ok, good to know. I would need that always, not only durring the print.

If you have an available pin you can split the enable pin in your configuration,

And drive your brake from a dedicated pin.

I got it working in another way. Repetier Server allows to filter the console output and send G-Codes as reaction.

It’s possible to filter for different error messages from klipper:

\s*(Endstop|Heater|Thermal|MCU|Lost communication|ADC|No trigger on .* after full movement)

After that errors a M112 command is sent, which brings my printer to a save state (and forces me to resolve more of the issues that cause the error message in first place).