How to insert a pause in gcode?

I've switched over from Marlin:  There, I could insert something like this into my gcode to trigger a pause:

G91                  ; Put in relative mode
G1 Z10 ; Lower bed by 10mm
G90 ; Put back in absolute mode
G1 X0 Y0 ; Zero (home) the X & Y
M0 Click To Restart ; Pause and wait for the user
G91 ; Put in relative mode
G1 Z-10 ; Raise the bed back up 10mm
G90 ; Put back in absolute mode
On restart is shoots back to the last spot it was at an keeps printing.

During that pause I'd reload my filament.  I know that Repeteir has a reload filament option via the LCD, but it's not currently working for me:

Plus, pausing via the LCD isn't accurate:  I do prints where I need absolute layer height control over the pause location.
I saw that M0 doesn't seem to be supported by Repetier:  Is there something similar available?  I have been searching, but haven't found anything.

Again, I don't wan to pause via the LCD or via a front end (S3D or Repetier Host) : I need to insert these surgically into my gcode as needed.



  • I saw there is a M25 that will pause an SD print, but this is to be sent to the running machine via host software, not added to the gcode directly (since you have to unpause it manually via M24).  The RepRap wiki suggest using M226 to do a gcode initiated pause, but this isn't supported by Repetier, or not in that fashion:  In Repetier it's "wait for pin state".  Maybe if I knew the 'pin' of the rotary encoder I could then query for it when pressed?

  • If you print using Repetier-Host/server just add
    ;@pause Do something

    Then you can control printer through host/server until you continue.

    M600 would be a pause for filament change if you set it to do it on lcd.
  • edited May 2016
    I'll give M600 a shot:  I hadn't, since the reprapwiki say that it is unsupported by Repetier:
    And it didn't seem to be listed at all here:

    Of course you know far better than I what's supported :)
    Is there another place that has more up to date gcodes for use in Repetier?
  • Inserting M600 into the gcode did cause it to pause for filament change.  So that's good. But, the exact same problem happened after, from my other post:
    Upon print restart, it goes to the wrong spot on the platform to continue printing.
    From the other post issue, I'm guessing the LCD "pause for filament change" is executing M600(?) and whatever is happening in that code is causing the weird offset when the print restarts based on the observed behavior?
  • edited May 2016
    I tracked this down:
    Which lists M401 & M402 to store, and restore the positions.  Seems like it should fix the 'offset' issue.   I add this to my Gcode at the line I want to pause\reload filament:

    M600 0 0 0 0 0

    So it does pause, do the filament change, but once again, returns to the last spot it was printing (yes!), them jumps to a new spot a few cm in front of the print (no!) just before it resumes printing.  
  • AAAAaaand solved:
    The 're-homing' step, after the filament was loaded, was bugging me.  So I went back into the configuration tool:  In the features tab under the "Filament Change" section, I set the "Homing after Filament Change" to "No Homing".
    That did it.  Now, all I have to stick in my gcode is a M600 at the line I want to pause at, and everything works.
    And now that it actually works, it's quiet easier\better than the Marlin method, since it's only a single line.
  • Actually the homing is a good idea as you might change extruder position. But it might in deed add a offset, also I do not understand why it should add z height to y position. Will check if I see something there.
  • I agree that homing is a good idea:  I was just trying to troubleshoot all possibilities of what could be causing it to fail and finally found that was it.
    I don't believe it's a 'z height added to y position' issue though : All of these tests were done on a 20mm cube, pausing at the end of layer 3, so it would have been .6mm on Z.  The offset looked like nearly 20mm on Y,.... maybe 18ish.
  • HI,
    I've tested solution with M226 and encoder click.
    It works!
    I have ArduinoDue board and encoder click is on Pin 48 so code is:
    M226 P48 S0
    I'm testing and it looks like:
    #define PAUSE_END_COMMANDS ""
    do not work with g-code pause so it is good with M226 put some commands directly in g-code to move nozzle somewhere to prevent melting. It would be also good to home X/Y before resume.

  • PAUSE_START_COMMANDS is used by sd card pause/continue only.
Sign In or Register to comment.