3

I'd like to force Klipper to perform power on (using M80) before homing. For this purpose I'm trying to override G28:

[gcode_macro G28]
rename_existing: G28_BASE
gcode:
  M80
  G28_BASE { rawparams }

But for some reason this does not work, I'm getting the following error:

G-Code macro rename of different types ('G28' vs 'G28_BASE')

Isn't G28 overridable? Is there any other way to achieve the desired behavior?

Greenonline
  • 5,831
  • 7
  • 30
  • 60

2 Answers2

3

Because of the way parameters work differently (Sx vs NAME=x) for gcode style commands vs Klipper extended ones, the rename has to be to the "same type" of command. G28_BASE does not fit the pattern to be considered a "gcode style" one. Use G9028 or G28.1 or something instead and it should work.

1

Besides using a different macro, it is also possible to use [homing_override] which allows you to redefine the homing sequence.

You can write a simple homing_override like (untested!)

[homing_override]
axes: xyz
gcode:
  M80
  G28

and you are done.

Be aware that this very simple override will home all axes every time homing is called: "G28 X0" will home also Y and Z. You can put checks to home only what is requested, see here but it become more involved.

FarO
  • 3,906
  • 13
  • 31
  • Thanks, I saw this. But I decided not to use this exactly because of the reason you mentioned: I'd like to be able to pass arguments as is to the default G28 implementation – Denis Itskovich Mar 15 '22 at 12:09
  • 1
    If you check the link I provided, he homes only what's being requested by checking "{% if params.X is defined %}{% set home_x = True %}{% endif %}" and so on – FarO Mar 15 '22 at 12:59