Add Flood Control (M8/M9) to post processor

I ran a laser job the other day an noticed my air pump never turned on. I was able to control it manually using the Flood button so I know it’s wired/connected correctly.

This led me down a path to understand why as I learned that I presumed incorrectly that it happened automatically.

So now I am trying to figure out how to make it happen automatically when I run a laser job.

Not really finding much on it but wondering if there is a method of adding the M8 & M9 commands to a copy of the Laser Post Processor. Then I can choose the original or W/Air version when I save the gcode.

Unfortunately, I have no idea where to edit/update the Post Processor so was wondering if anyone else had done this and can share - or do you have another suggestion.

+================================================+
  • Grbl - Vectric machine output configuration file
    
  • 
    
+================================================+
  • History
    
  • 
    
  • Who      When       What
    
  • ======== ========== ===========================
    
  • EdwardP  11/02/2015 Written from Grbl_mm.pp but
    
  •                 set G20
    
  • EdwardP  11/02/2015 Commented out arcs as these
    
  •                 slow GRBL performance appear 
    
  •                 interpolated anyway.
    
  • EdwardP  18/06/2015 Explicitly set absolute mode (G90)
    
  • Mark     24/11/2015 Updated for interim 0.9 spec.
    
  •                 Renaming to be machine specific.
    
  •                 Removing M30 from Footer.
    
  • Edward   21/05/2020 Consolidated all changes from mm
    
  • Edward   02/06/2020 Consolidated all changes from mm
    
  • GrzegorzK 13/07/2020 Added X Y missing from the plunge record.
    
  • Jay       7/16/2020  Removed Z moves in this version V4
    
  • Jay       7/17/2023  Updated Jet Tool Power+================================================
    
POST_NAME = “J Tech Grbl Laser V8 (mm) (*.gcode)”
FILE_EXTENSION = “gcode”
UNITS = “MM”
DIRECT_OUTPUT = “VTransfer”
LASER_SUPPORT = “YES”
±-----------------------------------------------
  • Line terminating characters±-----------------------------------------------
    
LINE_ENDING = “[13][10]”
±-----------------------------------------------
  • Block numbering±-----------------------------------------------
    
LINE_NUMBER_START     = 0LINE_NUMBER_INCREMENT = 10LINE_NUMBER_MAXIMUM = 999999
+================================================+
  • Formatting for variables
    
  • 
    
+================================================
VAR LINE_NUMBER = [N|A|N|1.0]VAR POWER = [P|C|S|1.0|10.0]VAR SPINDLE_SPEED = [S|A|S|1.0]VAR FEED_RATE = [F|C|F|1.1]VAR X_POSITION = [X|C|X|1.4]VAR Y_POSITION = [Y|C|Y|1.4]VAR Z_POSITION = [Z|C|Z|1.4]VAR ARC_CENTRE_I_INC_POSITION = [I|A|I|1.4]VAR ARC_CENTRE_J_INC_POSITION = [J|A|J|1.4]VAR X_HOME_POSITION = [XH|A|X|1.4]VAR Y_HOME_POSITION = [YH|A|Y|1.4]VAR Z_HOME_POSITION = [ZH|A|Z|1.4]
+================================================+
  • Block definitions for toolpath output
    
  • 
    
+================================================
±--------------------------------------------------
  • Commands output at the start of the file±--------------------------------------------------
    
begin HEADER
“;J Tech Grbl Laser V8”“T1”“G17”“G21”“G90”+“G0[ZH]”“G0[XH][YH]”
±--------------------------------------------------
  • Command output after the header to switch spindle on±--------------------------------------------------
    
begin SPINDLE_ON
“[S]M3”
±--------------------------------------------------
  • Commands output for rapid moves±--------------------------------------------------
    
begin RAPID_MOVE
“G1[Y][F]”
±--------------------------------------------------
  • Commands output for the plunge move±--------------------------------------------------
    
begin PLUNGE_MOVE
“G1[Y][F]”
±--------------------------------------------------
  • Commands output for the first feed rate move±--------------------------------------------------
    
begin FIRST_FEED_MOVE
“G1[Y][P][F]”
±--------------------------------------------------
  • Commands output for feed rate moves±--------------------------------------------------
    
begin FEED_MOVE
“G1[Y][P]”
±--------------------------------------------------
  • Commands output for the first clockwise arc move±--------------------------------------------------
    
begin FIRST_CW_ARC_MOVE
“G2[Y][I][J][F][P]”
±--------------------------------------------------
  • Commands output for clockwise arc  move±--------------------------------------------------
    
begin CW_ARC_MOVE
“G2[Y][I][J]”
±--------------------------------------------------
  • Commands output for the first counterclockwise arc move±--------------------------------------------------
    
begin FIRST_CCW_ARC_MOVE
“G3[Y][I][J][F][P]”
±--------------------------------------------------
  • Commands output for counterclockwise arc  move±--------------------------------------------------
    
begin CCW_ARC_MOVE
“G3[Y][I][J]”
±--------------------------------------------------
  • Commands output when the jet is turned on±--------------------------------------------------
    
begin JET_TOOL_ON
“M4[P]”
±--------------------------------------------------
  • Commands output when the jet is turned off±--------------------------------------------------
    
begin JET_TOOL_OFF
“M4 S0”
±--------------------------------------------------
  • Commands output when the jet power is changed±--------------------------------------------------
    
begin JET_TOOL_POWER+“[P]”
±--------------------------------------------------
  • Commands output at the end of the file±--------------------------------------------------
    
begin FOOTER
“M5”+“G0[ZH]”“G0[XH][YH]”“M2”

(Note that I do not have a laser on my Altmill, so this is a “left to the experimenting student” suggestion rather than a tested solution :slight_smile: )

The HEADER and FOOTER sections in the Vectric postprocessor are where I’d start, by adding the g-code for FLOOD_ON in the HEADER and FLOOD_OFF in the FOOTER:

begin HEADER
“;J Tech Grbl Laser V8”
“T1”
“G17”
“G21”
“G90”+“G0[ZH]”
“G0[XH][YH]”
"M8"

and

begin FOOTER
"M9"
“M5”+“G0[ZH]”
“G0[XH][YH]”
“M2”
1 Like

Thanks - see that is what I was wondering - Header & Footer versus the JET_TOOL_ON & JET_TOOL_OFF sections.

Those sections may also work -, especially if you want finer grain control of the air on/off cycle…
Putting them in HEADER and FOOTER simply means that the air will be on for the entire length of the job, rather than turning off/on along with the laser beam…

My experience with Makerspace Lasers says that exhaust air control belongs at the job level or even “always on”, while air assist really only is necessary while the beam is cutting…

Feel free to experiment. The text within double quotes in the postprocessor file are used to create the g-code output, so you can inspect the generated g-code to see what is happening.

I’d start with a very simple project, say a 1cm square vector, and use it to try out changes to the pp file. The resulting g-code should be easy to understand by opening it in a text editor, no need to burn things on the machine :slight_smile:

2 Likes

Thank you - Even though I have been 3D printing for years, I have been lucky and never had to mess directly with gcode so I am not too familiar with how to manipulate it, much less in my newly found CNC & Laser use.

You might find these g- and m-code reference pages useful - The first link is focused on Marlin 3D printing usage, but the crossover to CNC is pretty high…

1 Like