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

    M291 issued from a plugin doesn't show anything on the PanelDue

    Scheduled Pinned Locked Moved
    DSF Development
    2
    6
    353
    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.
    • Ant1undefined
      Ant1
      last edited by Ant1

      I am creating a plugin which intercepts a certain M-code (M1000 in my case), and then performs a bunch of things with the machine. At some point, it needs to open a message box using M291. It does so using CommandConnection.perform_simple_code('M291 ...').

      Depending on how the plugin is called, the message box doesn't get showed on the PanelDue. Here is what I have observed:

      • When I call M1000 from the command console on the PanelDue, which triggers the plugin, the message box is shown, as expected.
      • If M1000 is wrapped in a macro, which is ran from the PanelDue, the plugin is triggered, but the message box isn't shown on the PanelDue - only in the web interface.

      Expected:
      M291 should open the message box on the PanelDue in all cases, otherwise it is annoying because I need to open a web interface to run this macro.

      Ant1undefined 1 Reply Last reply Reply Quote 0
      • Ant1undefined Ant1 referenced this topic
      • Ant1undefined
        Ant1 @Ant1
        last edited by

        @Ant1 As a note, this issue happens with DSF 3.5.2. I tried to reproduce it with DSF 3.5.1, but the issue doesn't happen and the message gets shown properly on the PanelDue, so I think that the issue comes from the update.

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

          @Ant1 Please share the code which intercepts M1000 and calls M291. Does M409 K"state" F"d99fn" show a proper messageBox value when it is not displayed on PanelDue?

          Duet software engineer

          Ant1undefined 1 Reply Last reply Reply Quote 0
          • Ant1undefined
            Ant1 @chrishamm
            last edited by Ant1

            @chrishamm Sorry for the later reply on this, I forgot about it and got no notifications!

            Here is a minimal setup that reproduces my issue. In this setup, I use a separate connection to intercept and to send commands. If I use a single intercept connection, the issue still happens, but less often.

            Also, note that the message box shows up on the PanelDue in about 50% of the cases when sending M2000. But in the the other cases, the message box only pops up in the web interface. I didn't manage to see if it was correlated to something else, as it seemed pretty random to me.

            #!/usr/bin/python3
            from dsf.connections import InterceptConnection, InterceptionMode, CommandConnection
            from dsf.object_model.messages import MessageType
            
            
            if __name__ == "__main__":
                try:
                    intercept = InterceptConnection(InterceptionMode.PRE, filters=['M2000'])
                    command = CommandConnection()
                    command.connect()
                    intercept.connect()
            
                    while True:
                        code = intercept.receive_code()
                        try:
                            if code.short_str() == 'M2000':
                                command.perform_simple_code('M291 S2 P"Test" X1 Y1 Z1')
                                print(command.perform_simple_code('M409 K"state" F"d99fn"'))
                                intercept.resolve_code(MessageType.Success)
                        except Exception as e:
                            intercept.resolve_code(MessageType.Error, str(e))
                finally:
                    intercept.close()
                    command.close()
            

            The output of M409 K"state" F"d99fn" is the following:

            {"key":"state","flags":"d99fn","result":{"currentTool":2,"gpOut":[],"laserPwm":null,"msUpTime":646,"status":"idle","time":"2024-10-14T11:27:13","upTime":2238}}
            

            I don't see any messageBox value inside it.

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

              @Ant1 state.messageBox isn't a live key (f flag), so it is omitted. Perhaps better use v instead of f in the M409 flags and check again.

              Duet software engineer

              Ant1undefined 1 Reply Last reply Reply Quote 0
              • Ant1undefined
                Ant1 @chrishamm
                last edited by Ant1

                @chrishamm

                With the v flat, the output is the following:

                {"key":"state","flags":"d99vn","result":{"atxPower":null,"atxPowerPort":null,"beep":null,"currentTool":0,"deferredPowerDown":null,"displayMessage":"","gpOut":[],"laserPwm":null,"logFile":"","logLevel":"off","machineMode":"FFF","macroRestarted":false,"messageBox":null,"msUpTime":275,"nextTool":0,"powerFailScript":"M913 X0 Y0 G91 M83 G1 Z3 E-5 F1000","previousTool":1,"restorePoints":[{"coords":[0,0,0,0,0],"extruderPos":0,"fanPwm":0,"feedRate":50.0,"ioBits":0,"laserPwm":null,"toolNumber":-1},{"coords":[140.418,136.962,248.086,2.000,5.000],"extruderPos":8.9,"fanPwm":1.00,"feedRate":30.0,"ioBits":0,"laserPwm":null,"toolNumber":0},{"coords":[385.000,122.605,249.936,2.000,5.000],"extruderPos":-10.0,"fanPwm":1.00,"feedRate":108.3,"ioBits":0,"laserPwm":null,"toolNumber":1},{"coords":[0,0,0,0,0],"extruderPos":0,"fanPwm":0,"feedRate":50.0,"ioBits":0,"laserPwm":null,"toolNumber":-1},{"coords":[0,0,0,0,0],"extruderPos":0,"fanPwm":0,"feedRate":50.0,"ioBits":0,"laserPwm":null,"toolNumber":-1},{"coords":[0,0,0,0,0],"extruderPos":0,"fanPwm":0,"feedRate":50.0,"ioBits":0,"laserPwm":null,"toolNumber":-1}],"startupError":null,"status":"idle","thisActive":true,"thisInput":8,"time":"2024-12-05T14:41:38","upTime":21767}}
                

                Still no messageBox key inside it...

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