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

    Help understanding M26 and M27

    Scheduled Pinned Locked Moved
    Firmware developers
    2
    3
    377
    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.
    • HebigTundefined
      HebigT
      last edited by

      I have an application where I'll need to store the SD position and then reference that position later on (for instance, at each layer-change)

      Is M27 and M26 the correct way to do this?

      The GCode dictionary entry for M26 mentions that the SD position is referenced by the number of bytes in the print file.

      Does referencing the number of bytes ensure that the position is always at the start of a line?

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

        @HebigT to save the position I suggest you do the following:

        • If you want to save it using a command in the print file itself, use M400 to wait until movement stops. That will ensure that the file position is the start of the line following the M400 command.
        • Retrieve object model variable job.filePosition
        • Save it in a global variable, or wherever else you will need it.

        If you do this from within a macro, then the position will be the start of the line following the call to the macro.

        The M27 command only exists for Marin compatibility and is deprecated. Its purpose was to give an indication of how much of the job has completed when the controller is fed bytes over a USB or serial link. However, I think it should give the same result.

        The M26 command is designed only to be used between a M23 command (which specifies a file to print) and a M24 command (which starts printing it). Currently, it will not change the file position of a file that is already being printed.

        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

        HebigTundefined 1 Reply Last reply Reply Quote 1
        • HebigTundefined
          HebigT @dc42
          last edited by

          @dc42 Thank you for the detailed explanation!

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