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

    Yet another type of M291 needed, I think...

    Scheduled Pinned Locked Moved
    Gcode meta commands
    3
    9
    202
    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.
    • mikeabuilderundefined
      mikeabuilder
      last edited by mikeabuilder

      I'm working on a macro where I want to put a non-blocking M291 message on the screen that will be cancelled when another M291 is issued. My super-simple example is below

      M291 S1 T0  P"This is the first message, with S=1, T=0"
      echo "got here"
      M291 S1 T5 P"This is the second message, with S=1, T=5"
      

      The first M291 puts up a non-blocking message with no timeout. And I see the echo command displayed while the message is still on screen.

      When I finally close the first message, the second is displayed for the requested 5 seconds.

      I think the behavior happening is that the gcode execution stream is non-blocking, but the message display stream remains blocking. If that makes sense.

      The behavior I expected (and would like) is for the second message to force closure of the first message.

      Maybe this is a case where I should have an M292 in my macro, just before line 3?

      T3P3Tonyundefined 1 Reply Last reply Reply Quote 0
      • T3P3Tonyundefined
        T3P3Tony administrators @mikeabuilder
        last edited by

        @mikeabuilder said in Yet another type of M291 needed, I think...:

        Maybe this is a case where I should have an M292 in my macro, just before line 3?

        try it?

        www.duet3d.com

        1 Reply Last reply Reply Quote 0
        • mikeabuilderundefined
          mikeabuilder
          last edited by

          Answering my own query, but asking if I'm doing something risky.

          This behaves as I want, using m292 to

          M291 S1 T0  P"This is the first message, with S=1, T=0"
          echo "got here"
          g4 s5
          m292 p0
          M291 S1 T5 P"This is the second message, with S=1, T=1"
          

          I added the M292 just before the new message.

          1 Reply Last reply Reply Quote 0
          • mikeabuilderundefined
            mikeabuilder
            last edited by

            @T3P3Tony - thanks for the vote of encouragement to give it a go. If there are not obvious issues to using the M292, I'm good to go.

            T3P3Tonyundefined 1 Reply Last reply Reply Quote 0
            • T3P3Tonyundefined
              T3P3Tony administrators @mikeabuilder
              last edited by

              @mikeabuilder not sure how it might interact with DWC cancelling a message box, thats one for @chrishamm

              www.duet3d.com

              1 Reply Last reply Reply Quote 0
              • mikeabuilderundefined
                mikeabuilder
                last edited by mikeabuilder

                Now if I cancel the message box myself, I get an error when the M292 runs. I'll look for a way to add an if to see if there is an existing message box.

                The object model has an array "messages" but it is not available in standalone mode.

                T3P3Tonyundefined OwenDundefined 2 Replies Last reply Reply Quote 0
                • T3P3Tonyundefined
                  T3P3Tony administrators @mikeabuilder
                  last edited by

                  @mikeabuilder check the OM, i think there maybe something in there. Also have a look at the 3.5 release notes as M291 behaviour has changed.

                  www.duet3d.com

                  1 Reply Last reply Reply Quote 0
                  • mikeabuilderundefined
                    mikeabuilder
                    last edited by mikeabuilder

                    From the 3.5 Beta2 changelog:

                    • M291 messages are now queued. When a M291 command is executed the new message is added to the end of the queue, and any non-blocking messages already in the queue have their timeouts reduced to 1 second. If the queue is already full then the oldest non-blocking message is cancelled, or if there are no non-blocking messages in the queue, the oldest message is cancelled. The queue length is currently 8 messages.

                    In my test initial three line macro, it does not seem like the first non-blocking message is getting it's timeout reduced to 1. I tried changing the timeout on the first message to T=9999, and the timeout does get reduced to 1, so I have my solution. I'll just set the first timeout to a very long time. Maybe a non-blocking timeout t=0 is a special case for the timeout length reduction thing.

                    1 Reply Last reply Reply Quote 0
                    • OwenDundefined
                      OwenD @mikeabuilder
                      last edited by

                      @mikeabuilder
                      You can check if the messagebox array is null. If it's not null, then a message box is being displayed.

                      if state.messageBox!=null
                         M292 ; cancel message box
                      
                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post
                      Unless otherwise noted, all forum content is licensed under CC-BY-SA