@RichL
Could you use an external interface, such as an arduino executing a json command, to flag?
As a point of interest, ‘M’ commands aren’t processed the same way as ‘G’ commands: “Grbl puts all stepper commands into a buffer that is executed by the
Stepper.c interrupt routine
– Codes like M7, M8, M9, M112, etc… do not get put into this buffer
– The buffer takes time to execute in the backgroud
– A code like the M9 (air off command) will get executed BEFORE the
buffer of X,Y (and Z) commands has finished executing”
This is so that your emergency stop, etc. is immediately handled, rather than sitting in the serial queue.
Maybe using a comment line may work?