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

    Macro to stop printing, run some code and then resume print

    Scheduled Pinned Locked Moved
    Firmware installation
    3
    5
    953
    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.
    • timmit99undefined
      timmit99
      last edited by

      I'm looking to mace a macro on my printer pause the current print, run a set of gcode commands that pulse a pin and delay, and then return to the print as if nothing has happened. The machine is a DuetWifi and DueX5

      I have created "Trigger2.g" in the "sys" folder and have added "M581 T2 S1 E2 C0" in config.g that will invoke trigger 2 on rising edge on E2 endstop regardless of print status. I have attached a switch to the E2 endstop connector on the dueX5 and when i have the "Trigger2.g" contain just

      M42 P100 S255
      G4 P10
      M42 P100 S0
      
      ```the pin is pulsed, however after adding more commands to the file the commands seem to be interlaced with the print commands and the print doesnt stop.
      

      [[language]]
      ;Switch to relative, lift Z 10 mm and return to absolute.
      G90
      G1 Z10
      G91

      G1 X100 Y300 F4800; Move to purge location

      ;Pulse to open the valve
      M42 P100 S255
      G4 P10
      M42 P100 S0

      G4 S60; Delay for 60 seconds

      ;Pulse to close the valve
      M42 P100 S255
      G4 P10
      M42 P100 S0

      G4 S5; Delay for pressure build up

      I'm stuck on how to proceed with pausing the print, running commands and then resuming the print properly.
      1 Reply Last reply Reply Quote 0
      • fmaundefined
        fma
        last edited by

        Try to add a M400 command at the beginning of your macro…

        Frédéric

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

          Use M25 to pause the print, then do the M42 commands, then M25 M24 to resume the print.

          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
          • timmit99undefined
            timmit99
            last edited by

            Resume with M25 or M24?

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

              M24.

              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