How do I implement Conditional Gcode with 2 Z probes
-
Hi,
Yesterday I managed to calibrate 2 IDEX toolheads by briefly changing the endstop pin/type of W axis. (see topic 32059)
My hardware config;
IDEX machine with Z moving up and down. Each tool has an independent little Z-axis (T0=V and T1=W). That axis has a microswitch endstop at high-end, and a nozzle touch probe on low-end (T0=K0 and T1=K1)Issue;
However, I do not find this solution ideal, because if I print with the 2nd toolhead, I want to be able to probe with that head as well. Also, I want to be able to level 2 heads compared to each other, if they also have a height difference in the nozzle.My new idea/goal;
I have configured 2 Z probes, 1 for each tool. I want to move both V and W all the way up. Then I want to move the tools next to each other above the centre of the bed. After that. I want to move the Z-axis up until 1 of the hotends is triggered (this will be the longest hotend).
When Probe K0 (T0) is triggered first, Z will stop moving up and W-axis (T1) starts moving down until it triggered. After that the 2 nozzles should, in theory, be at the same height.
When Probe K1 (10) is triggered first, Z will stop moving up and V-axis (T0) starts moving down until it triggered. After that the 2 nozzles should, in theory, be at the same height.I have configured the probes like this;
M558 K0 P8 C"2.io0.in" H3 F120 T21000 ; Set E1 Z probe, set dive height, probe speed and travel speed G31 K0 P500 X0 Y0 Z-0.6 ; Set Z offset of E1 probe M558 K1 P8 C"2.io1.in" H3 F120 T21000 ; Set E1 Z probe, set dive height, probe speed and travel speed G31 K1 P500 U0 Y0 Z-0.6 ; Set Z offset of E1 probe
Question
How do I configure this macro?I was thinking about a loop? or just a continuous Z movement with 2 if-statements.
I hope to learn again from this forum. Thanks in advance.
-
The issue with this approach is conventional homing with a Z probe (which used G30) is going to default to K0:
https://docs.duet3d.com/User_manual/Reference/Gcodes#g30-single-z-probeYou can get it to use the other probe by using K1 as a switch but because you don't know in advance which probe will trigger first. Because of that restriction I think it will be best to adapt this approach slightly to initially use the method you proposed in your earlier thread.
If you get the V axes in the center of its travel and have W at the top then assuming this means that for any potential nozzle length, the W axes will be out the way. Then move Z up until the V axis probe is triggered. Now you can home W using the probe. This achieves the same results, and you can still use the probe on W if you want to probe the bed for that tool.
-
Thanks! this is exactly the answer I was searching for. I will try that out but assume it is working just fine.
Therefore I will close the ticket.