Duet3D Logo

    Duet3D

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Documentation
    • Order

    what does M400 exactly do?

    Tuning and tweaking
    3
    8
    300
    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.
    • matt3o
      matt3o last edited by

      The documentation says M400 waits for current moves to finish, but on the wiki it seems to be used as a "wait for anything to complete". For example in the sensorless homing example it is used after M913 like M400 would wait for the motors to update to the new current.

      So is M400 just waiting for motor moves or much more? If the former, is there a way to actually wait for any task to fully complete or G4 (dwell) would be the only way?

      fcwilt 1 Reply Last reply Reply Quote 0
      • fcwilt
        fcwilt @matt3o last edited by

        @matt3o said in what does M400 exactly do?:

        The documentation says M400 waits for current moves to finish, but on the wiki it seems to be used as a "wait for anything to complete". For example in the sensorless homing example it is used after M913 like M400 would wait for the motors to update to the new current.

        So is M400 just waiting for motor moves or much more? If the former, is there a way to actually wait for any task to fully complete or G4 (dwell) would be the only way?

        Good question.

        I've always taken the Duet documentation as it is stated - that it waits for moves to complete - not configuration commands and the like.

        I've SEEN folks use it to wait for configuration commands to complete and thought it was odd.

        Frederick

        Printers: A FT-5 with the 713 upgrade bits. A custom MarkForged style. A small Utilmaker style and a CoreXY from kits. Various hotends. Using Duets (2 and 3) running 3.4.1

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

          Moves pass through a queue so that a sequence of moves can be executed without stopping between them. That's why commands that affect the motor parameters either wait for all moves to stop before they are executed, or in the few cases where they don't it is advisable to use M400 before them.

          Another way to describe M400 is "wait for move queue to empty".

          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

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

            @dc42 said in what does M400 exactly do?:

            ...or in the few cases where they don't...

            JOOC are those few cases intentional or just something that perhaps needs to be fixed?

            Thanks.

            Frederick

            Printers: A FT-5 with the 713 upgrade bits. A custom MarkForged style. A small Utilmaker style and a CoreXY from kits. Various hotends. Using Duets (2 and 3) running 3.4.1

            1 Reply Last reply Reply Quote 0
            • matt3o
              matt3o last edited by

              also is it possible to know what are the commands that actually deplete the queue?

              for example I would expect G90/G91 to do that, same as M913 and M201.

              Thanks

              1 Reply Last reply Reply Quote 0
              • matt3o
                matt3o last edited by matt3o

                just FYI. I checked the source code, neither M913 or M201 execute a M400 automatically (LockMovementAndWaitForStandstill function). Many other Mxxx commands do.

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

                  @matt3o said in what does M400 exactly do?:

                  just FYI. I checked the source code, neither M913 or M201 execute a M400 automatically (LockMovementAndWaitForStandstill function). Many other Mxxx commands do.

                  M201 doesn't need to because it is a configuration command so it should not be used within a sequence of moves.

                  For M913 it is deliberate, so that M913 will take effect instantly if it is used within the power fail script. However, in recent firmware versions, M913 does wait for the movement queue to empty except when it is used within the power fail script.

                  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

                  matt3o 1 Reply Last reply Reply Quote 1
                  • matt3o
                    matt3o @dc42 last edited by

                    @dc42 said in what does M400 exactly do?:

                    M201 doesn't need to because it is a configuration command so it should not be used within a sequence of moves.

                    I lower the acceleration during the sensorless homing... is that not recommended?

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