Skip to content

Commit 3ecc99e

Browse files
descipherthinkyhead
andcommitted
🐛 Fix Air Assist (MarlinFirmware#22159)
Co-authored-by: Scott Lahteine <[email protected]>
1 parent f22c5d3 commit 3ecc99e

File tree

4 files changed

+55
-59
lines changed

4 files changed

+55
-59
lines changed

Marlin/src/gcode/control/M7-M9.cpp

Lines changed: 25 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
*
2121
*/
2222

23-
#include "../../inc/MarlinConfig.h"
23+
#include "../../inc/MarlinConfigPre.h"
2424

25-
#if ENABLED(COOLANT_CONTROL)
25+
#if ANY(COOLANT_MIST, COOLANT_FLOOD, AIR_ASSIST)
2626

2727
#include "../gcode.h"
2828
#include "../../module/planner.h"
@@ -37,51 +37,41 @@
3737
}
3838
#endif
3939

40-
#if ENABLED(COOLANT_FLOOD)
40+
#if EITHER(COOLANT_FLOOD, AIR_ASSIST)
41+
42+
#if ENABLED(AIR_ASSIST)
43+
#include "../../feature/spindle_laser.h"
44+
#endif
45+
4146
/**
42-
* M8: Flood Coolant On
47+
* M8: Flood Coolant / Air Assist ON
4348
*/
4449
void GcodeSuite::M8() {
45-
planner.synchronize(); // Wait for move to arrive
46-
WRITE(COOLANT_FLOOD_PIN, !(COOLANT_FLOOD_INVERT)); // Turn on Flood coolant
50+
planner.synchronize(); // Wait for move to arrive
51+
#if ENABLED(COOLANT_FLOOD)
52+
WRITE(COOLANT_FLOOD_PIN, !(COOLANT_FLOOD_INVERT)); // Turn on Flood coolant
53+
#endif
54+
#if ENABLED(AIR_ASSIST)
55+
cutter.air_assist_enable(); // Turn on Air Assist
56+
#endif
4757
}
58+
4859
#endif
4960

5061
/**
51-
* M9: Coolant OFF
62+
* M9: Coolant / Air Assist OFF
5263
*/
5364
void GcodeSuite::M9() {
54-
planner.synchronize(); // Wait for move to arrive
65+
planner.synchronize(); // Wait for move to arrive
5566
#if ENABLED(COOLANT_MIST)
56-
WRITE(COOLANT_MIST_PIN, COOLANT_MIST_INVERT); // Turn off Mist coolant
67+
WRITE(COOLANT_MIST_PIN, COOLANT_MIST_INVERT); // Turn off Mist coolant
5768
#endif
5869
#if ENABLED(COOLANT_FLOOD)
59-
WRITE(COOLANT_FLOOD_PIN, COOLANT_FLOOD_INVERT); // Turn off Flood coolant
70+
WRITE(COOLANT_FLOOD_PIN, COOLANT_FLOOD_INVERT); // Turn off Flood coolant
71+
#endif
72+
#if ENABLED(AIR_ASSIST)
73+
cutter.air_assist_disable(); // Turn off Air Assist
6074
#endif
6175
}
6276

63-
#endif // COOLANT_CONTROL
64-
65-
#if ENABLED(AIR_ASSIST)
66-
67-
#include "../gcode.h"
68-
#include "../../module/planner.h"
69-
#include "../../feature/spindle_laser.h"
70-
71-
/**
72-
* M8: Air Assist On
73-
*/
74-
void GcodeSuite::M8() {
75-
planner.synchronize();
76-
cutter.air_assist_enable(); // Turn on Air Assist pin
77-
}
78-
79-
/**
80-
* M9: Air Assist Off
81-
*/
82-
void GcodeSuite::M9() {
83-
planner.synchronize();
84-
cutter.air_assist_disable(); // Turn off Air Assist pin
85-
}
86-
87-
#endif // AIR_ASSIST
77+
#endif // COOLANT_MIST | COOLANT_FLOOD | AIR_ASSIST

Marlin/src/gcode/gcode.cpp

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -441,20 +441,23 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
441441
case 3: M3_M4(false); break; // M3: Turn ON Laser | Spindle (clockwise), set Power | Speed
442442
case 4: M3_M4(true ); break; // M4: Turn ON Laser | Spindle (counter-clockwise), set Power | Speed
443443
case 5: M5(); break; // M5: Turn OFF Laser | Spindle
444-
#if ENABLED(AIR_EVACUATION)
445-
case 10: M10(); break; // M10: Vacuum or Blower motor ON
446-
case 11: M11(); break; // M11: Vacuum or Blower motor OFF
447-
#endif
448444
#endif
449445

450-
#if ENABLED(COOLANT_CONTROL)
451-
#if ENABLED(COOLANT_MIST)
452-
case 7: M7(); break; // M7: Mist coolant ON
453-
#endif
454-
#if ENABLED(COOLANT_FLOOD)
455-
case 8: M8(); break; // M8: Flood coolant ON
456-
#endif
457-
case 9: M9(); break; // M9: Coolant OFF
446+
#if ENABLED(COOLANT_MIST)
447+
case 7: M7(); break; // M7: Coolant Mist ON
448+
#endif
449+
450+
#if EITHER(AIR_ASSIST, COOLANT_FLOOD)
451+
case 8: M8(); break; // M8: Air Assist / Coolant Flood ON
452+
#endif
453+
454+
#if EITHER(AIR_ASSIST, COOLANT_CONTROL)
455+
case 9: M9(); break; // M9: Air Assist / Coolant OFF
456+
#endif
457+
458+
#if ENABLED(AIR_EVACUATION)
459+
case 10: M10(); break; // M10: Vacuum or Blower motor ON
460+
case 11: M11(); break; // M11: Vacuum or Blower motor OFF
458461
#endif
459462

460463
#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER)

Marlin/src/gcode/gcode.h

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -564,22 +564,25 @@ class GcodeSuite {
564564
#if HAS_CUTTER
565565
static void M3_M4(const bool is_M4);
566566
static void M5();
567-
#if ENABLED(AIR_EVACUATION)
568-
static void M10();
569-
static void M11();
570-
#endif
571567
#endif
572568

573-
#if ENABLED(COOLANT_CONTROL)
574-
#if ENABLED(COOLANT_MIST)
575-
static void M7();
576-
#endif
577-
#if ENABLED(COOLANT_FLOOD)
578-
static void M8();
579-
#endif
569+
#if ENABLED(COOLANT_MIST)
570+
static void M7();
571+
#endif
572+
573+
#if EITHER(AIR_ASSIST, COOLANT_FLOOD)
574+
static void M8();
575+
#endif
576+
577+
#if EITHER(AIR_ASSIST, COOLANT_CONTROL)
580578
static void M9();
581579
#endif
582580

581+
#if ENABLED(AIR_EVACUATION)
582+
static void M10();
583+
static void M11();
584+
#endif
585+
583586
#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER)
584587
static void M12();
585588
#endif

ini/features.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ HAS_USER_THERMISTORS = src_filter=+<src/gcode/config/M305.cpp>
166166
SD_ABORT_ON_ENDSTOP_HIT = src_filter=+<src/gcode/config/M540.cpp>
167167
BAUD_RATE_GCODE = src_filter=+<src/gcode/config/M575.cpp>
168168
HAS_SMART_EFF_MOD = src_filter=+<src/gcode/config/M672.cpp>
169-
COOLANT_CONTROL = src_filter=+<src/gcode/control/M7-M9.cpp>
169+
COOLANT_CONTROL|AIR_ASSIST = src_filter=+<src/gcode/control/M7-M9.cpp>
170170
AIR_EVACUATION = src_filter=+<src/gcode/control/M10-M11.cpp>
171171
HAS_SOFTWARE_ENDSTOPS = src_filter=+<src/gcode/control/M211.cpp>
172172
HAS_DUPLICATION_MODE = src_filter=+<src/gcode/control/M605.cpp>

0 commit comments

Comments
 (0)