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

    3.5.0-beta.4 Unknown variable error with M99

    Scheduled Pinned Locked Moved
    Beta Firmware
    4
    5
    184
    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.
    • stuartofmtundefined
      stuartofmt
      last edited by stuartofmt

      Below is a skeletal macro (/sys/M3000). When called with M3000 (no parameters) it throws an error.

      Screenshot 2023-08-03 112300.png

      Note that it reports the error at line 10 as opposed to line7

      When called with abort instead of M99 , it completes without error.

      What is the expected behavior of M99 ?

      ; macro  /sys/M3000.g
      ; check if B parameter sent
      if !exists(param.B)
        M99
        ;abort "M3000  -- No parameter was passed."
        
      set var.Bparam = param.B
      
      if var.Bparam = "Init"
          echo "Init"
      
      elif var.Bparam = "Clear"
          echo "Clear"
      
      elif var.Bparam = "Del"
          echo "Del"
      else
          echo "Ordinary"
      

      I stumbled on this trying to use M99 like a 'return' statement (several in the same macro). e.g.

      if 
        <do something>
        M99
      
      if
        <do something>
         M99
      
      if
        <do something>
         M99
      
      <do something>
      

      I ended up refactoring (as per the example) as an if - elif -elif .... structure to eliminate the use of M99 because the behavior was unclear.

      gloomyandyundefined dc42undefined chrishammundefined 3 Replies Last reply Reply Quote 0
      • gloomyandyundefined
        gloomyandy @stuartofmt
        last edited by

        @stuartofmt What board is this running on?

        stuartofmtundefined 1 Reply Last reply Reply Quote 0
        • stuartofmtundefined
          stuartofmt @gloomyandy
          last edited by

          @gloomyandy said in 3.5.0-beta.4 Unknown variable error with M99:

          @stuartofmt What board is this running on?

          SBC

          Pi - Duet3D Buster Image. Did a sudo apt update && sudo apt dist-upgrade today

          bc90750d-d6de-4c85-a512-7ae56398ee1e-image.png

          23bb0236-60c7-46a9-af1b-fc5fa51193fa-image.png

          1 Reply Last reply Reply Quote 0
          • dc42undefined
            dc42 administrators @stuartofmt
            last edited by

            @stuartofmt this works for me in standalone mode, so I think is has to do with M99 processing in DSF. I'll ask @chrishamm to take a look.

            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
            • chrishammundefined
              chrishamm administrators @stuartofmt
              last edited by

              @stuartofmt Thanks for reporting this, I could reproduce and fix this.

              Duet software engineer

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