diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 149ac610f..7d89cf520 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -3166,13 +3166,19 @@ //#define AIR_EVACUATION // Cutter Vacuum / Laser Blower motor control with G-codes M10-M11 #if ENABLED(AIR_EVACUATION) #define AIR_EVACUATION_ACTIVE LOW // Set to "HIGH" if the on/off function is active HIGH - #define AIR_EVACUATION_PIN 42 // Override the default Cutter Vacuum or Laser Blower pin + //#define AIR_EVACUATION_PIN 42 // Override the default Cutter Vacuum or Laser Blower pin #endif - //#define SPINDLE_SERVO // A servo converting an angle to spindle power + //#define AIR_ASSIST // Air Assist control with G-codes M8-M9 + #if ENABLED(AIR_ASSIST) + #define AIR_ASSIST_ACTIVE LOW // Active state on air assist pin + //#define AIR_ASSIST_PIN 44 // Override the default Air Assist pin + #endif + + //#define SPINDLE_SERVO // A servo converting an angle to spindle power #ifdef SPINDLE_SERVO - #define SPINDLE_SERVO_NR 0 // Index of servo used for spindle control - #define SPINDLE_SERVO_MIN 10 // Minimum angle for servo spindle + #define SPINDLE_SERVO_NR 0 // Index of servo used for spindle control + #define SPINDLE_SERVO_MIN 10 // Minimum angle for servo spindle #endif /** diff --git a/Marlin/src/feature/spindle_laser.cpp b/Marlin/src/feature/spindle_laser.cpp index 78fa75cac..100b7c4b2 100644 --- a/Marlin/src/feature/spindle_laser.cpp +++ b/Marlin/src/feature/spindle_laser.cpp @@ -71,6 +71,9 @@ void SpindleLaser::init() { #if ENABLED(AIR_EVACUATION) OUT_WRITE(AIR_EVACUATION_PIN, !AIR_EVACUATION_ACTIVE); // Init Vacuum/Blower OFF #endif + #if ENABLED(AIR_ASSIST) + OUT_WRITE(AIR_ASSIST_PIN, !AIR_ASSIST_ACTIVE); // Init Air Assist OFF + #endif } #if ENABLED(SPINDLE_LASER_PWM) @@ -147,6 +150,17 @@ void SpindleLaser::apply_power(const uint8_t opwr) { void SpindleLaser::air_evac_toggle() { TOGGLE(AIR_EVACUATION_PIN); } // Toggle state -#endif +#endif // AIR_EVACUATION + +#if ENABLED(AIR_ASSIST) + + // Enable / disable air assist + void SpindleLaser::air_assist_enable() { WRITE(AIR_ASSIST_PIN, AIR_ASSIST_PIN); } // Turn ON + + void SpindleLaser::air_assist_disable() { WRITE(AIR_ASSIST_PIN, !AIR_ASSIST_PIN); } // Turn OFF + + void SpindleLaser::air_assist_toggle() { TOGGLE(AIR_ASSIST_PIN); } // Toggle state + +#endif // AIR_ASSIST #endif // HAS_CUTTER diff --git a/Marlin/src/feature/spindle_laser.h b/Marlin/src/feature/spindle_laser.h index c3454d0b3..da228cf8a 100644 --- a/Marlin/src/feature/spindle_laser.h +++ b/Marlin/src/feature/spindle_laser.h @@ -221,6 +221,15 @@ public: } #endif + #if ENABLED(AIR_ASSIST) + static void air_assist_enable(); // Turn on air assist + static void air_assist_disable(); // Turn off air assist + static void air_assist_toggle(); // Toggle air assist + static inline bool air_assist_state() { // Get current state + return (READ(AIR_ASSIST_PIN) == AIR_ASSIST_ACTIVE); + } + #endif + static inline void disable() { isReady = false; set_enabled(false); } #if HAS_LCD_MENU diff --git a/Marlin/src/gcode/control/M10-M11.cpp b/Marlin/src/gcode/control/M10-M11.cpp index 26f67e6cb..d5a69dcfc 100644 --- a/Marlin/src/gcode/control/M10-M11.cpp +++ b/Marlin/src/gcode/control/M10-M11.cpp @@ -25,14 +25,12 @@ #if ENABLED(AIR_EVACUATION) #include "../gcode.h" -#include "../../module/planner.h" #include "../../feature/spindle_laser.h" /** * M10: Vacuum or Blower On */ void GcodeSuite::M10() { - planner.synchronize(); // Wait for move to arrive (TODO: asynchronous) cutter.air_evac_enable(); // Turn on Vacuum or Blower motor } @@ -40,7 +38,6 @@ void GcodeSuite::M10() { * M11: Vacuum or Blower OFF */ void GcodeSuite::M11() { - planner.synchronize(); // Wait for move to arrive (TODO: asynchronous) cutter.air_evac_disable(); // Turn off Vacuum or Blower motor } diff --git a/Marlin/src/gcode/control/M7-M9.cpp b/Marlin/src/gcode/control/M7-M9.cpp index a33e43288..f93123eb3 100644 --- a/Marlin/src/gcode/control/M7-M9.cpp +++ b/Marlin/src/gcode/control/M7-M9.cpp @@ -61,3 +61,27 @@ void GcodeSuite::M9() { } #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 diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index f217c9674..5030f82f9 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -118,6 +118,7 @@ namespace Language_en { PROGMEM Language_Str MSG_SPINDLE_POWER = _UxGT("Spindle Pwr"); PROGMEM Language_Str MSG_LASER_TOGGLE = _UxGT("Toggle Laser"); PROGMEM Language_Str MSG_LASER_EVAC_TOGGLE = _UxGT("Toggle Blower"); + PROGMEM Language_Str MSG_LASER_ASSIST_TOGGLE = _UxGT("Air Assist"); PROGMEM Language_Str MSG_LASER_PULSE_MS = _UxGT("Test Pulse ms"); PROGMEM Language_Str MSG_LASER_FIRE_PULSE = _UxGT("Fire Pulse"); PROGMEM Language_Str MSG_FLOWMETER_FAULT = _UxGT("Coolant Flow Fault"); diff --git a/Marlin/src/lcd/menu/menu_spindle_laser.cpp b/Marlin/src/lcd/menu/menu_spindle_laser.cpp index f0e702e2d..a28c614c9 100644 --- a/Marlin/src/lcd/menu/menu_spindle_laser.cpp +++ b/Marlin/src/lcd/menu/menu_spindle_laser.cpp @@ -56,6 +56,11 @@ EDIT_ITEM(bool, MSG_CUTTER(EVAC_TOGGLE), &evac_state, cutter.air_evac_toggle); #endif + #if ENABLED(AIR_ASSIST) + bool air_assist_state = cutter.air_assist_state(); + EDIT_ITEM(bool, MSG_CUTTER(ASSIST_TOGGLE), &air_assist_state, cutter.air_assist_toggle); + #endif + #if ENABLED(SPINDLE_CHANGE_DIR) if (!is_enabled) { editable.state = is_rev; diff --git a/buildroot/tests/mega2560 b/buildroot/tests/mega2560 index 4ed199df2..b4a3d2b9a 100755 --- a/buildroot/tests/mega2560 +++ b/buildroot/tests/mega2560 @@ -173,9 +173,9 @@ exec_test $1 $2 "Azteeg X3 | Mixing Extruder (x5) | Gradient Mix | Greek" "$3" restore_configs opt_set MOTHERBOARD BOARD_RAMPS_14_EFB LCD_LANGUAGE en TEMP_SENSOR_COOLER 1 EXTRUDERS 0 TEMP_SENSOR_1 0 SERIAL_PORT_2 2 opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT EEPROM_SETTINGS EEPROM_BOOT_SILENT EEPROM_AUTO_INIT \ - LASER_FEATURE LASER_COOLANT_FLOW_METER MEATPACK_ON_SERIAL_PORT_1 + LASER_FEATURE AIR_EVACUATION AIR_EVACUATION_PIN AIR_ASSIST AIR_ASSIST_PIN LASER_COOLANT_FLOW_METER MEATPACK_ON_SERIAL_PORT_1 -exec_test $1 $2 "REPRAP MEGA2560 RAMPS | Laser Feature | Cooler | Flowmeter | 12864 LCD | meatpack | SERIAL_PORT_2 " "$3" +exec_test $1 $2 "REPRAP MEGA2560 RAMPS | Laser Feature | Air Evacuation | Air Assist | Cooler | Flowmeter | 12864 LCD | meatpack | SERIAL_PORT_2 " "$3" # # Test Laser features with 44780 LCD @@ -183,9 +183,9 @@ exec_test $1 $2 "REPRAP MEGA2560 RAMPS | Laser Feature | Cooler | Flowmeter | 12 restore_configs opt_set MOTHERBOARD BOARD_RAMPS_14_EFB LCD_LANGUAGE en TEMP_SENSOR_COOLER 1 EXTRUDERS 0 TEMP_SENSOR_1 0 opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT EEPROM_SETTINGS EEPROM_BOOT_SILENT EEPROM_AUTO_INIT \ - LASER_FEATURE LASER_COOLANT_FLOW_METER + LASER_FEATURE AIR_EVACUATION AIR_EVACUATION_PIN AIR_ASSIST AIR_ASSIST_PIN LASER_COOLANT_FLOW_METER -exec_test $1 $2 "REPRAP MEGA2560 RAMPS | Laser Feature | Cooler | Flowmeter | 44780 LCD " "$3" +exec_test $1 $2 "REPRAP MEGA2560 RAMPS | Laser Feature | Air Evacuation | Air Assist | Cooler | Flowmeter | 44780 LCD " "$3" # # Language files test with REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER