GRBL .9G and G40

Discussion about the arduino based g-code interpreter, grbl
Post Reply
Tronn
Posts: 19
Joined: Wed Jun 04, 2014 11:03 pm

GRBL .9G and G40

Post by Tronn » Fri Nov 14, 2014 9:45 pm

Today I finally updated to grbl .9G from .8C (and UGCS 1.0.8) and I am really enjoying the new options (hooray independent axis max speeds!).

I encountered an issue running my first job on .9G and it initially had me confused. It looked like my machine was never kicking over to inches mode. Upon checking the gcode console, it showed that the line "G20G90G40" was not sent because of an unsupported statement. I tried sending each one separately and it turned out that G40 is the only one that was failing, causing the whole line to fail. Sure enough, once I removed G40 from my gcode manually, everything worked fine.

So, my question really is this: is the G40 command required for function? Wikipedia says it is "Tool radius compensation off." Did grbl .9G remove support for G40 for some reason?

Secondary question, is there any easy way for me to automate removal of the G40 command from my generated code? Makercam doesn't seem to have options for that. I would guess a post-processor could do it, anyone know of any tutorials for writing one of those?
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/

WillAdams
Posts: 8625
Joined: Mon Apr 09, 2012 6:11 pm
Location: Pennsylvania --- south of the Turnpike, East of US-15
Contact:

Re: GRBL .9G and G40

Post by WillAdams » Fri Nov 14, 2014 9:57 pm

It's never been supported yet: http://www.shapeoko.com/wiki/index.php/ ... ed_by_Grbl

and if memory serves, used to make the machine behave oddly.
Shapeoko 3XL #0006 w/ Carbide Compact Router w/0.125″ and ¼″ Carbide 3D precision collets

jarretl
Posts: 135
Joined: Mon Feb 24, 2014 2:50 pm
Location: Edmonton, AB

Re: GRBL .9G and G40

Post by jarretl » Fri Nov 14, 2014 10:07 pm

A quick (but not necessarily the optimal) solution may be to set your first start up block in GRBL to 'G20G90', so that your device starts in inches mode and absolute distance mode (though technically I think it already defaults to G90, so that may be redundant).
You can set the first start up block with $N0=G20G90 Once you set this, your device will run that code block on startup and any time the machine is reset, so before you even run your file the parameters get set correctly and grbl skipping that line will have no adverse affect.

Note that with this solution your controller will always be in inches mode, so when jogging in UGS setting the jogging value to 1 equals 1 inch, not 1 mm like it did previously... To move in small increments, 0.0394 inches = 1mm :)

more on startup blocks can be found here: https://github.com/grbl/grbl/wiki/Configuring-Grbl-v0.9

@Will - I don't recall having problems with the G20G90G40 lines with makercam files in 0.8c, yet since G40 has never been supported I suspect something changed with chamnit's code parser in GRBL between 0.8c and 0.9g that simply drops the whole line instead of executing G20G90 and dropping only the unsupported G40 part of the command.
Shapeoko 2 #4043; DW660

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

Re: GRBL .9G and G40

Post by Tronn » Fri Nov 14, 2014 10:18 pm

Yea, the working in grbl .8C and not working in .9G was the thing that got me. Gcode that had run fine before I upgraded was not working at all with .9G because of the skipped command.

jarretl, thanks for the tip about start up block! I might do that anyways, since I've always been translating inches-mm in my head so much with designing in one and the machine coordinates being the other.
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/

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

Re: GRBL .9G and G40

Post by cvoinescu » Fri Nov 14, 2014 10:30 pm

GRBL 0.9 changed the behavior of the G-code parser. It is more compliant with the standard now. One change is that, if any part of a line is invalid or unsupported, the entire line is rejected. This is the correct behavior. Before, bits and pieces would "take", and others would cause errors and be ignored.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

Post Reply