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

    M400 vs G4 P0

    Scheduled Pinned Locked Moved
    Gcode meta commands
    2
    12
    1.1k
    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.
    • Tricep terryundefined
      Tricep terry
      last edited by

      Hi all,

      The duet wifi Gcode directory states "Finishes all current moves and and thus clears the buffer. That's identical to G4 P0"

      But at G4 I don't see that it will clear the buffer.

      I, therefore, wonder to implement G4 P0 in my Gcode as yesterday I had some weird results. My laptop went into sleep mode and the internet connection is not super stable. Therefore it might have disconnected and reconnected, not sure. Would in this case the command G4 P0 and M400 produce a different result?

      Sincerly,
      Max

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

        I've just checked, and currently G4 Pn with n <= 0 will not wait for movement to stop. I will change it so that it does in firmware 3.3 and later.

        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
        • Tricep terryundefined
          Tricep terry
          last edited by

          Woww that was a quick answer. Yhea I also observed that it does not, so I have tried to reduce it down to 1 ms but then found out that M400 worked better. However, during connectivity issues, is it possible that a lack of Gcode buffer results in weird stepper motor behavior?

          1 Reply Last reply Reply Quote 0
          • Tricep terryundefined
            Tricep terry
            last edited by

            G4 S1 will work, right? waiting just one millisecond is definitely good enough for me. I do not want to use M400 anymore cause I use a Duet wifi and it seems that clearing the buffer is causing me some troubles as the connection gets interrupted sometimes...

            Also, I couldn't find how big this Gcode buffer is... Today I had the issue that the printer needs to wait for a movement to finish, like:

            G91 G1 A-500 B-500 F200 ; running
            M400
            M118 "finished 1"
            M105 ; show temp
            G91 G1 A-1000 B-500 F200 ;running
            M400
            M118 "finished 2"
            M105 ; show temp

            However, the printer stopped after the first move command and showed a status of idle. It did not log the "finished 1" nor showed the temp...

            The only reason I can find is that the connection is interrupted and miscommunication has occurred...

            (connection gets interrupted because I use a second wifi dongle. One to connect with the printer, one to connect to the wifi of our university (not a very stable signal, our building is basically a Faraday cage...)

            Sincerly,
            Max

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

              @Tricep-terry said in M400 vs G4 P0:

              G4 S1 will work, right? waiting just one millisecond is definitely good enough for me. I do not want to use M400 anymore cause I use a Duet wifi and it seems that clearing the buffer is causing me some troubles as the connection gets interrupted sometimes...

              Waiting for the move buffer to empty (which M400, G1 P1 and G1 S1 all do) will not cause disconnections.

              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
              • Tricep terryundefined
                Tricep terry
                last edited by

                Oke now i'm a bit confused, sorry. What is exactly meant by the buffer in this case?

                if I would run the following code, the machine will wait until the move is finished before it will send the M118 command (this I want):

                G91 G1 A-1000 B-500 F200 ;running
                M400
                M118 "finished 2"

                if I would run the following line, the message is sent as the move starts (this I don't want).

                G91 G1 A-1000 B-500 F200 ;running
                M118 "finished 2"

                To me, this means that the duet sees the code in advance before it has finished the current line.

                Now I wonder if "clearing the buffer" means that it "forgets" the lines that will be running in the future. If that is the case, and a connection loss would occur (not due to M400 or G1 but just bad connectivity), what then would happen, and would this also happen if G4 S1 is used?

                1 Reply Last reply Reply Quote 0
                • Tricep terryundefined
                  Tricep terry
                  last edited by

                  @dc42 , Is there a maxium time a single line of code may take?
                  I just tried to run a script with really really slow motions (1 line takes about 1,2 hours). The printer does not continue to the second line but goes to idle without showing print finished in the console...

                  1 Reply Last reply Reply Quote 0
                  • Tricep terryundefined
                    Tricep terry
                    last edited by

                    I have done some testing and it seems that the issue is related to the duration of the execution of a single line of code. If I divide the same line into 10 separate lines of codes, it works.

                    @dc42 could you confirm if there is indeed an auto-sleep mode or something similar that will turn the printer status into idle if the duration for 1 line of code (gcode command) takes longer than a certain amount of time?

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

                      @Tricep-terry said in M400 vs G4 P0:

                      @dc42 could you confirm if there is indeed an auto-sleep mode or something similar that will turn the printer status into idle if the duration for 1 line of code (gcode command) takes longer than a certain amount of time?

                      There is no such timeout.

                      G4 S1 will delay for 1 second. G4 P1 will delay for one millisecond.

                      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
                      • Tricep terryundefined
                        Tricep terry
                        last edited by Tricep terry

                        Hmm well when splitting the Gcode up it does work and without it doesn't, but I do run out of any other reasons too why I observe this behavior. Thanks for your time and answers, it's really appreciated.

                        Whish you al the best,

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

                          What happens if you split it up into just 2 moves?

                          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

                          Tricep terryundefined 1 Reply Last reply Reply Quote 0
                          • Tricep terryundefined
                            Tricep terry @dc42
                            last edited by

                            @dc42 I will try today as well. pleased to screen-record the console of the duet web control application and run three replicas to see if it happens at the same time timepoint.

                            Max

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