Setting a input pin via a variable
-
I'm trying to make some macros with a settings sections in the top, but I'm running into one i can't figgure out how to solve
🥵
For instance, I would want to have a local variable represent the input for a endstop pin. Let's call it
var.Xpin
.
So in the top of the macro I havevar Xpin = "io1.in"
Then somewhere farther down in the macro i want to define the X endstop with
var.Xpin
as the input.
I place aM574 X2 S1 P{var.Xpin}
, and that's where the "fun" starts sinceM574
is expecting a string expression.Sure I think, i'll slapp on a couple extra
"
s around the variable so it's nowvar Xpin = ""io1.in""
.
Well guess what that don't work either because it's "expecting a non-empty string"🤣
I've been throwing in
^ ^
around the variable inM574
, don't work, tried with a plethora of"
s around the variable etc.
Is this even possible to achieve? And if it is, can someone pleeeease point me in the right direction before i start getting nosebleeds lol. -
@Exerqtor This works for me:
var xEndstop = "io0.in" M574 P{var.xEndstop} X1 S1
-
@chrishamm
Yes it does, I must have been overthinking it or something. That the quotation mark around the variable wouldn't get read or something, so i slapped on a double set.
Wrote the code before i went to bed yesterday, probably bad practice doing so when sleepy.Thanks for the help AGAIN Christian!
🤦♂️
-