I do a lot of tool changes using M0 to pause the program, and a resume button to continue the job after the bit has been changed. This works well, but I just added a spindle relay, and have a problem using it for tool changes.
Running this gcode works as expected. Assuming we start at zero, it moves 10mm on the X axis, pauses until I hit resume, and then moves another 10mm (total of 20mm from zero) along the X axis.
That's how my gcode that requires a bit change has worked in the past. Now, if I try to add in spindle control functionality, things break. See this:
The above snippet seems like it should turn the spindle on, move 10mm along the X axis, wait for me to hit resume, then turn the spindle off. Unfortunately, that's not what happens. The M5 is interpreted as soon as grbl receives it, so the spindle is turned off before the M0 finishes.
Does anyone have any ideas? Is there a way to force grbl to queue the M3/M5 commands? I'm running grbl 0.9g.
EDIT: I just realized, it is being queued, because it's waiting for the G0 command to finish, it's only skipping the M0.