• Tags
  • Documentation
  • Order
  • Register
  • Login
Duet3D Logo Duet3D
  • Tags
  • Documentation
  • Order
  • Register
  • Login

Variables not working as expeccted in M558?

Scheduled Pinned Locked Moved Solved
General Discussion
3
5
133
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • undefined
    Chriss
    last edited by 17 Sept 2024, 02:38

    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

    undefined 1 Reply Last reply 17 Sept 2024, 06:38 Reply Quote 0
    • undefined
      Phaedrux Moderator
      last edited by 17 Sept 2024, 04:36

      Can you share the results of M115 please?

      Z-Bot CoreXY Build | Thingiverse Profile

      undefined 1 Reply Last reply 17 Sept 2024, 08:40 Reply Quote 0
      • undefined
        dc42 administrators @Chriss
        last edited by 17 Sept 2024, 06:38

        @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.

        Duet WiFi hardware designer and firmware engineer
        Please do not ask me for Duet support via PM or email, use the forum
        http://www.escher3d.com, https://miscsolutions.wordpress.com

        undefined 1 Reply Last reply 17 Sept 2024, 08:43 Reply Quote 0
        • undefined
          Chriss @Phaedrux
          last edited by 17 Sept 2024, 08:40

          @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.

          1 Reply Last reply Reply Quote 0
          • undefined
            Chriss @dc42
            last edited by 17 Sept 2024, 08:43

            @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.

            1 Reply Last reply Reply Quote 1
            • undefined Phaedrux marked this topic as a question 17 Sept 2024, 16:36
            • undefined Phaedrux has marked this topic as solved 17 Sept 2024, 16:36
            1 out of 5
            • First post
              1/5
              Last post
            Unless otherwise noted, all forum content is licensed under CC-BY-SA