How do I replace “stepper_z” with “stepper _z1” with a macro?

Hi, my 3D printer has two Z-axes, and I want them to work independently of each other.
For example, using the macro T0, you can switch the nozzle to extruder. With T1, you can switch the nozzle to extruder1.

As listed above, there is no macro that can switch between stepper_z and stepper_z1?

As far as I’m aware, this is not possible. Klipper even automatically synchronizes stepper_z and stepper_z1 as it assumes they belong to the same axis.

Depending on what you want to achieve, you may try a manual stepper definition or check New generic_cartesian kinematics (incl. CoreXYU/CoreXYUV, generic IDEX and AWD) if this can offer a solution.

Thank you! Sineos!

That kinematic did not support what you wanted to achieve directly. However, now I added a new command SET_STEPPER_KINEMATICS and it can be used to disable or re-enable the steppers as explained in the last post there. So with that, you could probably do

[gcode_macro Z0]
gcode:
  SET_STEPPER_KINEMATICS STEPPER='stepper z1' KINEMATICS= DISABLE_CHECKS=1
  SET_STEPPER_KINEMATICS STEPPER='stepper z0' KINEMATICS=z

[gcode_macro Z1]
gcode:
  SET_STEPPER_KINEMATICS STEPPER='stepper z0' KINEMATICS= DISABLE_CHECKS=1
  SET_STEPPER_KINEMATICS STEPPER='stepper z1' KINEMATICS=z

Assuming you define that new generic_cartesian kinematics as explained in that thread and [stepper z0] and [stepper z1] specifically.

First of all, thank you very much, dmbutyugin!

I added macros as you said,But the system still doesn’t recognize it.

How does this step work?" Assuming you define that new generic_cartesian kinematics as explained in that thread and [stepper z0] and [stepper z1] specifically."

Is this modified in printer.cfg?

This whole thing (generic_cartesian kinematics in general and SET_STEPPER_KINEMATICS command) is a new feature that was not integrated into the mainline Klipper yet, and is under testing now. You can install it from a different branch, if you know how. In principle, KIAUH supports that.

If you feel adventurous, you can install the new code from this branch: GitHub - dmbutyugin/klipper at generic-cartesian. Back up the old Klipper installation and configs, just in case. You can follow the instructions here how to add a custom repository (the file is available as ~/kiauh/klipper_repos.txt.example on the pi, you need to copy it as ~/kiauh/klipper_repos.txt and add

dmbutyugin/klipper,generic-cartesian

line there, then run KIAUH script, select 6 to go to ‘Setttings’, then 1 to ‘Set custom Klipper repository’, and then choose the appropriate branch:


(after you’ve done with the testing, or this feature is merged into the mainline Klipper, you can use the same sequence to select back the original Klipper (all the other options in the screenshot, including option 0 will get you there).

And then you can read the first post in the thread on how to configure the generic_cartesian kinematics (basically, how to convert your existing config to it).

Now,I’ve done the two steps you’re talking about!
First step, I have modified these 11 files in pi!

Second step, I have installed this branch of kiauh!

However, SET_STEPPER_KINEMATICS is still not recognized from the command bar."
As you said in the last sentence, there should be some errors in my printer.cfg.
Although I have read a lot of your articles, I still don’t know how to start modifying printer.cfg.
Can you help me, Savior! :pray: :pray: :pray:

printer(1).cfg (5.2 KB)
printer(1).cfg.txt (5.5 KB)

Klipper won’t load in this configuration that you posted, so it cannot recognize or not recognize the command, right? You need to fix the configuration. The first post that I linked describes how the configuration should look like for generic_cartesian kinematics, so please read it. But the basic idea (for you) would be that for each section [stepper_x] (and y, z), you split it into two sections: [carriage x] and [stepper x], and as per post, some configuration options from the old [stepper_x] section go into [carriage x] and some - into [stepper x]. In addition, you’d add a kinematics: x option to [stepper x] section. And repeat that for y and z steppers. If you miss or mix up something, Klipper will tell you about missing or wrong options (if you forget to put some options into their appropriate places).

Thank you, Superman! :+1: :+1: :+1:
I did exactly what you said and watched your post!But there are still some problems!
My system is just the simplest cartesian, not corexy and others!

1.When I define [carriage x] and [stepper x], I also define y, z, z1.


The klipper works, but the macrosZ Z1 does not

2.When I define [carriage x] and [stepper stepper_x], I also define y, z, z1.


The klipper works, but the macrosZ Z1 does not

3.When I define [carriage x] and [kinematic_stepper x], I also define y, z, z1.


But this time, klipper made a mistake!

Finally,I have tried all the definitions of stepper and have no idea what the problem is. And please teach me the last step! :pray:
printer1.txt (4.3 KB)

Of the three scenarios I’ve listed, I think the 1 of the 1 2 3 comes closest to success!
Carriage z1 have already been referenced by z1 stepper kinematics in the above code.
Do I need to mention the carriage z1 referenced by z1 stepper kinematics again in macros?
I was so close to finishing it!
I really want to get this done after all your teaching!

Please no need to ping me too much, I’ll reply when I have time. In your latest case, you need to match the stepper name to the one in your config, e.g. STEPPER='stepper stepper_z'

I’m sorry to bother you so many times. :sob:

In my config?Do you mean to change it in config in the picture below?

Or modify my printer.cfg?
In my latest case 3, I match the following stepper name in printer.cfg

Which line of printer.cfg should I change to?


In my latest case 3,when I used [kinematic_stepper z] to define stepper z, klipper did not work and an error .

In my case 1 and 2, I can only use [stepper z] or [stepper stepper_z] to define stepper z. klipper at least works.

These days, according to your step-by-step instructions, I still don’t succeed. I’m sorry. I’m so stupid.But I really want to try this feature you developed
Thankyou!

You should really just read the first post in the thread which describes the configuration now. You configuration for carriages are probably fine now, but you should not use kinematic_stepper (this was an older proposal) and instead define, for example

[stepper stepper_x]
kinematics: x
...
[stepper stepper_y]
kinematics: y
...
[stepper stepper_z]
kinematics: z
...
[stepper stepper_z1]
kinematics: z1

and then in your Z0/Z1 macros, you should use

[gcode_macro Z0]
gcode:
  SET_STEPPER_KINEMATICS STEPPER='stepper stepper_z1' KINEMATICS= DISABLE_CHECKS=1
  SET_STEPPER_KINEMATICS STEPPER='stepper stepper_z' KINEMATICS=z

[gcode_macro Z1]
gcode:
  SET_STEPPER_KINEMATICS STEPPER='stepper stepper_z' KINEMATICS= DISABLE_CHECKS=1
  SET_STEPPER_KINEMATICS STEPPER='stepper stepper_z1' KINEMATICS=z

Basically STEPPER parameter should reference the name of the stepper exactly as it is in the configuration.

Thank you for taking time out of your busy schedule!

I changed it exactly as you said,but there’s one last problem.

The klipper works, but the macros Z/Z1 does not.
Do I still need to add carriage and kinematics in macros Z/Z1?

Ah, OK, then add DISABLE_CHECKS=1 to all SET_STEPPER_KINEMATICS commands in Z0/Z1 macros. Two of the commands had them already, but the other two didn’t.

Thanks God, Z/Z1 works!
But,When I use Z/Z1 alone, klipper stops working as soon as I click Z-home.
The graph below does not solve this problems.

Please send the full klippy.log when you try the problematic sequence of GCode and experience a failure, and also send the commands you were sending to Klipper.

Z0/Z1 works alone!
But,When I use Z0/Z1 alone, klipper stops working as soon as I click G28 Z-home.


klippy(4).log (5.8 MB)
Can the G28 Z-home implement Z0/Z1 homing when Z0/Z1 is working alone?

I think I found a bug and I pushed the new code to the branch that should resolve this.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.