Having problems with M118 and variables
-
Hi,
Given this bit of code:
var ABC = "ABC" M118 S{var.ABC} M118 S{var.ABC} ^ "XYZ" M118 S"XYZ" ^ {var.ABC}
The 1st M118 displays "ABC" as expected
The 2nd M118 displays "ABCXYZ" as expected
The 3rd M118 displays just "XYZ"In my actual code the variable follows the literal. What am I doing wrong?
Thanks.
Frederick
-
@fcwilt that's expected. If you want to use an expression as the value of a parameter in a G-or M-command then the entire expression must be enclosed in { }. See https://docs.duet3d.com/en/User_manual/Reference/Gcode_meta_commands#use-of-expressions-within-gcode-commands.
-
Thanks.
Given...
var ABC = "ABC" var DEF = "DEF"
... why do these work?
M118 S{var.ABC} ^ "XYZ" M118 S{var.ABC} ^ {var.DEF}
-
@fcwilt it's not intended that those two will work. They may not work in future firmware versions.
-