This code includes a much more complete implementation of g-code processing, capable of handling a much broader range of g-code commands, properly handling the g20/g21 metric/imperial specification, proper handling of comments, proper handling of multiple commands on a single line (most often the meta-commands) and most importantly proper handling of the g2 and g3 circular arc commands. Circular arcs are implemented using up to four successive bezier segments to give a close approximation of circular arcs up to a full circle. Clockwise and anticlockwise arcs are properly handled. Not properly implemented at this point is support for alternative methods of specifying the arc center (the current code supports an ij vector from the current point to the arc center), relative versus absolute positioning, and the more obscure commands that g-code can include. In addition, I have added a number of additional g-code test files that have been used for testing during the development process.
When initialising the USB connection we send a stop/start sequence very quickly. This papears to confuse the device, leading it to stop responding to commands sent via USB. This patch introduces a fix for this problem, by inserting a delay before writing the stop and start commands. At the moment some trial and error has suggested a delay of 170ms, but this may need to be changed with more testing.
…ssed as an arg.
through bezier approximation.