Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
82 changes: 82 additions & 0 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2494,6 +2494,27 @@
*/
//#define CNC_COORDINATE_SYSTEMS

/**
* Drilling canned cycles
*
* Enables G81, G82, G83 for CNC Drilling
*
*/
//#define DRILLING_CANNED_CYCLES

/**
* 5x Conversion (developing)
*
* Enables M168 for 5 axis control
*
*/
//#define CNC_5X
#if ENABLED(CNC_5X)
#define A_5x // Enable A axis
//#define B_5x // Enable B axis
#define C_5x // Enable C axis
#endif

/**
* Auto-report temperatures with M155 S<seconds>
*/
Expand Down Expand Up @@ -2588,7 +2609,66 @@
* User-defined menu items that execute custom GCode
*/
//#define CUSTOM_USER_MENUS

#if ENABLED(CUSTOM_USER_MENUS)

#if ENABLED(SPINDLE_FEATURE)

#define CUSTOM_USER_MENU_TITLE "CNC Zeros"
#define USER_SCRIPT_DONE "Done"
#define USER_SCRIPT_AUDIBLE_FEEDBACK
//#define USER_SCRIPT_RETURN // Return to status screen after a script

#define USER_DESC_1 "Set G53"
#define USER_GCODE_1 "G28 \nG53 G92 X0 Y0 Z300 \nM500 \nG54 "

#define USER_DESC_2 "Set Zero G92 X Y"
#define USER_GCODE_2 "G92 X0 Y0 \nM500"

#define USER_DESC_3 "Probe Z"
#define USER_GCODE_3 "G91 \nG38.2 F200 Z-50 \nG92 Z20.2 \nG91 \nG1 Z3 \nG91 \nG38.2 F30 Z-10 \nG92 Z20.2 \nG91 \nG0 Z5 \nG90 \nM500"

#define USER_DESC_4 "Probe X+"
#define USER_GCODE_4 "G91 \nG38.2 F200 X50 Z-0.001 \nG92 X-20.2 \nG91 \nG1 X-3 \nG91 \nG38.2 F30 X10 Z-0.001 \nG92 X-20.2 \nG91 \nG0 X-5 \nG90 \nM500"

#define USER_DESC_5 "Probe Y+"
#define USER_GCODE_5 "G91 \nG38.2 F200 Y50 Z-0.001 \nG92 Y-20.2 \nG91 \nG1 Y-3 \nG91 \nG38.2 F30 Y10 Z-0.001 \nG92 Y-20.2 \nG91 \nG0 Y-5 \nG90 \nM500"

#define USER_DESC_6 "Probe X-"
#define USER_GCODE_6 "G91 \nG38.2 F200 X-50 Z-0.001 \nG92 X20.2 \nG91 \nG1 X3 \nG91 \nG38.2 F30 X-10 Z-0.001 \nG92 X20.2 \nG91 \nG0 X5 \nG90 \nM500"

#define USER_DESC_7 "Probe Y-"
#define USER_GCODE_7 "G91 \nG38.2 F200 Y-50 Z-0.001 \nG92 Y20.2 \nG91 \nG1 Y3 \nG91 \nG38.2 F30 Y-10 Z-0.001 \nG92 Y20.2 \nG91 \nG0 Y5 \nG90 \nM500"

#define USER_DESC_8 "Select G54"
#define USER_GCODE_8 "G54"

#define USER_DESC_9 "Select G55"
#define USER_GCODE_9 "G55"

#define USER_DESC_10 "Select G56"
#define USER_GCODE_10 "G56"

#define USER_DESC_11 "Select G57"
#define USER_GCODE_11 "G57"

#define USER_DESC_12 "Select G58"
#define USER_GCODE_12 "G58"

#define USER_DESC_13 "Select G59"
#define USER_GCODE_13 "G59"

#define USER_DESC_14 "Move X0 Y0"
#define USER_GCODE_14 "G00 X0 Y0"

#define USER_DESC_15 "Move Z0"
#define USER_GCODE_15 "G00 Z0"

#define USER_DESC_16 "Set Zero G92 Z"
#define USER_GCODE_16 "G92 Z0 \nM500"

#else

//#define CUSTOM_USER_MENU_TITLE "Custom Commands"
#define USER_SCRIPT_DONE "M117 User Script Done"
#define USER_SCRIPT_AUDIBLE_FEEDBACK
Expand All @@ -2610,6 +2690,8 @@
#define USER_GCODE_5 "G28\nM503"
#endif

#endif

/**
* Host Action Commands
*
Expand Down
10 changes: 10 additions & 0 deletions Marlin/src/gcode/gcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,12 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
#if ENABLED(GCODE_MOTION_MODES)
case 80: G80(); break; // G80: Reset the current motion mode
#endif

#if ENABLED(DRILLING_CANNED_CYCLES)
case 81: G81(); break;
case 82: G82(); break;
case 83: G83(); break;
#endif

case 90: set_relative_mode(false); break; // G90: Absolute Mode
case 91: set_relative_mode(true); break; // G91: Relative Mode
Expand Down Expand Up @@ -535,6 +541,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 166: M166(); break; // M166: Set Gradient Mix
#endif
#endif

#if ENABLED(CNC_5X)
case 168: M168(); break;
#endif

#if DISABLED(NO_VOLUMETRICS)
case 200: M200(); break; // M200: Set filament diameter, E to cubic units
Expand Down
14 changes: 14 additions & 0 deletions Marlin/src/gcode/gcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
* G38 - Probe in any direction using the Z_MIN_PROBE (Requires G38_PROBE_TARGET)
* G42 - Coordinated move to a mesh point (Requires MESH_BED_LEVELING, AUTO_BED_LEVELING_BLINEAR, or AUTO_BED_LEVELING_UBL)
* G80 - Cancel current motion mode (Requires GCODE_MOTION_MODES)
* G81 - Drilling Cycles - drilling (Requires DRILLING_CANNED_CYCLES)
* G82 - Drilling Cycles - spot drill (Requires DRILLING_CANNED_CYCLES)
* G83 - Drilling Cycles - pecking (Requires DRILLING_CANNED_CYCLES)
* G90 - Use Absolute Coordinates
* G91 - Use Relative Coordinates
* G92 - Set current position to coordinates given
Expand Down Expand Up @@ -157,6 +160,7 @@
* M164 - Commit the mix and save to a virtual tool (current, or as specified by 'S'). (Requires MIXING_EXTRUDER)
* M165 - Set the mix for the mixing extruder (and current virtual tool) with parameters ABCDHI. (Requires MIXING_EXTRUDER and DIRECT_MIXING_IN_G1)
* M166 - Set the Gradient Mix for the mixing extruder. (Requires GRADIENT_MIX)
* M168 - Use 5x Movement (developing)
* M190 - S<temp> Wait for bed current temp to reach target temp. ** Wait only when heating! **
* R<temp> Wait for bed current temp to reach target temp. ** Wait for heating or cooling. **
* M200 - Set filament diameter, D<diameter>, setting E axis units to cubic. (Use S0 to revert to linear units.)
Expand Down Expand Up @@ -467,6 +471,12 @@ class GcodeSuite {
#if ENABLED(GCODE_MOTION_MODES)
static void G80();
#endif

#if ENABLED(DRILLING_CANNED_CYCLES)
static void G81();
static void G82();
static void G83();
#endif

static void G92();

Expand Down Expand Up @@ -654,6 +664,10 @@ class GcodeSuite {
static void M166();
#endif
#endif

#if ENABLED(CNC_5X)
static void M168();
#endif

static void M200();
static void M201();
Expand Down
Loading