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

"M569: expected numeric operand" error.

Scheduled Pinned Locked Moved
DSF Development
3
12
374
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
    LindsayC
    last edited by 18 Dec 2024, 14:43

    I'm trying to use the object model "move.axes[X].drivers[0]" can and driver address to use in M569.X commands to setup closed loop (1hcl) during a home without having to specifically put it in the can address into the home file. Essentially I search for the drive letter, and when I've found it I want to set a variable that has the address. Unfortunately there doesn't seem to be away to turn the string "51.0" in the object model into 51.0 (float?) in the m569.X commands. For instance.

    var address = 51.0
    M569.1 P{var.address} T2 C1000 S200 R150 I50 D0.1 V500 A1 E4.0:2.0 D1;
    Will work fine.

    But below code gives a "M569: expected numeric operand" error.

    var ind = 0
    var driverAddress = 0.0

    while exists (move.axes[{var.ind}].letter) ;go through all axis in order till I find the correct one.
    if move.axes[{var.ind}].letter == "'a"
    set var.driverAddress = move.axes[{var.ind}].drivers[0]
    set var.ind = var.ind +1;

    M569.1 P{var.driverAddress} T2 C1000 S200 R150 I50 D0.1 V500 A1 E4.0:2.0 D1;

    undefined 1 Reply Last reply 19 Dec 2024, 15:47 Reply Quote 0
    • undefined
      dc42 administrators @LindsayC
      last edited by 19 Dec 2024, 15:47

      @LindsayC which firmware version? SBC or standalone mode?

      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 13 Jan 2025, 19:17 Reply Quote 0
      • undefined
        T3P3Tony administrators @dc42
        last edited by 13 Jan 2025, 19:17

        @dc42 @LindsayC I have recreated this issue in SBC and stand alone mode (3.6beta3 test build).

        SBC mode:
        var addr = move.axes[0].drivers[0]
        then
        echo var.addr
        returns:
        {object}

        attempting to do anything numerical with that variable results in
        Error: expected numeric operands

        Stand alone:
        var addr = move.axes[0].drivers[0]
        then
        echo var.addr
        returns:
        0.0

        attempting to do anything numerical with that variable results in
        Error: expected numeric operands

        www.duet3d.com

        undefined 1 Reply Last reply 13 Jan 2025, 19:20 Reply Quote 0
        • undefined
          dc42 administrators @T3P3Tony
          last edited by dc42 13 Jan 2025, 19:20

          @T3P3Tony that's expected. A driver ID is not a number because it holds both the CAN address and the driver number at that address. However, it should be allowed as the P operand in a M569 command.

          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 undefined 2 Replies Last reply 13 Jan 2025, 19:24 Reply Quote 0
          • undefined
            T3P3Tony administrators @dc42
            last edited by 13 Jan 2025, 19:24

            @dc42 Thanks I have tested that in Stand alone and SBC mode and confirm it works in standalone mode but not in SBC mode.

            Stand alone:

            M569 P{var.addr}
            Drive 0 runs forwards, active high enable, timing 4.0:4.0:1.3:1.3us, mode spreadCycle, ccr 0x08053, toff 3, tblank 1, thigh 200 (46.9 mm/sec), gs=32, iRun=0, iHold=0, current=25.391, hstart/hend/hdec 5/0/0, pos 8
            

            SBC:

            M569 P{var.addr}
            Error: M569: expected numeric operand
            

            www.duet3d.com

            1 Reply Last reply Reply Quote 0
            • undefined T3P3Tony moved this topic from Gcode meta commands 13 Jan 2025, 19:24
            • undefined
              dc42 administrators @dc42
              last edited by 13 Jan 2025, 19:24

              The OP didn't respond to my request for the firmware version. A change was made to improve this area within the last few months, which is why I asked.

              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 12 Feb 2025, 14:29 Reply Quote 0
              • undefined
                LindsayC @dc42
                last edited by LindsayC 2 Dec 2025, 14:30 12 Feb 2025, 14:29

                @dc42

                Sorry, just got this.

                It is on 3.5.3. In standalone mode.

                undefined 1 Reply Last reply 12 Feb 2025, 19:29 Reply Quote 0
                • undefined
                  dc42 administrators @LindsayC
                  last edited by dc42 2 Dec 2025, 19:29 12 Feb 2025, 19:29

                  @LindsayC thanks. Please upgrade to either 3.5.4 or 3.6.0-beta.4 and test again.

                  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 6 Mar 2025, 15:22 Reply Quote 0
                  • undefined
                    LindsayC @dc42
                    last edited by LindsayC 3 Jun 2025, 15:23 6 Mar 2025, 15:22

                    @dc42

                    Hi,

                    Upgraded to 3.6.0-rc.1.

                    And if I run this code:

                    var ind = 0
                    var driverAddress = 50.0
                    
                    while exists (move.axes[{var.ind}].letter) 
                        if move.axes[{var.ind}].letter == "'a"
                            set var.driverAddress = move.axes[{var.ind}].drivers[0]
                        set var.ind = var.ind +1;
                    
                    M569.1 P{var.driverAddress} T2 C1000 S200 R150 I50 D0.1 V500 A1 E4.0:2.0 D1;
                    

                    it fails with "Error: in file macro line 9 column 29: M569: expected numeric operand"

                    If I echo what the variable is. Ie this code:

                    var ind = 0
                    var driverAddress = 50.0
                    echo var.driverAddress
                    while exists (move.axes[{var.ind}].letter) ;go through all axis in order till I find the correct one.
                        if move.axes[{var.ind}].letter == "'a"
                            set var.driverAddress = move.axes[{var.ind}].drivers[0]
                        set var.ind = var.ind +1;
                    echo var.driverAddress
                    M569.1 P{var.driverAddress} T2 C1000 S200 R150 I50 D0.1 V500 A1 E4.0:2.0 D1;
                    

                    I get this from the console:
                    50.0
                    51.0
                    Error: in file macro line 9 column 29: M569: expected numeric operand

                    But if I run it with just a hard set driverAddress like below.

                    var ind = 0
                    var driverAddress = 51.0
                    echo var.driverAddress
                    
                    M569.1 P{var.driverAddress} T2 C1000 S200 R150 I50 D0.1 V500 A1 E4.0:2.0 D1;
                    

                    It works fine with no error.

                    Output from console:
                    51.0

                    This is all on a duet3 in standalone mode.

                    undefined 1 Reply Last reply 6 Mar 2025, 15:50 Reply Quote 0
                    • undefined
                      LindsayC @LindsayC
                      last edited by LindsayC 3 Jun 2025, 15:51 6 Mar 2025, 15:50

                      @LindsayC

                      Did a bit more digging into what the type is. If you run this code:

                      var ind = 0
                      var driverAddress = 50.0
                      echo var.driverAddress;
                      echo var.driverAddress ^"1";
                      echo var.driverAddress * 2
                      while exists (move.axes[{var.ind}].letter) ;go through all axis in order till I find the correct one.
                          if move.axes[{var.ind}].letter == "'a"
                              set var.driverAddress = move.axes[{var.ind}].drivers[0]
                          set var.ind = var.ind +1;
                      
                          
                      echo var.driverAddress
                      echo var.driverAddress ^"1";
                      echo var.driverAddress *2;
                      

                      You get:
                      50.0
                      50.01
                      100.0
                      51.0
                      51.01
                      Error: in file macro line 14 column 26: meta command: expected numeric operands

                      So the variable returned from the object model for the driver can address can be treated as a string but not as a float. While the original set address that does work for the P parameter can be treated as both a float and a string.

                      undefined 1 Reply Last reply 6 Mar 2025, 16:14 Reply Quote 0
                      • undefined
                        LindsayC @LindsayC
                        last edited by 6 Mar 2025, 16:14

                        @LindsayC

                        And finally if you run this code where you just pass a string to the P parameter.

                        var ind = 0
                        var driverAddress = "51.0"
                        M569.1 P{var.driverAddress} T2 C1000 S200 R150 I50 D0.1 V500 A1 E4.0:2.0 D1;
                        

                        You get this error message:
                        Error: in file macro line 3 column 27: M569: expected driver ID

                        Which is different to the error message you get if the variable is obtained from the object model.

                        undefined 1 Reply Last reply 16 Mar 2025, 09:55 Reply Quote 0
                        • undefined
                          dc42 administrators @LindsayC
                          last edited by 16 Mar 2025, 09:55

                          @LindsayC the reason is that the P parameter of M569 expects a driver ID, which looks like a float but is different. To make it easier to generate the P parameter in a macro, in recent versions of RRF we allow a float with a fractional part that is very close to a multiple of 0.1 to be converted to a driver ID. We can't say that it has to be exactly a multiple of 0.1 because 0.1 cannot be represented exactly as a binary float.

                          Expressions of any type can be converted to string.

                          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

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post
                          Unless otherwise noted, all forum content is licensed under CC-BY-SA