One simple gcode expression question.

More
25 Jun 2020 19:35 #172747 by pferrick
I can hardly believe that I'm even asking this, but....why does the following gcode not print a message consisting of '2' :

(MSG, [1+1])
M30

I have tried every permutation of MSG, DEBUG, brackets, parentheses, #, and god-only-knows what else that I can think of, and all I seem to be able to get is the message [1+1]. Basically I cannot get expressions to be evaluated, and it's making me bonkers.

The real pisser is that this is not even close to the actual mystery that I am trying to solve! If someone could point out the painfully obvious I would really appreciate it.

tnx,
Patrick

Please Log in or Create an account to join the conversation.

More
25 Jun 2020 19:42 #172748 by MaHa
If you calculate outside of (debug, ) , as
#100 = [1 + 1]
(debug, #100)
it will success

Please Log in or Create an account to join the conversation.

More
25 Jun 2020 19:58 #172749 by pferrick
I tried it, and you're right. Thanks. But I wonder why on Earth would debug NOT evaluate expressions?

I guess that's why I couldn't figure it out...it doesn't say anywhere in the gcode reference that expressions are only evaluated OUTSIDE of things like debug, msg etc. which is not what I think anyone would expect.

Patrick

ps1 - I think you meant to say 'it will succeed'.
ps2 - I'm still wrestling with the G38 stuff, although I'm close. I may have another question about that later!!!

Please Log in or Create an account to join the conversation.

More
25 Jun 2020 20:02 #172750 by pferrick
Oh, and it doesn't work either way with msg, only with debug. Just to make things even more interesting...!

Patrick

Please Log in or Create an account to join the conversation.

More
26 Jun 2020 07:29 #172776 by phillc54

But I wonder why on Earth would debug NOT evaluate expressions?

I guess that would be possible but it would require a way to determine whether the user meant the characters an expression or if they meant them as text.


I guess that's why I couldn't figure it out...it doesn't say anywhere in the gcode reference that expressions are only evaluated OUTSIDE of things like debug, msg etc. which is not what I think anyone would expect.

I wouldn't expect that expressions would be evaluated in MSG, the the docs do say "The rest of the characters before the right parenthesis are considered to be a message". I read that as meaning "the rest of the characters are text".


Oh, and it doesn't work either way with msg, only with debug. Just to make things even more interesting...!

That seems to be what is stated in the docs

Please Log in or Create an account to join the conversation.

Time to create page: 0.108 seconds
Powered by Kunena Forum