mod function doesn't work with variable or constant name
-
Hi everybody,
I am using the mod(,) function in a while loop and I noticed that the function doesn't work with the contstant "iterations" in it.
Here is my while loop:while iterations < 1000 if mod(iterations, 50) = 0 M117 "mod function OK!" G4 P100 continue
The evaluation of mod(140,50) returns the proper value.
If I create a global variable [name], set it to 140 (and check the assignment with M117) and evaluate mod(global.[name],50), it doesn't return any value.Is there somehing I missed?
Thanks in advance.
-
@mathv it works OK for me, running in standalone mode, if I replace the M117 line with an echo command.
It is a feature of DWC that if you send the same M117 message two or more times in succession, you only see the first one. So it also works for me if I replace the M117 line with this:
M117 {"mod function OK! "^iterations}
because then the message is different each time.
-
@dc42 , Thanks for your feedback.
I got this error message when I run it:
Error: Failed to read code from macro test: Failed to evaluate "mod(iterations, 50) = 0": expected ','
I am sure it is a very obvious mistake from me, but I can't find it. -
@mathv are you running RRF in CNC mode? If so, see my response to https://forum.duet3d.com/topic/24519/rrf3-3-meta-functions-don-t-work-when-in-cnc-mode.