M9 command sent at every layer, even when air assist turned off

A user approached me with the following issue:
Using grbl, you can control two output pins to control e.g., a relay. (For the Sculpfun lasers, I have documented it here: Relay Control - Diode Laser Wiki). The drawback of this method is, that both can be turned on individually, using M7 and M8, but both are turned off by the same command, M9.
In this case, M7 controls the exhaust fan and M8 air assist. The goal is to turn on exhaust all the time and air assist only on desired layers. This can (could) be done the following way:

  • Add M7 as start gcode, M9 as end gcode
  • Move the air assist layers to the end, since otherwise everything would be turned off in the middle + only one air assist layer possible

The user reported, that after an upgrade, this no longer works, the exhaust is always turned off. I checked the generated gcode and noticed that M9 is sent at the beginning of each layer, even if (or especially if) the layer does not enable air assist. This breaks the logic described above.

First question: has it been like this ever or did this change in latest versions? (I did a quick test with 1.1.04 and it seems to generate the same gcode)

Second question: is there a reason to send the M9 at the beginning of a non-air-assist-layer? If such layers would just have no such command, the air-assist-enabled layers would just have to provide M7/M8 at the beginning and M9 at the end (I think they even have already). I htink this start-M9 could be removed? Or is there another reason to have it?

I tried to illustrate it here:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.