So far this has worked well for me, the only issue is I do have to push the button until the command is recognized, so if the printer is doing a long line, it won't catch unless I have the button down at the end of the line before the next command goes in. This is probably expected and its not that big an issue in practice.
@nightowl999
This is all the magic from the config.g side, its the "T2" that sets it to run the second trigger file (trigger2.g) when the button is pushed.
;Pause Button
M950 J9 C"io8.in"
M581 P9 T2 S1
;if !exists global.PausePress ; if it's not created we do so now
global PausePress = false
trigger2.g, its the M24 and M25 that actually call the pause and resume files :
;echo "called at " ^ state.time
G4 P1 ; delay 10ms to debounce
if sensors.gpIn[9].value=1
;echo "debounce"
M99 ; break out if sensor value is zero again (bouncing)
if job.file.fileName !=null ; if there's a job filename then it's reasonably safe to say we are printing
if global.PausePress == false ; the button hasn't been pressed so we'll pause
;echo "Pause"
M25
else
;echo "resume"
M24
turning the light on and off was the easy part, just turn the pin for that on or off:
M42 P8 S0 ;LED off
set global.PausePress = !global.PausePress ; toggle the value from whatever it was before use "not"
and its magic in config.g:
;output for pause LED
M950 P8 C"io8.out"
M42 P8 S0 ; off by default