Passing macro params to another macro using M98
-
I have a homing utility I use to lift the Z axis. I have modified it to take an L parameter specifying how much to lift by. If the L parameter is not present it uses a default 3mm:
/macros/HomingUtils/LiftZ.g
; Lift Z by L parameter or 3mm during homing moves G91 ; relative positioning if exists(param.L) var lift = param.L echo "LiftZ: L = ",var.lift,"mm" G1 Z{var.lift} F600 H2 ; lift Z relative to current position else echo "LiftZ: No L param - Lifting 3mm" G1 Z3 F600 H2 ; lift Z relative to current position G90 ; absolute positioning
This works as expected when tested with different L values and no L present.
I now call this from my homez.g but for some reason the L parameter is not being passed. It is obviously being picked up in homex.g as it is echoed out but it is not being passed on the M98 call. I must be missing something obvious here.
Maybe @dc42 can confirm if this is the correct syntax.
/sys/homex.g
if exists(param.L) var lift = param.L echo "homex: L = ",var.lift M98 P"/macros/HomingUtils/LiftZ.g" L{var.lift} ;M98 P"/macros/HomingUtils/LiftZ.g" L1 M98 P"/macros/HomingUtils/XSafety.g" ; Move X away from endstop if currently triggered G91 ; relative positioning G1 H1 X-320 F5400 ; move quickly to X endstop and stop there (first pass) G1 X5 F1800 ; go back a few mm G1 H1 X-320 F360 ; move slowly to X axis endstop once more (second pass) G90 ; absolute positioning
The commented out M98 call (M98 P"/macros/HomingUtils/LiftZ.g" L1) works as expected so it is something to do with the L{var.lift} not being expanded correctly (maybe?)
Example call from console:
05/05/2021, 11:34:48 M98 P"/sys/homex.g" L1 homex: L = 1 LiftZ: No L param - Lifting 3mm
Sorry forgot to add - I am using RRF 3.3RC1 on Duet2 Wifi.
-
@tekkydave I confirm that this is a bug. I will try to get a fix included in 3.3RC2.
-
@dc42 thanks for that, I thought I was cracking up
-
@tekkydave please try the 3.3RC1+2 binary at https://www.dropbox.com/sh/urr3rbnawf9ehcq/AAA_frdT0tcOXVlPUz3bHKU8a?dl=0. Your original example should work, so should this:
G1 Z{param.L} F600 H2 ; lift Z relative to current position
-
@dc42 Brilliant - now working.
Thanks
Dave