Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Laser Cutter Air Assist Feature #21753

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ec50d3d
Laser percent power
thinkyhead Dec 9, 2020
98799b5
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into bugfix-2.0.x
descipher Dec 14, 2020
74367bc
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into bugfix-2.0.x
descipher Dec 29, 2020
4a2dab7
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into bugfix-2.0.x
descipher Jan 25, 2021
aa713a1
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into bugfix-2.0.x
descipher Feb 1, 2021
2cc4d48
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into bugfix-2.0.x
descipher Feb 2, 2021
8db0a77
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into bugfix-2.0.x
descipher Mar 3, 2021
9dbc82f
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into bugfix-2.0.x
descipher Mar 5, 2021
329e211
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into bugfix-2.0.x
descipher Mar 12, 2021
80c48b0
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into bugfix-2.0.x
descipher Mar 16, 2021
a9a8bf5
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into bugfix-2.0.x
descipher Mar 24, 2021
245ffde
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into bugfix-2.0.x
descipher Mar 31, 2021
825d057
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into bugfix-2.0.x
descipher Apr 5, 2021
80ded6f
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into bugfix-2.0.x
descipher Apr 6, 2021
d00c06f
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into bugfix-2.0.x
descipher Apr 19, 2021
d9ee4c9
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into bugfix-2.0.x
descipher Apr 27, 2021
f443174
M10 and M11 do not need to be synced with planner
descipher Apr 29, 2021
9665d34
Add Air Assist menu and M8/M9 trigger
descipher Apr 29, 2021
af661ef
Planner Include
descipher Apr 29, 2021
d695214
Update Configuration_adv.h
descipher Apr 30, 2021
77fff0b
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into laser.menu.…
descipher Apr 30, 2021
cd5966b
Default AIR_ASSIST as disabled
descipher Apr 30, 2021
293a8d4
Cleanup
descipher Apr 30, 2021
a387cd8
Update spindle_laser.cpp
thinkyhead May 1, 2021
4bcbf46
Update spindle_laser.cpp
thinkyhead May 1, 2021
12cbaa5
Update M7-M9.cpp
thinkyhead May 1, 2021
77f7b90
Do not need planner include.
descipher May 1, 2021
3176a81
Add buildroot tests for Air Evacuation and Air Assist
descipher May 1, 2021
b8fed88
Spindle/Servo options cleanup
thinkyhead May 2, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

/**
Expand Down
16 changes: 15 additions & 1 deletion Marlin/src/feature/spindle_laser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
9 changes: 9 additions & 0 deletions Marlin/src/feature/spindle_laser.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,15 @@ class SpindleLaser {
}
#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
Expand Down
3 changes: 0 additions & 3 deletions Marlin/src/gcode/control/M10-M11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,19 @@
#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
}

/**
* 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
}

Expand Down
24 changes: 24 additions & 0 deletions Marlin/src/gcode/control/M7-M9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions Marlin/src/lcd/language/language_en.h
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
5 changes: 5 additions & 0 deletions Marlin/src/lcd/menu/menu_spindle_laser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions buildroot/tests/mega2560
Original file line number Diff line number Diff line change
Expand Up @@ -173,19 +173,19 @@ 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_ASSIST 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
#
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_ASSIST 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
Expand Down