Variables not working as expeccted in M558?
-
Hi *,
I use some variables to control the settings in M558 under different conditions. The idea is to probe differently in different situations. Long story short, I saw that "F" does not extend the variables as I expect it should do.
Here an example:echo global.probe_settingsF1 60 ok echo global.probe_settingsF2 10 ok M558 P8 H{global.probe_settingsH} A{global.probe_settingsA} S0.003 F{global.probe_settingsF1}:{global.probe_settingsF2} C"^121.io2.in" T8000 B0 R0
I would expect "F60:10" now but I see "F60:60" when I query "M558":
Z Probe 0: type 8, input pin 121.io2.in, min interval 2ms, dive heights 2.0,2.0mm, probe speeds 60,60mm/min, travel speed 8000mm/min, recovery time 0.00 sec, heaters normal, max taps 30, max diff 0.00
Lets hardcode the 2nd F parameter to "33" while use the variable for the first one:
M558 P8 H{global.probe_settingsH} A{global.probe_settingsA} S0.003 F{global.probe_settingsF1}:33 C"^121.io2.in" T8000 B0 R0 ok m558 Z Probe 0: type 8, input pin 121.io2.in, min interval 2ms, dive heights 2.0,2.0mm, probe speeds 60,60mm/min, travel speed 8000mm/min, recovery time 0.00 sec, heaters normal, max taps 30, max diff 0.00
Lets hardcode both:
M558 P8 H{global.probe_settingsH} A{global.probe_settingsA} S0.003 F44:55 C"^121.io2.in" T8000 B0 R0 ok m558 Z Probe 0: type 8, input pin 121.io2.in, min interval 2ms, dive heights 2.0,2.0mm, probe speeds 44,55mm/min, travel speed 8000mm/min, recovery time 0.00 sec, heaters normal, max taps 30, max diff 0.00 ok
Lets use the variable for the 2nd F:
M558 P8 H{global.probe_settingsH} A{global.probe_settingsA} S0.003 F44:{global.probe_settingsF2} C"^121.io2.in" T8000 B0 R0 ok M558 Z Probe 0: type 8, input pin 121.io2.in, min interval 2ms, dive heights 2.0,2.0mm, probe speeds 44,10mm/min, travel speed 8000mm/min, recovery time 0.00 sec, heaters normal, max taps 30, max diff 0.00 ok
Let us reverse the usage of the variables for fun:
M558 P8 H{global.probe_settingsH} A{global.probe_settingsA} S0.003 F{global.probe_settingsF2}:{global.probe_settingsF1} C"^121.io2.in" T8000 B0 R0 ok m558 Z Probe 0: type 8, input pin 121.io2.in, min interval 2ms, dive heights 2.0,2.0mm, probe speeds 10,10mm/min, travel speed 8000mm/min, recovery time 0.00 sec, heaters normal, max taps 30, max diff 0.00 ok
You see what mean? M558 use the first variable for both "F" values if I use a variable at the first of the two values and it ignores the values behind the ":" whether it is a hardcoded value or a variable. But it works as expected if the value left of the ":" is hardcoded and not a variable.
Is that a bug or do I do something wrong with the variables here?
I tried to place both "F" parameters in a var as as string without success. (Which was not a surprise)
global F="10:22" ok M558 P8 H{global.probe_settingsH} A{global.probe_settingsA} S0.003 F{global.F} C"^121.io2.in" T8000 B0 R0 Error: at column 78: M558: expected numeric operand
Any ideas?
Cheers, Chriss
-
Can you share the results of M115 please?
-
@Chriss the syntax for using variables in GCode command parameters where the parameter takes multiple values changed in RRF 3.5. See https://docs.duet3d.com/en/User_manual/Reference/Gcode_meta_commands#use-of-expressions-within-gcode-commands for the correct syntax.
-
@Phaedrux said in Variables not working as expeccted in M558?:
Can you share the results of M115 please?
#FIRMWARE_NAME: RepRapFirmware for Duet 3 Mini 5+ FIRMWARE_VERSION: 3.5.2 ELECTRONICS: Duet 3 Mini5plus WiFi FIRMWARE_DATE: 2024-06-11 17:14:16
Sorry, my bad. Let me see what David has pointed out.
-
@dc42 Thanks... that makes sense that it is not working as expected than. And that explains the behaviour too. Let me get that together somehow.
-
-