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

    perform_simple_code is not working on DSF 3.5.2

    Scheduled Pinned Locked Moved Solved
    DSF Development
    2
    3
    142
    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.
    • pouryatorabiundefined
      pouryatorabi
      last edited by

      Hi,
      We were using this function to send some parameters from python to Duet:

      def updateGlobalVar(self,varname, val):
              cc = CommandConnection()
              cc.connect()
      
              ############ This is Ray's code to store data to the Duet side, There might be a better way to do that
              cc.perform_simple_code("if exists(global.{})".format(varname))
              cc.perform_simple_code(" set global.{}={}".format(varname,val))
              cc.perform_simple_code("else")
              cc.perform_simple_code(" global {}={}".format(varname,val))
              cc.close()
      

      It doesn't work anymore after I have upgraded to DSF 3.5.2.

      The previous version was:

      Board: Duet 3 MB6HC (MB6HC)
      DSF Version: 3.4.6
      Firmware: RepRapFirmware for Duet 3 MB6HC 3.4.6 (2023-07-21)

      chrishammundefined 1 Reply Last reply Reply Quote 0
      • chrishammundefined
        chrishamm administrators @pouryatorabi
        last edited by

        @pouryatorabi Meta G-code has been supported only within macro or job files (at least in SBC mode). If you need code flow in your custom code implementation, either move the corresponding code to a macro file and invoke that using M98, or fetch the object model using your cc in your function and check if the returned global part of the object model contains your varname, and then either set or define it.

        Duet software engineer

        pouryatorabiundefined 1 Reply Last reply Reply Quote 1
        • pouryatorabiundefined
          pouryatorabi @chrishamm
          last edited by

          @chrishamm I moved everything in a macro and now it works, thanks.

          1 Reply Last reply Reply Quote 0
          • dc42undefined dc42 marked this topic as a question
          • dc42undefined dc42 has marked this topic as solved
          • First post
            Last post
          Unless otherwise noted, all forum content is licensed under CC-BY-SA