Skip to content

Commit

Permalink
🐛 Fix Air Assist (#22159)
Browse files Browse the repository at this point in the history
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
  • Loading branch information
descipher and thinkyhead authored Jun 18, 2021
1 parent ab7e622 commit 135801d
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 59 deletions.
60 changes: 25 additions & 35 deletions Marlin/src/gcode/control/M7-M9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
*
*/

#include "../../inc/MarlinConfig.h"
#include "../../inc/MarlinConfigPre.h"

#if ENABLED(COOLANT_CONTROL)
#if ANY(COOLANT_MIST, COOLANT_FLOOD, AIR_ASSIST)

#include "../gcode.h"
#include "../../module/planner.h"
Expand All @@ -37,51 +37,41 @@
}
#endif

#if ENABLED(COOLANT_FLOOD)
#if EITHER(COOLANT_FLOOD, AIR_ASSIST)

#if ENABLED(AIR_ASSIST)
#include "../../feature/spindle_laser.h"
#endif

/**
* M8: Flood Coolant On
* M8: Flood Coolant / Air Assist ON
*/
void GcodeSuite::M8() {
planner.synchronize(); // Wait for move to arrive
WRITE(COOLANT_FLOOD_PIN, !(COOLANT_FLOOD_INVERT)); // Turn on Flood coolant
planner.synchronize(); // Wait for move to arrive
#if ENABLED(COOLANT_FLOOD)
WRITE(COOLANT_FLOOD_PIN, !(COOLANT_FLOOD_INVERT)); // Turn on Flood coolant
#endif
#if ENABLED(AIR_ASSIST)
cutter.air_assist_enable(); // Turn on Air Assist
#endif
}

#endif

/**
* M9: Coolant OFF
* M9: Coolant / Air Assist OFF
*/
void GcodeSuite::M9() {
planner.synchronize(); // Wait for move to arrive
planner.synchronize(); // Wait for move to arrive
#if ENABLED(COOLANT_MIST)
WRITE(COOLANT_MIST_PIN, COOLANT_MIST_INVERT); // Turn off Mist coolant
WRITE(COOLANT_MIST_PIN, COOLANT_MIST_INVERT); // Turn off Mist coolant
#endif
#if ENABLED(COOLANT_FLOOD)
WRITE(COOLANT_FLOOD_PIN, COOLANT_FLOOD_INVERT); // Turn off Flood coolant
WRITE(COOLANT_FLOOD_PIN, COOLANT_FLOOD_INVERT); // Turn off Flood coolant
#endif
#if ENABLED(AIR_ASSIST)
cutter.air_assist_disable(); // Turn off Air Assist
#endif
}

#endif // COOLANT_CONTROL

#if ENABLED(AIR_ASSIST)

#include "../gcode.h"
#include "../../module/planner.h"
#include "../../feature/spindle_laser.h"

/**
* M8: Air Assist On
*/
void GcodeSuite::M8() {
planner.synchronize();
cutter.air_assist_enable(); // Turn on Air Assist pin
}

/**
* M9: Air Assist Off
*/
void GcodeSuite::M9() {
planner.synchronize();
cutter.air_assist_disable(); // Turn off Air Assist pin
}

#endif // AIR_ASSIST
#endif // COOLANT_MIST | COOLANT_FLOOD | AIR_ASSIST
27 changes: 15 additions & 12 deletions Marlin/src/gcode/gcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,20 +441,23 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 3: M3_M4(false); break; // M3: Turn ON Laser | Spindle (clockwise), set Power | Speed
case 4: M3_M4(true ); break; // M4: Turn ON Laser | Spindle (counter-clockwise), set Power | Speed
case 5: M5(); break; // M5: Turn OFF Laser | Spindle
#if ENABLED(AIR_EVACUATION)
case 10: M10(); break; // M10: Vacuum or Blower motor ON
case 11: M11(); break; // M11: Vacuum or Blower motor OFF
#endif
#endif

#if ENABLED(COOLANT_CONTROL)
#if ENABLED(COOLANT_MIST)
case 7: M7(); break; // M7: Mist coolant ON
#endif
#if ENABLED(COOLANT_FLOOD)
case 8: M8(); break; // M8: Flood coolant ON
#endif
case 9: M9(); break; // M9: Coolant OFF
#if ENABLED(COOLANT_MIST)
case 7: M7(); break; // M7: Coolant Mist ON
#endif

#if EITHER(AIR_ASSIST, COOLANT_FLOOD)
case 8: M8(); break; // M8: Air Assist / Coolant Flood ON
#endif

#if EITHER(AIR_ASSIST, COOLANT_CONTROL)
case 9: M9(); break; // M9: Air Assist / Coolant OFF
#endif

#if ENABLED(AIR_EVACUATION)
case 10: M10(); break; // M10: Vacuum or Blower motor ON
case 11: M11(); break; // M11: Vacuum or Blower motor OFF
#endif

#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER)
Expand Down
25 changes: 14 additions & 11 deletions Marlin/src/gcode/gcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -564,22 +564,25 @@ class GcodeSuite {
#if HAS_CUTTER
static void M3_M4(const bool is_M4);
static void M5();
#if ENABLED(AIR_EVACUATION)
static void M10();
static void M11();
#endif
#endif

#if ENABLED(COOLANT_CONTROL)
#if ENABLED(COOLANT_MIST)
static void M7();
#endif
#if ENABLED(COOLANT_FLOOD)
static void M8();
#endif
#if ENABLED(COOLANT_MIST)
static void M7();
#endif

#if EITHER(AIR_ASSIST, COOLANT_FLOOD)
static void M8();
#endif

#if EITHER(AIR_ASSIST, COOLANT_CONTROL)
static void M9();
#endif

#if ENABLED(AIR_EVACUATION)
static void M10();
static void M11();
#endif

#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER)
static void M12();
#endif
Expand Down
2 changes: 1 addition & 1 deletion ini/features.ini
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ HAS_USER_THERMISTORS = src_filter=+<src/gcode/config/M305.cpp>
SD_ABORT_ON_ENDSTOP_HIT = src_filter=+<src/gcode/config/M540.cpp>
BAUD_RATE_GCODE = src_filter=+<src/gcode/config/M575.cpp>
HAS_SMART_EFF_MOD = src_filter=+<src/gcode/config/M672.cpp>
COOLANT_CONTROL = src_filter=+<src/gcode/control/M7-M9.cpp>
COOLANT_CONTROL|AIR_ASSIST = src_filter=+<src/gcode/control/M7-M9.cpp>
AIR_EVACUATION = src_filter=+<src/gcode/control/M10-M11.cpp>
HAS_SOFTWARE_ENDSTOPS = src_filter=+<src/gcode/control/M211.cpp>
HAS_DUPLICATION_MODE = src_filter=+<src/gcode/control/M605.cpp>
Expand Down

0 comments on commit 135801d

Please sign in to comment.