• Tags
  • Documentation
  • Order
  • Register
  • Login
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.
  • undefined
    timmit99
    last edited by 18 Dec 2017, 22:07

    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
    • undefined
      fma
      last edited by 19 Dec 2017, 09:17

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

      Frédéric

      1 Reply Last reply Reply Quote 0
      • undefined
        dc42 administrators
        last edited by 19 Dec 2017, 13:07

        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
        • undefined
          timmit99
          last edited by 20 Dec 2017, 14:32

          Resume with M25 or M24?

          1 Reply Last reply Reply Quote 0
          • undefined
            dc42 administrators
            last edited by 20 Dec 2017, 15:17

            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
            1 out of 5
            • First post
              1/5
              Last post
            Unless otherwise noted, all forum content is licensed under CC-BY-SA