"G28 Z" when XY are not homed triggers an error but executes safe_z_home.z_hop first

Z homing before XY triggers an error which is perfectly normal.
But before triggering the error it executes the safe_z_home.z_hop move first.
Which may lead the Z axis to hurt its limits if the command is send multiple times.

If it’s possible, the best solution in this case would be to Z-hop only once if multiple “G28 Z” are sent in a row.
If not, just to ignore the Z-hop on Z home errors.

I have posted this as an issue on the github but I was kindly redirect here by the bot ^^’

So is this a misconfiguration of Klipper from my part ? Or do you have the same kind of behavior and this is a real issue to report?

This is a real issue

line 37

if 'z' not in kin_status['homed_axes']:

This condition is too permissive. It doesn’t take in count if the previous attempt of Z homing was aborted due to an error.

The original author of the safe_z_home module determined that it was safer to always lift the z then risk the chance that the z is too close to the bed. The former is unlikely to cause damage to the machine while the latter has a very high chance of damaging the nozzle/bed.

Once the Z motor is disabled, the z carriage can easily move towards the bed - it is common on some printers.

Cheers,
-Kevin