Pausing a print with LCD control of resume

I'm asking this here because there are both smart people in this Discourse and a variety of brands of printers and firmware (while this is primarily a Marlin question).

Cura has a series of post-processing gcode scripts one of which is Pause at Height. I've modified this to be Pause at Height or Layer which means I have a vested interest in it. In this script, gcode is injected into the stream that includes the sequence:

M104 Stemp ; Standby temperature
M0 ; Stop (press LCD to continue)
M109 Stemp ; Resume temperature.

While the Marlin documentation for M0 doesn't mention heaters or motors at all, the RepRap documentation for M0 says all heaters and motors are turned off which is not ideal (and makes the M104 command kinda useless). M0 is "resumed" by pressing the LCD button.

The only other pause command that I have found is G4 Sseconds (or G4 Pmilliseconds). The problem with this one is that the LCD button doesn't break out of the pause.

Have I missed something? I want an LCD button controlled pause that doesn't turn off the motors and heaters.

I've got one for that, methinks. I'll have to dig it up, though...

Noting what was on this printer (which worked as you described using the TFT):

  • OctoPrint Gcode script "afterPrintPaused" (noting that this now wouldn't work with Cura 3.3.1's awesome "relative extrusion mode" since it doesn't limit this to X/Y):
G91
G1 Z10
G90
  • OctoPrint Gcode script "beforePrintResumed":
G91
G1 Z-10
G90

Note that this is the open-sourced repository for the underlying TFT screen behavior, in case you wanted to be inspired. When the Pause button on the TFT is pressed, it ultimately throws control to OctoPrint's printer.toggle_pause_print() function presumably in octoprint/server/api/job.py or octoprint/printer/__init__.py.

I'm really not finding the underlying behavior, though.

Have you looked into M226?

I think I mentioned all of this in an earlier thread. A good pause might retract a little, move up, wait, then upon resume, it would heat back up, move back to where it's supposed to be, extrude to put things back to be primed, set the extrusion and move mode back to where it was before and take into account any sort of G92 for the extruder if it was formerly in abs mode.

G28 X0 Y0
G91
G1 Z10
G90                 ; Set XYZ back to Absolute
G1 E-1.00 F5400
M400                ; Wait for moves to finish
M25                 ; Pause Print
; And then you press Resume
G28 X0 Y0
G91                 ; Set XYZ to Relative Positioning
G1 Z-10             ; Lower Z 10mm to previous level
G90                 ; Set XYZ back to Absolute (dangerous)
G1 E1.00 F5400
G92 E0              ; Reset Extruder Origin
; Would be nice to run a macro here to return the extrusion mode from before
; now that Cura allows relative extrusion

M25 is Pause SD print so that isn't really applicable.

M226 would probably be very printer specific (would there be a pin number for the LCD knob?)

This post-processing script is part of Cura. There's no guarantee that OctoPrint is involved.

The general Internet consensus otherwise appears to be G4/dwell but that's not really optimal.

(The first and only time I ever used Cura's post-processing script for PauseAtZ or similar, it drilled my plastic bed with the hotend and I vowed never to use scripts again without reviewing them first.)

Here's that other thread, btw.