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

    Waiting for a move to complete before returning OK

    Scheduled Pinned Locked Moved
    General Discussion
    3
    6
    298
    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.
    • jwiloundefined
      jwilo
      last edited by jwilo

      Hypothetical one here, not for printing or CNC use etc, just a 'what if' in my mind.

      Say for example we're controlling a cartesian machine via Telnet, each time we issue a G1, G2, G3 etc - "ok" is returned as soon as the message is decoded, and the move is added to the motion queue.

      If the machine sending commands to the controller needs to wait, to know when those moves are completed, before it does something else, how would we achieve that?

      I see "M400: Wait for current moves to finish", but that does not control the return of "ok", does it?

      In 'pseudo actions', this is what I'm imagining:

      1. PC sends G1 move
      2. controller sends 'ok' back to confirm decode of message
      3. controller forms move, move finishes
      4. controller sends back something that says "I'm done"

      Is this possible?

      A possible solution I can think of is to:

      G1 X100 Y100 F1000 ; Issue move command
      M400 ; Wait for it to finish
      M117 P4 S"Done" L0 ; Send message via Telnet, which is the P4 argument. S is the message. L0 means don't log this message.

      Phaedruxundefined 1 Reply Last reply Reply Quote 0
      • Phaedruxundefined
        Phaedrux Moderator @jwilo
        last edited by

        @jwilo said in Waiting for a move to complete before returning OK:

        G1 X100 Y100 F1000 ; Issue move command
        M400 ; Wait for it to finish
        M117 P4 S"Done" L0 ; Send message via Telnet, which is the P4 argument. S is the message. L0 means don't log this message.

        This makes sense to me.

        Z-Bot CoreXY Build | Thingiverse Profile

        jwiloundefined 1 Reply Last reply Reply Quote 0
        • jwiloundefined
          jwilo @Phaedrux
          last edited by

          I ran some tests tonight, rather it appears to be simpler than this.

          Combining M400 onto the same line, delays the return of "ok", i.e.

          G1 X100 Y100 F1000 M400
          

          However, what if you want to receive the "ok" as confirmation of receipt, followed by "done". The following appears to do it, but if you don't send the M400 before the move finished, it doesn't work, which for very short moves is quite likely...

          G1 X100 Y100 F1000
          M400 M117 P4 S"Done" L0
          
          dc42undefined 1 Reply Last reply Reply Quote 1
          • dc42undefined
            dc42 administrators @jwilo
            last edited by

            @jwilo of possible use to you is nanoDLP compatibility mode. See https://docs.duet3d.com/en/User_manual/Reference/Gcodes#m555-set-compatibility. In this mode, after any G0 or G1 command that is not in a macro file, RRF waits for the move to complete and then reports "Z move comp" and then "ok".

            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

            jwiloundefined 1 Reply Last reply Reply Quote 0
            • jwiloundefined
              jwilo @dc42
              last edited by

              @dc42 thanks David, does that apply to any axis, not just Z? I may be reading too much into the meaning of the "Z move comp" response...

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

                @jwilo I am currently out of the office but AFAIR it applies to all movement.

                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