M3/M5 Not Queued

Discussion about the arduino based g-code interpreter, grbl
Post Reply
jacob32123
Posts: 96
Joined: Thu Dec 12, 2013 4:53 am

M3/M5 Not Queued

Post by jacob32123 » Sat Apr 25, 2015 4:10 pm

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.

Code: Select all

G0 X10
M0
G0 X20
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:

Code: Select all

M3
G0 X10
M0
M5
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.

chamnit
Posts: 376
Joined: Tue Aug 12, 2014 2:16 pm
Location: Albuquerque NM, USA
Contact:

Re: M3/M5 Not Queued

Post by chamnit » Sat Apr 25, 2015 5:21 pm

The M0 problem has been fixed in v0.9i. Just be aware that I had forgotten to add a new state to tell the user what Grbl is doing during a program pause. It'll say IDLE during an M0, M2, or M30, but it needs a cycle start/resume command to continue.

jacob32123
Posts: 96
Joined: Thu Dec 12, 2013 4:53 am

Re: M3/M5 Not Queued

Post by jacob32123 » Sat Apr 25, 2015 7:49 pm

chamnit wrote:The M0 problem has been fixed in v0.9i. Just be aware that I had forgotten to add a new state to tell the user what Grbl is doing during a program pause. It'll say IDLE during an M0, M2, or M30, but it needs a cycle start/resume command to continue.
Thanks for your help. I've been avoiding the upgrade to v0.9i because of the pin change. I really don't want to have to pull my gshield out of it's enclosure, and solder the relay to a new pin, so I figured I'd go for the software fix. Commenting out VARIABLE_SPINDLE in config.h doesn't seem to make a difference for me. I uploaded the custom version with that line commented out via the Arduino IDE, and M3/M5 doesn't turn the relay on/off. It's always off. Ideas?

Thanks for you help,
Jacob

chamnit
Posts: 376
Joined: Tue Aug 12, 2014 2:16 pm
Location: Albuquerque NM, USA
Contact:

Re: M3/M5 Not Queued

Post by chamnit » Sat Apr 25, 2015 7:52 pm

Make sure to edit the config.h file in the arduino library folder, not the download folder. The IDE copies it.

jacob32123
Posts: 96
Joined: Thu Dec 12, 2013 4:53 am

Re: M3/M5 Not Queued

Post by jacob32123 » Sat Apr 25, 2015 9:14 pm

chamnit wrote:Make sure to edit the config.h file in the arduino library folder, not the download folder. The IDE copies it.
That did it. All fixed now. Thanks!

Post Reply