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

What is the correct Mcode to restart a completed print job?

Scheduled Pinned Locked Moved
Tuning and tweaking
7
12
646
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.
  • undefined
    grabercars
    last edited by 16 May 2020, 16:37

    Hi guys,

    I've been printing the same plate of mask buckles in production mode over and over with no issues. It would be great if I had a physical push button on the printer to start the last print over again after clearing the bed instead of having to wake the pc from sleep, wait for it to reconnect to the wifi and then click the restart print button in the DWC.

    I understand how to set up physical buttons to run macros, but what is the Mcode to restart a print that completed successfully? (I did look for this but maybe I'm going blind? ...)

    Thanks!

    Steve Graber

    Board: Duet WiFi 1.02 or later
    Firmware: RepRapFirmware for Duet 2 WiFi/Ethernet 2.02(RTOS) (2018-12-24b1)
    Duet WiFi Server Version: 1.23

    1 Reply Last reply Reply Quote 0
    • undefined
      bot
      last edited by 16 May 2020, 16:41

      It seems like M24 might be the gcode you're after.

      You may have to send M23 before, to reset the loaded file. You may even have to send M23 <filename> but maybe not. Try simply M24. If that doesn't work, try M23 then M24.

      *not actually a robot

      undefined 1 Reply Last reply 16 May 2020, 16:42 Reply Quote 0
      • undefined
        grabercars @bot
        last edited by 16 May 2020, 16:42

        @bot Why thank you Bot (not actually a bot)!

        I'll give it a try as soon as the current print is finished

        ✌

        1 Reply Last reply Reply Quote 0
        • undefined
          grabercars
          last edited by 16 May 2020, 20:05

          Unfortunately, M24 and M23 commands both expect a filename to be included with the command. So that's a no-go.

          The 'Start Again' button in the DWC uses M32 command but it too is asking for the filename, and in the DWC the command+filename is written out directly to the html page when it's generated.

          It appears that any macro created to restart a completed job using the M23, 24 or 32 commands would need to have the filename of the currently selected file written to it each time a print was selected. Or maybe the filename would need to be held in memory.

          Unless there is some other option.

          1 Reply Last reply Reply Quote 0
          • undefined
            dc42 administrators
            last edited by 17 May 2020, 10:09

            In RRF 3.1 there is a property called job.lastFileName in the object model that holds the name of the last file printed. It will be null if no file has been printed since the last power up or reset.

            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

            undefined 1 Reply Last reply 18 May 2020, 04:37 Reply Quote 0
            • undefined
              grabercars
              last edited by 17 May 2020, 14:37

              It struck me last night as I was falling asleep that I wasn't seeing the super basic and easy way to accomplish what I want.

              The best overall solution would of course be to set up a dynamic macro to repeat any currently selected print via a physical button. And that would require knowing the current print file name and path which would require upgrading to RRF3.1. That way the button would be maintenance free.

              In my case I'm printing a known file over and over and I don't have time to upgrade right now. So I'll simply hard-code the macro with the filename I want to reprint. If that file ever changes due to versioning, etc. I'll just edit the macro.

              M32 "0:/gcodes/Cerb400_1-1.0mmNozz/PETG/30xMB_V4.0-Plated.gcode"

              When I finalize the physical button housing attached to the printer it will include several other momentary push buttons for preheat, motors off, home and board reset. Maybe I'll include a little clip to hold a post-it with the macro-filename listed on it.

              undefined 1 Reply Last reply 17 May 2020, 18:07 Reply Quote 1
              • undefined
                deckingman @grabercars
                last edited by 17 May 2020, 18:07

                @grabercars said in What is the correct Mcode to restart a completed print job?:

                It struck me last night as I was falling asleep that I wasn't seeing the super basic and easy way to accomplish what I want.........................

                ................When I finalize the physical button housing attached to the printer it will include several other momentary push buttons for preheat, motors off, home and board reset. Maybe I'll include a little clip to hold a post-it with the macro-filename listed on it.

                Nice idea. But while we are in "super basic and easy" mode, have you considered using a PanelDue? https://www.duet3d.com/PanelDue

                That would do everything you want and more, without having to write all those other macros or wire any external buttons to pins.

                Ian
                https://somei3deas.wordpress.com/
                https://www.youtube.com/@deckingman

                undefined 1 Reply Last reply 17 May 2020, 20:54 Reply Quote 0
                • undefined
                  zapta @deckingman
                  last edited by 17 May 2020, 20:54

                  @deckingman said in What is the correct Mcode to restart a completed print job?:

                  That would do everything you want and more...

                  Can you elaborate? Let's say that I sent a file to the duet from my slicer with 'auto start' option. Once the first print is completed, how do I print another one from the PanelDue?

                  undefined 1 Reply Last reply 17 May 2020, 21:13 Reply Quote 0
                  • undefined
                    deckingman @zapta
                    last edited by 17 May 2020, 21:13

                    @zapta said in What is the correct Mcode to restart a completed print job?:

                    @deckingman said in What is the correct Mcode to restart a completed print job?:

                    That would do everything you want and more...

                    Can you elaborate? Let's say that I sent a file to the duet from my slicer with 'auto start' option. Once the first print is completed, how do I print another one from the PanelDue?

                    I was responding to the OP's intention of using a number of buttons to initiate various macros. This isn't about what you would want to do in a hypothetical case, it's about what the OP wants and intends to do. He intends to run a macro to re-print an object by initiating that macro with a physical button wired to an input pin. He could run that macro from the PanelDue.

                    His other use cases are quote "When I finalize the physical button housing attached to the printer it will include several other momentary push buttons for preheat, motors off, home and board reset". All of these, he could do with the PanelDue instead of using a number of push buttons.

                    Ian
                    https://somei3deas.wordpress.com/
                    https://www.youtube.com/@deckingman

                    undefined 1 Reply Last reply 17 May 2020, 22:32 Reply Quote 0
                    • undefined
                      zapta @deckingman
                      last edited by zapta 17 May 2020, 22:32

                      @deckingman said in What is the correct Mcode to restart a completed print job?:

                      I was responding to the OP's intention of using a number of buttons to initiate various macros. This isn't about what you would want to do in a hypothetical case, it's about what the OP wants and intends to do.

                      Thanks for the clarification. I think that the OP has similar use case to mine. Starting a print from a computer and then having a simple print-again function near the printer. I am not sure that PanelDue has that capability. (There was somewhere else a discussion about not have a fixed gcode sequence that can reprint the last print, otherwise a macro would achieve that).

                      1 Reply Last reply Reply Quote 0
                      • undefined
                        garyd9 @dc42
                        last edited by 18 May 2020, 04:37

                        @dc42 said in What is the correct Mcode to restart a completed print job?:

                        In RRF 3.1 there is a property called job.lastFileName in the object model that holds the name of the last file printed. It will be null if no file has been printed since the last power up or reset.

                        ; todo: detect if job.lastFileName is null
                        ; if state.status == "idle" // doesn't work. state.status returns "busy" while in a macro
                        echo "Repeating print of " ^ job.lastFileName
                        M23 job.lastFileName ; select the file to be printed as the filename of the last job
                        M24 ; start printing the selected file

                        The one thing missing here is a way to detect if the printer is currently doing something else. Obviously, this macro shouldn't run if there's already a print in progress. However, I don't see a good way to detect that. "if state.status == "idle"" doesn't work because "state.status" seems to return "busy" while running a macro.

                        That leads to the question of: Is there any way for a macro to detect the state of the printer using the object model?

                        "I'm not saying that you are wrong - I'm just trying to fit it into my real world simulated experience."

                        undefined 1 Reply Last reply 18 May 2020, 08:56 Reply Quote 0
                        • undefined
                          chrishamm administrators @garyd9
                          last edited by 18 May 2020, 08:56

                          @garyd9 It does return 'busy' when a macro is being executed (except when running daemon.g) but it will remain 'processing' while a print is in progress.

                          Duet software engineer

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