M10-M11 Air Evacuation for Spindle/Laser (#21668)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
parent
a866a8f2fb
commit
b8aeaa3bf4
@ -3160,6 +3160,12 @@
|
|||||||
|
|
||||||
#define SPINDLE_LASER_FREQUENCY 2500 // (Hz) Spindle/laser frequency (only on supported HALs: AVR and LPC)
|
#define SPINDLE_LASER_FREQUENCY 2500 // (Hz) Spindle/laser frequency (only on supported HALs: AVR and LPC)
|
||||||
|
|
||||||
|
//#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
|
||||||
|
#endif
|
||||||
|
|
||||||
//#define SPINDLE_SERVO // A servo converting an angle to spindle power
|
//#define SPINDLE_SERVO // A servo converting an angle to spindle power
|
||||||
#ifdef SPINDLE_SERVO
|
#ifdef SPINDLE_SERVO
|
||||||
#define SPINDLE_SERVO_NR 0 // Index of servo used for spindle control
|
#define SPINDLE_SERVO_NR 0 // Index of servo used for spindle control
|
||||||
|
@ -68,6 +68,9 @@ void SpindleLaser::init() {
|
|||||||
set_pwm_frequency(pin_t(SPINDLE_LASER_PWM_PIN), SPINDLE_LASER_FREQUENCY);
|
set_pwm_frequency(pin_t(SPINDLE_LASER_PWM_PIN), SPINDLE_LASER_FREQUENCY);
|
||||||
TERN_(MARLIN_DEV_MODE, frequency = SPINDLE_LASER_FREQUENCY);
|
TERN_(MARLIN_DEV_MODE, frequency = SPINDLE_LASER_FREQUENCY);
|
||||||
#endif
|
#endif
|
||||||
|
#if ENABLED(AIR_EVACUATION)
|
||||||
|
OUT_WRITE(AIR_EVACUATION_PIN, !AIR_EVACUATION_ACTIVE); // Init Vacuum/Blower OFF
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(SPINDLE_LASER_PWM)
|
#if ENABLED(SPINDLE_LASER_PWM)
|
||||||
@ -135,4 +138,15 @@ void SpindleLaser::apply_power(const uint8_t opwr) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ENABLED(AIR_EVACUATION)
|
||||||
|
|
||||||
|
// Enable / disable Cutter Vacuum or Laser Blower motor
|
||||||
|
void SpindleLaser::air_evac_enable() { WRITE(AIR_EVACUATION_PIN, AIR_EVACUATION_ACTIVE); } // Turn ON
|
||||||
|
|
||||||
|
void SpindleLaser::air_evac_disable() { WRITE(AIR_EVACUATION_PIN, !AIR_EVACUATION_ACTIVE); } // Turn OFF
|
||||||
|
|
||||||
|
void SpindleLaser::air_evac_toggle() { TOGGLE(AIR_EVACUATION_PIN); } // Toggle state
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // HAS_CUTTER
|
#endif // HAS_CUTTER
|
||||||
|
@ -212,6 +212,15 @@ public:
|
|||||||
static bool is_reverse() { return false; }
|
static bool is_reverse() { return false; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ENABLED(AIR_EVACUATION)
|
||||||
|
static void air_evac_enable(); // Turn On Cutter Vacuum or Laser Blower motor
|
||||||
|
static void air_evac_disable(); // Turn Off Cutter Vacuum or Laser Blower motor
|
||||||
|
static void air_evac_toggle(); // Toggle Cutter Vacuum or Laser Blower motor
|
||||||
|
static inline bool air_evac_state() { // Get current state
|
||||||
|
return (READ(AIR_EVACUATION_PIN) == AIR_EVACUATION_ACTIVE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static inline void disable() { isReady = false; set_enabled(false); }
|
static inline void disable() { isReady = false; set_enabled(false); }
|
||||||
|
|
||||||
#if HAS_LCD_MENU
|
#if HAS_LCD_MENU
|
||||||
|
47
Marlin/src/gcode/control/M10-M11.cpp
Normal file
47
Marlin/src/gcode/control/M10-M11.cpp
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/**
|
||||||
|
* Marlin 3D Printer Firmware
|
||||||
|
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
|
*
|
||||||
|
* Based on Sprinter and grbl.
|
||||||
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
|
#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
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // AIR_EVACUATION
|
@ -432,6 +432,10 @@ 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 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 4: M3_M4(true ); break; // M4: Turn ON Laser | Spindle (counter-clockwise), set Power | Speed
|
||||||
case 5: M5(); break; // M5: Turn OFF Laser | Spindle
|
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
|
#endif
|
||||||
|
|
||||||
#if ENABLED(COOLANT_CONTROL)
|
#if ENABLED(COOLANT_CONTROL)
|
||||||
|
@ -86,6 +86,8 @@
|
|||||||
* M7 - Turn mist coolant ON. (Requires COOLANT_CONTROL)
|
* M7 - Turn mist coolant ON. (Requires COOLANT_CONTROL)
|
||||||
* M8 - Turn flood coolant ON. (Requires COOLANT_CONTROL)
|
* M8 - Turn flood coolant ON. (Requires COOLANT_CONTROL)
|
||||||
* M9 - Turn coolant OFF. (Requires COOLANT_CONTROL)
|
* M9 - Turn coolant OFF. (Requires COOLANT_CONTROL)
|
||||||
|
* M10 - Turn Vacuum or Blower motor ON (Requires AIR_EVACUATION)
|
||||||
|
* M11 - Turn Vacuum or Blower motor OFF (Requires AIR_EVACUATION)
|
||||||
* M12 - Set up closed loop control system. (Requires EXTERNAL_CLOSED_LOOP_CONTROLLER)
|
* M12 - Set up closed loop control system. (Requires EXTERNAL_CLOSED_LOOP_CONTROLLER)
|
||||||
* M16 - Expected printer check. (Requires EXPECTED_PRINTER_CHECK)
|
* M16 - Expected printer check. (Requires EXPECTED_PRINTER_CHECK)
|
||||||
* M17 - Enable/Power all stepper motors
|
* M17 - Enable/Power all stepper motors
|
||||||
@ -548,6 +550,10 @@ private:
|
|||||||
#if HAS_CUTTER
|
#if HAS_CUTTER
|
||||||
static void M3_M4(const bool is_M4);
|
static void M3_M4(const bool is_M4);
|
||||||
static void M5();
|
static void M5();
|
||||||
|
#if ENABLED(AIR_EVACUATION)
|
||||||
|
static void M10();
|
||||||
|
static void M11();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(COOLANT_CONTROL)
|
#if ENABLED(COOLANT_CONTROL)
|
||||||
|
@ -114,10 +114,12 @@ namespace Language_en {
|
|||||||
PROGMEM Language_Str MSG_LASER_POWER = _UxGT("Laser Power");
|
PROGMEM Language_Str MSG_LASER_POWER = _UxGT("Laser Power");
|
||||||
PROGMEM Language_Str MSG_SPINDLE_POWER = _UxGT("Spindle Pwr");
|
PROGMEM Language_Str MSG_SPINDLE_POWER = _UxGT("Spindle Pwr");
|
||||||
PROGMEM Language_Str MSG_LASER_TOGGLE = _UxGT("Toggle Laser");
|
PROGMEM Language_Str MSG_LASER_TOGGLE = _UxGT("Toggle Laser");
|
||||||
|
PROGMEM Language_Str MSG_LASER_EVAC_TOGGLE = _UxGT("Toggle Blower");
|
||||||
PROGMEM Language_Str MSG_LASER_PULSE_MS = _UxGT("Test Pulse ms");
|
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_LASER_FIRE_PULSE = _UxGT("Fire Pulse");
|
||||||
PROGMEM Language_Str MSG_FLOWMETER_FAULT = _UxGT("Coolant Flow Fault");
|
PROGMEM Language_Str MSG_FLOWMETER_FAULT = _UxGT("Coolant Flow Fault");
|
||||||
PROGMEM Language_Str MSG_SPINDLE_TOGGLE = _UxGT("Toggle Spindle");
|
PROGMEM Language_Str MSG_SPINDLE_TOGGLE = _UxGT("Toggle Spindle");
|
||||||
|
PROGMEM Language_Str MSG_SPINDLE_EVAC_TOGGLE = _UxGT("Toggle Vacuum");
|
||||||
PROGMEM Language_Str MSG_SPINDLE_FORWARD = _UxGT("Spindle Forward");
|
PROGMEM Language_Str MSG_SPINDLE_FORWARD = _UxGT("Spindle Forward");
|
||||||
PROGMEM Language_Str MSG_SPINDLE_REVERSE = _UxGT("Spindle Reverse");
|
PROGMEM Language_Str MSG_SPINDLE_REVERSE = _UxGT("Spindle Reverse");
|
||||||
PROGMEM Language_Str MSG_SWITCH_PS_ON = _UxGT("Switch Power On");
|
PROGMEM Language_Str MSG_SWITCH_PS_ON = _UxGT("Switch Power On");
|
||||||
|
@ -51,6 +51,11 @@
|
|||||||
editable.state = is_enabled;
|
editable.state = is_enabled;
|
||||||
EDIT_ITEM(bool, MSG_CUTTER(TOGGLE), &is_enabled, []{ if (editable.state) cutter.disable(); else cutter.enable_same_dir(); });
|
EDIT_ITEM(bool, MSG_CUTTER(TOGGLE), &is_enabled, []{ if (editable.state) cutter.disable(); else cutter.enable_same_dir(); });
|
||||||
|
|
||||||
|
#if ENABLED(AIR_EVACUATION)
|
||||||
|
bool evac_state = cutter.air_evac_state();
|
||||||
|
EDIT_ITEM(bool, MSG_CUTTER(EVAC_TOGGLE), &evac_state, cutter.air_evac_toggle);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLED(SPINDLE_CHANGE_DIR)
|
#if ENABLED(SPINDLE_CHANGE_DIR)
|
||||||
if (!is_enabled) {
|
if (!is_enabled) {
|
||||||
editable.state = is_rev;
|
editable.state = is_rev;
|
||||||
|
@ -164,6 +164,7 @@ SD_ABORT_ON_ENDSTOP_HIT = src_filter=+<src/gcode/config/M540.cpp>
|
|||||||
BAUD_RATE_GCODE = src_filter=+<src/gcode/config/M575.cpp>
|
BAUD_RATE_GCODE = src_filter=+<src/gcode/config/M575.cpp>
|
||||||
HAS_SMART_EFF_MOD = src_filter=+<src/gcode/config/M672.cpp>
|
HAS_SMART_EFF_MOD = src_filter=+<src/gcode/config/M672.cpp>
|
||||||
COOLANT_CONTROL = src_filter=+<src/gcode/control/M7-M9.cpp>
|
COOLANT_CONTROL = 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_SOFTWARE_ENDSTOPS = src_filter=+<src/gcode/control/M211.cpp>
|
||||||
HAS_DUPLICATION_MODE = src_filter=+<src/gcode/control/M605.cpp>
|
HAS_DUPLICATION_MODE = src_filter=+<src/gcode/control/M605.cpp>
|
||||||
LIN_ADVANCE = src_filter=+<src/gcode/feature/advance>
|
LIN_ADVANCE = src_filter=+<src/gcode/feature/advance>
|
||||||
|
@ -155,6 +155,7 @@ default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared>
|
|||||||
-<src/gcode/calibrate/M425.cpp>
|
-<src/gcode/calibrate/M425.cpp>
|
||||||
-<src/gcode/calibrate/M666.cpp>
|
-<src/gcode/calibrate/M666.cpp>
|
||||||
-<src/gcode/calibrate/M852.cpp>
|
-<src/gcode/calibrate/M852.cpp>
|
||||||
|
-<src/gcode/control/M10-M11.cpp>
|
||||||
-<src/gcode/control/M42.cpp> -<src/gcode/control/M226.cpp>
|
-<src/gcode/control/M42.cpp> -<src/gcode/control/M226.cpp>
|
||||||
-<src/gcode/config/M43.cpp>
|
-<src/gcode/config/M43.cpp>
|
||||||
-<src/gcode/config/M217.cpp>
|
-<src/gcode/config/M217.cpp>
|
||||||
|
Loading…
Reference in New Issue
Block a user