Does GRBL return to metric after finishing a job

Discussion about the arduino based g-code interpreter, grbl
billcat
Posts: 73
Joined: Fri Sep 20, 2013 4:00 pm
Location: Cedar Park, Texas

Does GRBL return to metric after finishing a job

Post by billcat » Thu Nov 20, 2014 12:22 am

I have enjoyed tinkering with GRBL for some time now, but just recently started to run complete g-code programs with it on a little DIY router. I have been streaming g-code via Universal G-code Sender wirelessly over the inexpensive HC-06/05 Bluetooth modules found on Ebay. It has been a both fun and sometimes frustrating learning experience.

I am more comfortable working in inches and therefore do so most often as that is what I have grown used to while using Mach3 on another machine. However, I noticed that after running a recent test "job" with GRBL, I needed to jog to a certain location to clear the workpiece after the job completed. I then realized the jog buttons were operating in metric, which was a surprise as I assumed the G20 code was still intact, being modal, and initiated at the beginning of the program. Yet this was certainly not the case. However, if at any time, I manually sent the G20 command, then the UGS jog buttons operate properly.

So I am assuming that:
1)something deep within the GRBL internals, of which I understand very, very little, must initiate essentially a G21 after the M30 program end? After discovering this, I reviewed the G-code to assure my CAM did not enter a G21 command at program end.

or.....

2)something in UGS sends essentially a G21 after M30 program end, although it is not indicated in the Command Table view?

Is this expected behavior with GRBL or is there something else going on that I haven't considered?

billcat
Posts: 73
Joined: Fri Sep 20, 2013 4:00 pm
Location: Cedar Park, Texas

Re: Does GRBL return to metric after finishing a job

Post by billcat » Thu Nov 20, 2014 12:26 am

BTW...

GRBL.9g

McOtis
Posts: 80
Joined: Sun Feb 09, 2014 12:21 am
Location: Maryland

Re: Does GRBL return to metric after finishing a job

Post by McOtis » Thu Nov 20, 2014 1:21 am

I just so happen to be having the exact same problem.
I upgraded to 0.9 from 0.8 and now all my old jobs are acting screwed up!

McOtis
Posts: 80
Joined: Sun Feb 09, 2014 12:21 am
Location: Maryland

Re: Does GRBL return to metric after finishing a job

Post by McOtis » Thu Nov 20, 2014 1:30 am

Update:
I am getting the the "error: unsupported command" message when UGS sends "G20G90G40".
So something has changed.
Either GRBL 0.9g or UGS 1.0.8 nightly.
Something has taken the spaces out when sending that line of commands.

McOtis
Posts: 80
Joined: Sun Feb 09, 2014 12:21 am
Location: Maryland

Re: Does GRBL return to metric after finishing a job

Post by McOtis » Thu Nov 20, 2014 1:38 am

Update: More troubleshooting and more searching in the forum, i found the issue.

http://www.shapeoko.com/forum/viewtopic.php?f=3&t=4597

G40 isn't supported.

Tronn
Posts: 19
Joined: Wed Jun 04, 2014 11:03 pm

Re: Does GRBL return to metric after finishing a job

Post by Tronn » Thu Nov 20, 2014 4:30 am

Yep G40 is the offending command. As cvoinescu said in the other thread, G40 causes the whole line to not be read, thus units never get set to inches.

I fixed this by adding the switch to inches command to the startup block ($N0=G20G90) as suggested. This makes the machine switch to inches anytime its turned on or reset. You just have to keep in mind that now jogging is ALSO in inches. I also ended up switching the GRBL report units setting to inches as well ($13=1), so now pretty much everything reads out in inches.
Shapeoko 2 - 300W DC Spindle, Custom Enclosure, Alum extrusion Bed, Homing switches, Trimmed Z-Motor Plates, Drag Chains, GRBL 0.9g
MakerFarm Prusa i3 3D printer, Rostock Mini 3D printer(WIP)
My Blog: http://nateduxbury.wordpress.com/

billcat
Posts: 73
Joined: Fri Sep 20, 2013 4:00 pm
Location: Cedar Park, Texas

Re: Does GRBL return to metric after finishing a job

Post by billcat » Fri Nov 21, 2014 12:22 am

I'm not really talking about the unsupported G40 command; I discovered that a while back and just manually edit the g-code file to put G20, G90, etc. each on a separate line. However, upon doing some more testing tonight, I have found other issues it seems. Specifically, I am getting the unsupported command statement on UGS "command table" view for different supported commands, each time I run the SAME file. :o I also have found that some times the last line of my file(so far it's always G30) is not executed, and sometimes it is.

But what I started this thread about is this:

I open UGS while connected to my machine and go to Command tab,
Press G20 and enter to change to inches mode,
go to Machine Control tab, set step size to 1, and jog any axis...
each press of x, y or z will move the given axis the expected 1 inch,
now I go back to Command tab and enter G30,(which I understand to be the typical program end command),
then go back to Machine Control tab,
step size is still set at 1,
each press of x, y or z will move the machine 1mm, although I never entered G21 to change mode back to metric.

..try it!

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: Does GRBL return to metric after finishing a job

Post by cvoinescu » Fri Nov 21, 2014 12:48 am

You mean M30, not G30.

That behavior is correct. Unless you've configured it otherwise, GRBL uses mm at startup. M30 ends the program and returns GRBL to its startup configuration (among other things, it stops the spindle, clears G92 offsets, selects the G54 work coordinate system, and selects mm). GRBL also executes the $N startup lines, so if you want to change the defaults, say, make it always start in inches, that's where you can do that: $N0=G20 will tell GRBL to execute a G20 every time it starts or resets (including on M30).
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

billcat
Posts: 73
Joined: Fri Sep 20, 2013 4:00 pm
Location: Cedar Park, Texas

Re: Does GRBL return to metric after finishing a job

Post by billcat » Fri Nov 21, 2014 11:59 am

cvoinescu wrote:You mean M30, not G30.
yes....oops

So if I change the startup block to always start with the G20 command, after the end of running a job when the M30 command is issued, will it again default to mm?

billcat
Posts: 73
Joined: Fri Sep 20, 2013 4:00 pm
Location: Cedar Park, Texas

Re: Does GRBL return to metric after finishing a job

Post by billcat » Fri Nov 21, 2014 12:02 pm

billcat wrote: So if I change the startup block to always start with the G20 command, after the end of running a job when the M30 command is issued, will it again default to mm?
oops again, reread your post more carefully and I believe this was answered.......will check it out when I get a chance.

thanks

Post Reply