Close

Ready for Testing

A project log for GUI Programming for a Console Hacker

After 30 years of procedural language programming (i.e. console programming), time to look at event driven programming.

agpcooperagp.cooper 01/05/2019 at 04:140 Comments

Ready for Testing

Pulled a couple of long days, but now the code appears to be working, just need to do some real testing.

Here is the Control Panel:

I have loaded a 49k lines gCode file (fish6.nc) and reduced it to 1k lines using the Input Tolerance slider (tolerance=0.1).

If you "Show" the file you get:


Next I turned on "Laser", which adds M3/M5 (Laser On/Off) codes depending on the Z value (on if less than zero otherwise off).

Next I limited the feed speed to 100 units (mm/sec?).

Then I Opened the Serial Port (/dev/ttyUSB0). You cannot print unless the port is open. When you open the port the controller (i.e. Arduino) is reset, and then you get the initialisation mesage "Grbl V".

I then sent "G28", the Homing function to the controller via the Controller Command input box (as per the Control Panel image above). The file has G17 (metric) and G90 (absolute coordinates) is assumed.

After that you can "Print" the file. The progress bar will grow and when done resets.

You can pause printing by turning off the "Print" button.
If you close the serial port the print will be cancelled.

Here is the Control Panel after printing has been completed:

You can see the M3/M4 Laser codes and the Feed Limit (=100) in action in he Controller Dialog window.

There is probably some tweaking to be done with regard to how the buttons interact.

For the Laser flag I block any M3/M5 codes in the file and insert M3/M5 for laser on/off.

I also block any Z output if the Laser flag is set. This results in code like "M5G0", which seems strange but is legal (it changes mode from G1 to G0 which out moving):

The same code without the Laser flag looks like this:

One important issue with my gCode parser is that it only accepts the first code type (i.e. M, T, G, X, Y, Z, F and S) found on a line, any other of the same type is ignored. So if your code has something like "M3G1X10.0M5", then the "M5" will not be recognised (burn baby burn!). I think only hand written code will be like this!

The Code is about 700-800 lines and needs a tidy up.

If you have some horrible gCode (xyz) that you think will break my code, email me.


AlanX

Discussions