From e09c144674fffa39a0077a6af0bd6093eaa138b0 Mon Sep 17 00:00:00 2001 From: thesfreader Date: Fri, 5 Oct 2018 09:35:55 +0200 Subject: [PATCH 1/3] Add CNC-like G-code options --- Marlin/Configuration_adv.h | 9 ++++ Marlin/src/gcode/parser.cpp | 104 +++++++++++++++++++++++++++--------- Marlin/src/gcode/parser.h | 9 ++++ Marlin/src/gcode/queue.cpp | 49 ++++++++++++++--- 4 files changed, 139 insertions(+), 32 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 88a3df2d53..636a054e03 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1776,4 +1776,13 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE + +/** + * CNC Parsing options + * + * These options increase marlin's acceptance of non reprap dialects more in line with what laser cutter or drawing machine cams produce + */ +//#define PARENTHESE_COMMENTS // Enable Marlin to interpret parenthese delimited comments as such and ignore them +//#define STICKY_MOVE_MODE // Enable marlin to keep the current move mode (G0 G1 G2 G3 G5 G38.X) and use it even if receiving only parameters (X Y Z E F etc.) + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/gcode/parser.cpp b/Marlin/src/gcode/parser.cpp index 392532646c..0c51318600 100644 --- a/Marlin/src/gcode/parser.cpp +++ b/Marlin/src/gcode/parser.cpp @@ -53,6 +53,13 @@ int GCodeParser::codenum; #if USE_GCODE_SUBCODES uint8_t GCodeParser::subcode; #endif +#if ENABLED(STICKY_MOVE_MODE) + int GCodeParser::current_motion_mode_codenum; + #if USE_GCODE_SUBCODES + uint8_t GCodeParser::current_motion_mode_subcode; + #endif +#endif + #if ENABLED(FASTER_GCODE_PARSER) // Optimized Parameters @@ -118,36 +125,81 @@ void GCodeParser::parse(char *p) { } // Bail if the letter is not G, M, or T - switch (letter) { case 'G': case 'M': case 'T': break; default: return; } - - // Skip spaces to get the numeric part - while (*p == ' ') p++; - - // Bail if there's no command code number - if (!NUMERIC(*p)) return; - - // Save the command letter at this point - // A '?' signifies an unknown command - command_letter = letter; + switch(letter) { + case 'G': + case 'M': + case 'T': + + // Skip spaces to get the numeric part + while (*p == ' ') p++; + + // Bail if there's no command code number + if (!NUMERIC(*p)) return; + + // Save the command letter at this point + // A '?' signifies an unknown command + command_letter = letter; + + // Get the code number - integer digits only + codenum = 0; + do { + codenum *= 10, codenum += *p++ - '0'; + } while (NUMERIC(*p)); + + // Allow for decimal point in command + #if USE_GCODE_SUBCODES + if (*p == '.') { + p++; + while (NUMERIC(*p)) + subcode *= 10, subcode += *p++ - '0'; + } + #endif - // Get the code number - integer digits only - codenum = 0; - do { - codenum *= 10, codenum += *p++ - '0'; - } while (NUMERIC(*p)); + // Skip all spaces to get to the first argument, or nul + while (*p == ' ') p++; - // Allow for decimal point in command - #if USE_GCODE_SUBCODES - if (*p == '.') { - p++; - while (NUMERIC(*p)) - subcode *= 10, subcode += *p++ - '0'; - } - #endif + #if ENABLED(STICKY_MOVE_MODE) + if( letter == 'G' && (codenum < 4 || codenum == 5 || codenum == 38 || (codenum>=80 &&codenum < 90 ))) { + current_motion_mode_codenum = codenum; + #if USE_GCODE_SUBCODES + current_motion_mode_subcode = subcode; + #endif + } + #endif + break; + + #if ENABLED(STICKY_MOVE_MODE) + + case 'P': + case 'Q': + if (current_motion_mode_codenum != 5) + return; + case 'I': + case 'J': + case 'R': + if (current_motion_mode_codenum < 2) + return; + case 'X': + case 'Y': + case 'Z': + case 'E': + case 'F': + + command_letter = 'G'; + codenum = current_motion_mode_codenum; + #if USE_GCODE_SUBCODES + subcode = current_motion_mode_subcode; + #endif + + // Roll back one character before to use the current arg + p--; + break; + #endif // STICKY_MOVE_MODE - // Skip all spaces to get to the first argument, or nul - while (*p == ' ') p++; + default: return; + } + // The command parameters (if any) start here, for sure! #if DISABLED(FASTER_GCODE_PARSER) diff --git a/Marlin/src/gcode/parser.h b/Marlin/src/gcode/parser.h index eb67bf14a7..5939ea8a77 100644 --- a/Marlin/src/gcode/parser.h +++ b/Marlin/src/gcode/parser.h @@ -78,12 +78,21 @@ public: static char *command_ptr, // The command, so it can be echoed *string_arg; // string of command line + + static char command_letter; // G, M, or T static int codenum; // 123 #if USE_GCODE_SUBCODES static uint8_t subcode; // .1 #endif + #if ENABLED(STICKY_MOVE_MODE) + static int current_motion_mode_codenum; + #if USE_GCODE_SUBCODES + static uint8_t current_motion_mode_subcode; + #endif + #endif + #if ENABLED(DEBUG_GCODE_PARSER) static void debug(); #endif diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp index 8e30248853..6cbd0cc331 100644 --- a/Marlin/src/gcode/queue.cpp +++ b/Marlin/src/gcode/queue.cpp @@ -283,6 +283,9 @@ static int read_serial(const int index) { inline void get_serial_commands() { static char serial_line_buffer[NUM_SERIAL][MAX_CMD_SIZE]; static bool serial_comment_mode[NUM_SERIAL] = { false }; + #if ENABLED(PARENTHESE_COMMENTS) + static bool serial_comment_paranthese_mode[NUM_SERIAL] = { false }; + #endif // If the command buffer is empty for too long, // send "wait" to indicate Marlin is still waiting. @@ -311,6 +314,9 @@ inline void get_serial_commands() { if (serial_char == '\n' || serial_char == '\r') { serial_comment_mode[i] = false; // end of line == end of comment + #if ENABLED(PARENTHESE_COMMENTS) + serial_comment_paranthese_mode[i] = false; // end of line == end of comment + #endif // Skip empty lines and comments if (!serial_count[i]) { thermalManager.manage_heater(); continue; } @@ -404,12 +410,24 @@ inline void get_serial_commands() { } else if (serial_char == '\\') { // Handle escapes // if we have one more character, copy it over - if ((c = read_serial(i)) >= 0 && !serial_comment_mode[i]) + if ((c = read_serial(i)) >= 0 && !serial_comment_mode[i] + #if ENABLED(PARENTHESE_COMMENTS) + && ! serial_comment_paranthese_mode[i] + #endif + ) serial_line_buffer[i][serial_count[i]++] = (char)c; } else { // it's not a newline, carriage return or escape char - if (serial_char == ';') serial_comment_mode[i] = true; - if (!serial_comment_mode[i]) serial_line_buffer[i][serial_count[i]++] = serial_char; + if (serial_char == ';') serial_comment_mode[i] = true; + #if ENABLED(PARENTHESE_COMMENTS) + else if (serial_char == '(') serial_comment_paranthese_mode[i] = true; + else if (serial_char == ')') serial_comment_paranthese_mode[i] = false; + #endif + else if (!serial_comment_mode[i] + #if ENABLED(PARENTHESE_COMMENTS) + && ! serial_comment_paranthese_mode[i] + #endif + ) serial_line_buffer[i][serial_count[i]++] = serial_char; } } // for NUM_SERIAL } // queue has space, serial has data @@ -426,6 +444,9 @@ inline void get_serial_commands() { static bool stop_buffering = false, sd_comment_mode = false; + #if ENABLED(PARENTHESE_COMMENTS) + static bool sd_comment_parenthese_mode = false; + #endif if (!IS_SD_PRINTING) return; /** @@ -445,7 +466,11 @@ inline void get_serial_commands() { card_eof = card.eof(); if (card_eof || n == -1 || sd_char == '\n' || sd_char == '\r' - || ((sd_char == '#' || sd_char == ':') && !sd_comment_mode) + || ((sd_char == '#' || sd_char == ':') && !sd_comment_mode + #if ENABLED(PARENTHESE_COMMENTS) + && ! sd_comment_parenthese_mode + #endif + ) ) { if (card_eof) { @@ -481,6 +506,9 @@ inline void get_serial_commands() { if (sd_char == '#') stop_buffering = true; sd_comment_mode = false; // for new command + #if ENABLED(PARENTHESE_COMMENTS) + sd_comment_parenthese_mode = false; + #endif // Skip empty lines and comments if (!sd_count) { thermalManager.manage_heater(); continue; } @@ -497,8 +525,17 @@ inline void get_serial_commands() { */ } else { - if (sd_char == ';') sd_comment_mode = true; - if (!sd_comment_mode) command_queue[cmd_queue_index_w][sd_count++] = sd_char; + if (sd_char == ';') sd_comment_mode = true; + #if ENABLED(PARENTHESE_COMMENTS) + else if (sd_char == '(') sd_comment_parenthese_mode = true; + else if (sd_char == ')') sd_comment_parenthese_mode = false; + #endif + else if (!sd_comment_mode + #if ENABLED(PARENTHESE_COMMENTS) + && ! sd_comment_parenthese_mode + #endif + ) + command_queue[cmd_queue_index_w][sd_count++] = sd_char; } } } From 77b9a41f1ff60d3435dbaa92a8372980368db487 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 5 Oct 2018 19:15:10 -0500 Subject: [PATCH 2/3] Add G-code extensions to example configs --- .../config/examples/AlephObjects/TAZ4/Configuration_adv.h | 7 +++++++ Marlin/src/config/examples/Anet/A2/Configuration_adv.h | 7 +++++++ Marlin/src/config/examples/Anet/A2plus/Configuration_adv.h | 7 +++++++ Marlin/src/config/examples/Anet/A6/Configuration_adv.h | 7 +++++++ Marlin/src/config/examples/Anet/A8/Configuration_adv.h | 7 +++++++ .../examples/BIBO/TouchX/cyclops/Configuration_adv.h | 7 +++++++ .../examples/BIBO/TouchX/default/Configuration_adv.h | 7 +++++++ .../src/config/examples/BQ/Hephestos/Configuration_adv.h | 7 +++++++ .../src/config/examples/BQ/Hephestos_2/Configuration_adv.h | 7 +++++++ Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h | 7 +++++++ Marlin/src/config/examples/Cartesio/Configuration_adv.h | 7 +++++++ .../src/config/examples/Creality/CR-10/Configuration_adv.h | 7 +++++++ .../config/examples/Creality/CR-10S/Configuration_adv.h | 7 +++++++ .../config/examples/Creality/CR-10mini/Configuration_adv.h | 7 +++++++ .../src/config/examples/Creality/CR-8/Configuration_adv.h | 7 +++++++ .../config/examples/Creality/Ender-2/Configuration_adv.h | 7 +++++++ .../config/examples/Creality/Ender-3/Configuration_adv.h | 7 +++++++ .../config/examples/Creality/Ender-4/Configuration_adv.h | 7 +++++++ Marlin/src/config/examples/Einstart-S/Configuration_adv.h | 7 +++++++ Marlin/src/config/examples/Felix/Configuration_adv.h | 7 +++++++ .../config/examples/FolgerTech/i3-2020/Configuration_adv.h | 7 +++++++ .../src/config/examples/Formbot/Raptor/Configuration_adv.h | 7 +++++++ .../config/examples/Formbot/T_Rex_2+/Configuration_adv.h | 7 +++++++ .../config/examples/Formbot/T_Rex_3/Configuration_adv.h | 7 +++++++ .../examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h | 7 +++++++ .../examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h | 7 +++++++ .../config/examples/Infitary/i3-M508/Configuration_adv.h | 7 +++++++ Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h | 7 +++++++ Marlin/src/config/examples/MakerParts/Configuration_adv.h | 7 +++++++ Marlin/src/config/examples/Malyan/M150/Configuration_adv.h | 7 +++++++ Marlin/src/config/examples/Malyan/M200/Configuration_adv.h | 7 +++++++ .../examples/Micromake/C1/enhanced/Configuration_adv.h | 7 +++++++ Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h | 7 +++++++ Marlin/src/config/examples/RigidBot/Configuration_adv.h | 7 +++++++ Marlin/src/config/examples/SCARA/Configuration_adv.h | 7 +++++++ .../src/config/examples/Sanguinololu/Configuration_adv.h | 7 +++++++ Marlin/src/config/examples/TheBorg/Configuration_adv.h | 7 +++++++ Marlin/src/config/examples/TinyBoy2/Configuration_adv.h | 7 +++++++ Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h | 7 +++++++ .../examples/UltiMachine/Archim2/Configuration_adv.h | 7 +++++++ .../src/config/examples/Velleman/K8200/Configuration_adv.h | 7 +++++++ .../src/config/examples/Velleman/K8400/Configuration_adv.h | 7 +++++++ .../examples/Wanhao/Duplicator 6/Configuration_adv.h | 7 +++++++ .../examples/delta/Anycubic/Kossel/Configuration_adv.h | 7 +++++++ .../delta/FLSUN/auto_calibrate/Configuration_adv.h | 7 +++++++ .../config/examples/delta/FLSUN/kossel/Configuration_adv.h | 7 +++++++ .../examples/delta/FLSUN/kossel_mini/Configuration_adv.h | 7 +++++++ .../src/config/examples/delta/generic/Configuration_adv.h | 7 +++++++ .../config/examples/delta/kossel_mini/Configuration_adv.h | 7 +++++++ .../config/examples/delta/kossel_xl/Configuration_adv.h | 7 +++++++ .../config/examples/gCreate/gMax1.5+/Configuration_adv.h | 7 +++++++ Marlin/src/config/examples/makibox/Configuration_adv.h | 7 +++++++ .../src/config/examples/tvrrug/Round2/Configuration_adv.h | 7 +++++++ Marlin/src/config/examples/wt150/Configuration_adv.h | 7 +++++++ 54 files changed, 378 insertions(+) diff --git a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h index 40bf2c1878..77d66cff7b 100644 --- a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h +++ b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Anet/A2/Configuration_adv.h b/Marlin/src/config/examples/Anet/A2/Configuration_adv.h index 3967a8e746..3ad44c8aea 100644 --- a/Marlin/src/config/examples/Anet/A2/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A2/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Anet/A2plus/Configuration_adv.h b/Marlin/src/config/examples/Anet/A2plus/Configuration_adv.h index 3967a8e746..3ad44c8aea 100644 --- a/Marlin/src/config/examples/Anet/A2plus/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A2plus/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h index 793f661093..ccf5574a29 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h index 92bad26e64..28dd9fe5b5 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h b/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h index c7c8a16a9d..84c101cdd4 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h +++ b/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h b/Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h index 4ea5cc3ea4..3e08e878ae 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h +++ b/Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h index 330f447352..c82fdbf442 100644 --- a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h index 0c40af37d2..ff74739c5c 100644 --- a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h @@ -1601,6 +1601,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h index 330f447352..c82fdbf442 100644 --- a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Cartesio/Configuration_adv.h b/Marlin/src/config/examples/Cartesio/Configuration_adv.h index 143fb18cc4..2f398ef009 100644 --- a/Marlin/src/config/examples/Cartesio/Configuration_adv.h +++ b/Marlin/src/config/examples/Cartesio/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h index 028857f481..6bc8774030 100755 --- a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h @@ -1596,6 +1596,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h index f7e3387b3e..4688ca4f30 100644 --- a/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h index 318fcd5ac5..4e0469829d 100644 --- a/Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h index a118fe1f7c..f3a149df1d 100644 --- a/Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h b/Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h index 8aa836b8d8..52ca32dd01 100644 --- a/Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h b/Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h index 69ef271feb..6a23b885a1 100644 --- a/Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h b/Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h index a118fe1f7c..f3a149df1d 100644 --- a/Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Einstart-S/Configuration_adv.h b/Marlin/src/config/examples/Einstart-S/Configuration_adv.h index 1c074c9b72..84ecc2a0de 100644 --- a/Marlin/src/config/examples/Einstart-S/Configuration_adv.h +++ b/Marlin/src/config/examples/Einstart-S/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Felix/Configuration_adv.h b/Marlin/src/config/examples/Felix/Configuration_adv.h index f0eef0c551..e27b9d5735 100644 --- a/Marlin/src/config/examples/Felix/Configuration_adv.h +++ b/Marlin/src/config/examples/Felix/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h index 1504fdd11b..05f74dd32e 100644 --- a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h +++ b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Formbot/Raptor/Configuration_adv.h b/Marlin/src/config/examples/Formbot/Raptor/Configuration_adv.h index dc5291355c..ea43482245 100644 --- a/Marlin/src/config/examples/Formbot/Raptor/Configuration_adv.h +++ b/Marlin/src/config/examples/Formbot/Raptor/Configuration_adv.h @@ -1595,6 +1595,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration_adv.h b/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration_adv.h index 97311df671..116ed77ce0 100644 --- a/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration_adv.h +++ b/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration_adv.h @@ -1597,6 +1597,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration_adv.h b/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration_adv.h index ea9238b225..32728d27de 100644 --- a/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration_adv.h +++ b/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration_adv.h @@ -1598,6 +1598,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h index 0e95764817..1cf7f8c628 100644 --- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h +++ b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h index 0e95764817..1cf7f8c628 100644 --- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h +++ b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h index f715c61f01..6bc87f3654 100644 --- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h +++ b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h b/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h index a2ec109356..9dc320fce8 100644 --- a/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h +++ b/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/MakerParts/Configuration_adv.h b/Marlin/src/config/examples/MakerParts/Configuration_adv.h index 7a12be3f6d..46b0366ed2 100644 --- a/Marlin/src/config/examples/MakerParts/Configuration_adv.h +++ b/Marlin/src/config/examples/MakerParts/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h b/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h index 4e3a050dfe..84e2165b58 100644 --- a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h +++ b/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h b/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h index 2094752ab2..b6d10d66e0 100644 --- a/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h +++ b/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h index 13f97550cf..fff5f52d6b 100644 --- a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h +++ b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h index f146cdb80a..71e09dd1cc 100644 --- a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h +++ b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h @@ -1601,6 +1601,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/RigidBot/Configuration_adv.h b/Marlin/src/config/examples/RigidBot/Configuration_adv.h index a71a9a81d0..7389c64807 100644 --- a/Marlin/src/config/examples/RigidBot/Configuration_adv.h +++ b/Marlin/src/config/examples/RigidBot/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/SCARA/Configuration_adv.h b/Marlin/src/config/examples/SCARA/Configuration_adv.h index dd667f0bb7..caf82e2bda 100644 --- a/Marlin/src/config/examples/SCARA/Configuration_adv.h +++ b/Marlin/src/config/examples/SCARA/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h index 41dd7218ac..47d458e59c 100644 --- a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h +++ b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/TheBorg/Configuration_adv.h b/Marlin/src/config/examples/TheBorg/Configuration_adv.h index 8cd4081633..9ffea94e66 100644 --- a/Marlin/src/config/examples/TheBorg/Configuration_adv.h +++ b/Marlin/src/config/examples/TheBorg/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h index 947f057371..1586d9b792 100644 --- a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h +++ b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h b/Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h index a4eaea42f8..73bd14fb18 100644 --- a/Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h +++ b/Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h index 29bb95289e..2a9fa17b7a 100644 --- a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h +++ b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h b/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h index d1b20263a9..61deda0467 100644 --- a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h +++ b/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h @@ -1606,6 +1606,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h index c479880d9e..781a0be68e 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h +++ b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h b/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h index b97d0b43e7..8098ac9099 100644 --- a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h +++ b/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h @@ -1595,6 +1595,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration_adv.h b/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration_adv.h index f6160fed92..3e89abf51f 100644 --- a/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration_adv.h @@ -1595,6 +1595,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h index 57af4af00a..0ae5a10a6a 100644 --- a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h @@ -1595,6 +1595,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h index 57af4af00a..0ae5a10a6a 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h @@ -1595,6 +1595,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h index eaa28eb8a3..8b91961135 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h @@ -1595,6 +1595,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/delta/generic/Configuration_adv.h b/Marlin/src/config/examples/delta/generic/Configuration_adv.h index eaa28eb8a3..8b91961135 100644 --- a/Marlin/src/config/examples/delta/generic/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/generic/Configuration_adv.h @@ -1595,6 +1595,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h index eaa28eb8a3..8b91961135 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h @@ -1595,6 +1595,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h index d5c7df792f..3e4147a5a9 100644 --- a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h @@ -1595,6 +1595,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h index 365ae3792e..6d8d7eba89 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h +++ b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/makibox/Configuration_adv.h b/Marlin/src/config/examples/makibox/Configuration_adv.h index 8af856f1e3..b634f016a4 100644 --- a/Marlin/src/config/examples/makibox/Configuration_adv.h +++ b/Marlin/src/config/examples/makibox/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h index fa3b4be542..66e4b393ed 100644 --- a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h @@ -1593,6 +1593,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/config/examples/wt150/Configuration_adv.h b/Marlin/src/config/examples/wt150/Configuration_adv.h index 184ca8cfa2..63a3a50b66 100644 --- a/Marlin/src/config/examples/wt150/Configuration_adv.h +++ b/Marlin/src/config/examples/wt150/Configuration_adv.h @@ -1594,6 +1594,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ From 52a37913c16ab50a0c35e34a4c597bd1428edc7e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 5 Oct 2018 18:19:45 -0500 Subject: [PATCH 3/3] Extend and apply some corrections --- Marlin/Configuration_adv.h | 16 ++- Marlin/src/config/default/Configuration_adv.h | 7 ++ Marlin/src/gcode/gcode.cpp | 4 + Marlin/src/gcode/gcode.h | 5 + Marlin/src/gcode/host/M115.cpp | 14 +++ Marlin/src/gcode/motion/G80.cpp | 36 +++++++ Marlin/src/gcode/parser.cpp | 98 ++++++++++--------- Marlin/src/gcode/parser.h | 18 ++-- Marlin/src/gcode/queue.cpp | 76 +++++++------- buildroot/share/tests/STM32F1_tests | 5 +- 10 files changed, 173 insertions(+), 106 deletions(-) create mode 100644 Marlin/src/gcode/motion/G80.cpp diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 636a054e03..71769db3fb 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1594,6 +1594,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ @@ -1776,13 +1783,4 @@ // Enable Marlin dev mode which adds some special commands //#define MARLIN_DEV_MODE - -/** - * CNC Parsing options - * - * These options increase marlin's acceptance of non reprap dialects more in line with what laser cutter or drawing machine cams produce - */ -//#define PARENTHESE_COMMENTS // Enable Marlin to interpret parenthese delimited comments as such and ignore them -//#define STICKY_MOVE_MODE // Enable marlin to keep the current move mode (G0 G1 G2 G3 G5 G38.X) and use it even if receiving only parameters (X Y Z E F etc.) - #endif // CONFIGURATION_ADV_H diff --git a/Marlin/src/config/default/Configuration_adv.h b/Marlin/src/config/default/Configuration_adv.h index 88a3df2d53..71769db3fb 100755 --- a/Marlin/src/config/default/Configuration_adv.h +++ b/Marlin/src/config/default/Configuration_adv.h @@ -1594,6 +1594,13 @@ */ #define FASTER_GCODE_PARSER +/** + * CNC G-code options + * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. + */ +//#define PAREN_COMMENTS // Support for parentheses-delimited comments +//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. + /** * User-defined menu items that execute custom GCode */ diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 7e1a7f80cf..36a01c1f7f 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -263,6 +263,10 @@ void GcodeSuite::process_parsed_command( break; #endif + #if ENABLED(GCODE_MOTION_MODES) + case 80: G80(); break; // G80: Reset the current motion mode + #endif + case 90: relative_mode = false; break; // G90: Relative Mode case 91: relative_mode = true; break; // G91: Absolute Mode diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 7340e3b9bf..106b980e7c 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -65,6 +65,7 @@ * G33 - Delta Auto-Calibration (Requires DELTA_AUTO_CALIBRATION) * 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) * G90 - Use Absolute Coordinates * G91 - Use Relative Coordinates * G92 - Set current position to coordinates given @@ -428,6 +429,10 @@ private: static void G59(); #endif + #if ENABLED(GCODE_MOTION_MODES) + static void G80(); + #endif + static void G92(); #if HAS_RESUME_CONTINUE diff --git a/Marlin/src/gcode/host/M115.cpp b/Marlin/src/gcode/host/M115.cpp index 04a592266f..8f30773246 100644 --- a/Marlin/src/gcode/host/M115.cpp +++ b/Marlin/src/gcode/host/M115.cpp @@ -153,5 +153,19 @@ void GcodeSuite::M115() { #endif ); + // PAREN_COMMENTS + cap_line(PSTR("PAREN_COMMENTS") + #if ENABLED(PAREN_COMMENTS) + , true + #endif + ); + + // MOTION_MODES (M80-M89) + cap_line(PSTR("MOTION_MODES") + #if ENABLED(GCODE_MOTION_MODES) + , true + #endif + ); + #endif // EXTENDED_CAPABILITIES_REPORT } diff --git a/Marlin/src/gcode/motion/G80.cpp b/Marlin/src/gcode/motion/G80.cpp new file mode 100644 index 0000000000..983a46392d --- /dev/null +++ b/Marlin/src/gcode/motion/G80.cpp @@ -0,0 +1,36 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 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 . + * + */ + +#include "../../inc/MarlinConfigPre.h" + +#if ENABLED(GCODE_MOTION_MODES) + +/** + * G80: Cancel current motion mode + */ +void GcodeSuite::G80() { + + parser.cancel_motion_mode(); + +} + +#endif // GCODE_MOTION_MODES diff --git a/Marlin/src/gcode/parser.cpp b/Marlin/src/gcode/parser.cpp index 0c51318600..7c3fe76b60 100644 --- a/Marlin/src/gcode/parser.cpp +++ b/Marlin/src/gcode/parser.cpp @@ -50,16 +50,17 @@ char *GCodeParser::command_ptr, *GCodeParser::value_ptr; char GCodeParser::command_letter; int GCodeParser::codenum; + #if USE_GCODE_SUBCODES uint8_t GCodeParser::subcode; #endif -#if ENABLED(STICKY_MOVE_MODE) - int GCodeParser::current_motion_mode_codenum; - #if USE_GCODE_SUBCODES - uint8_t GCodeParser::current_motion_mode_subcode; + +#if ENABLED(GCODE_MOTION_MODES) + int16_t GCodeParser::motion_mode_codenum = -1; + #if USE_GCODE_SUBCODES + uint8_t GCodeParser::motion_mode_subcode; #endif #endif - #if ENABLED(FASTER_GCODE_PARSER) // Optimized Parameters @@ -124,12 +125,20 @@ void GCodeParser::parse(char *p) { starpos[1] = '\0'; } + #if ENABLED(GCODE_MOTION_MODES) + #if ENABLED(ARC_SUPPORT) + #define GTOP 3 + #else + #define GTOP 1 + #endif + #endif + // Bail if the letter is not G, M, or T - switch(letter) { - case 'G': - case 'M': - case 'T': - + // (or a valid parameter for the current motion mode) + switch (letter) { + + case 'G': case 'M': case 'T': + // Skip spaces to get the numeric part while (*p == ' ') p++; @@ -142,9 +151,7 @@ void GCodeParser::parse(char *p) { // Get the code number - integer digits only codenum = 0; - do { - codenum *= 10, codenum += *p++ - '0'; - } while (NUMERIC(*p)); + do { codenum *= 10, codenum += *p++ - '0'; } while (NUMERIC(*p)); // Allow for decimal point in command #if USE_GCODE_SUBCODES @@ -158,48 +165,43 @@ void GCodeParser::parse(char *p) { // Skip all spaces to get to the first argument, or nul while (*p == ' ') p++; - #if ENABLED(STICKY_MOVE_MODE) - if( letter == 'G' && (codenum < 4 || codenum == 5 || codenum == 38 || (codenum>=80 &&codenum < 90 ))) { - current_motion_mode_codenum = codenum; - #if USE_GCODE_SUBCODES - current_motion_mode_subcode = subcode; - #endif + #if ENABLED(GCODE_MOTION_MODES) + if (letter == 'G' && (codenum <= GTOP || codenum == 5 + #if ENABLED(G38_PROBE_TARGET) + || codenum == 38 + #endif + ) + ) { + motion_mode_codenum = codenum; + #if USE_GCODE_SUBCODES + motion_mode_subcode = subcode; + #endif } #endif + break; - - #if ENABLED(STICKY_MOVE_MODE) - - case 'P': - case 'Q': - if (current_motion_mode_codenum != 5) - return; - case 'I': - case 'J': - case 'R': - if (current_motion_mode_codenum < 2) - return; - case 'X': - case 'Y': - case 'Z': - case 'E': - case 'F': - - command_letter = 'G'; - codenum = current_motion_mode_codenum; - #if USE_GCODE_SUBCODES - subcode = current_motion_mode_subcode; + + #if ENABLED(GCODE_MOTION_MODES) + #if ENABLED(ARC_SUPPORT) + case 'I': case 'J': case 'R': + if (motion_mode_codenum != 2 && motion_mode_codenum != 3) return; #endif - - // Roll back one character before to use the current arg - p--; - break; - #endif // STICKY_MOVE_MODE + case 'P': case 'Q': + if (motion_mode_codenum != 5) return; + case 'X': case 'Y': case 'Z': case 'E': case 'F': + if (motion_mode_codenum < 0) return; + command_letter = 'G'; + codenum = motion_mode_codenum; + #if USE_GCODE_SUBCODES + subcode = motion_mode_subcode; + #endif + p--; // Back up one character to use the current parameter + break; + #endif // GCODE_MOTION_MODES - default: return; + default: return; } - // The command parameters (if any) start here, for sure! #if DISABLED(FASTER_GCODE_PARSER) diff --git a/Marlin/src/gcode/parser.h b/Marlin/src/gcode/parser.h index 5939ea8a77..b6044b216e 100644 --- a/Marlin/src/gcode/parser.h +++ b/Marlin/src/gcode/parser.h @@ -76,23 +76,21 @@ public: // Command line state static char *command_ptr, // The command, so it can be echoed - *string_arg; // string of command line - - - - static char command_letter; // G, M, or T + *string_arg, // string of command line + command_letter; // G, M, or T static int codenum; // 123 #if USE_GCODE_SUBCODES static uint8_t subcode; // .1 #endif - #if ENABLED(STICKY_MOVE_MODE) - static int current_motion_mode_codenum; - #if USE_GCODE_SUBCODES - static uint8_t current_motion_mode_subcode; + #if ENABLED(GCODE_MOTION_MODES) + static int16_t motion_mode_codenum; + #if USE_GCODE_SUBCODES + static uint8_t motion_mode_subcode; #endif + FORCE_INLINE static void cancel_motion_mode() { motion_mode_codenum = -1; } #endif - + #if ENABLED(DEBUG_GCODE_PARSER) static void debug(); #endif diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp index 6cbd0cc331..61d7c1d158 100644 --- a/Marlin/src/gcode/queue.cpp +++ b/Marlin/src/gcode/queue.cpp @@ -282,10 +282,11 @@ static int read_serial(const int index) { */ inline void get_serial_commands() { static char serial_line_buffer[NUM_SERIAL][MAX_CMD_SIZE]; - static bool serial_comment_mode[NUM_SERIAL] = { false }; - #if ENABLED(PARENTHESE_COMMENTS) - static bool serial_comment_paranthese_mode[NUM_SERIAL] = { false }; - #endif + static bool serial_comment_mode[NUM_SERIAL] = { false } + #if ENABLED(PAREN_COMMENTS) + , serial_comment_paren_mode[NUM_SERIAL] = { false } + #endif + ; // If the command buffer is empty for too long, // send "wait" to indicate Marlin is still waiting. @@ -313,9 +314,10 @@ inline void get_serial_commands() { */ if (serial_char == '\n' || serial_char == '\r') { - serial_comment_mode[i] = false; // end of line == end of comment - #if ENABLED(PARENTHESE_COMMENTS) - serial_comment_paranthese_mode[i] = false; // end of line == end of comment + // Start with comment mode off + serial_comment_mode[i] = false; + #if ENABLED(PAREN_COMMENTS) + serial_comment_paren_mode[i] = false; #endif // Skip empty lines and comments @@ -411,22 +413,22 @@ inline void get_serial_commands() { else if (serial_char == '\\') { // Handle escapes // if we have one more character, copy it over if ((c = read_serial(i)) >= 0 && !serial_comment_mode[i] - #if ENABLED(PARENTHESE_COMMENTS) - && ! serial_comment_paranthese_mode[i] - #endif - ) + #if ENABLED(PAREN_COMMENTS) + && !serial_comment_paren_mode[i] + #endif + ) serial_line_buffer[i][serial_count[i]++] = (char)c; } else { // it's not a newline, carriage return or escape char - if (serial_char == ';') serial_comment_mode[i] = true; - #if ENABLED(PARENTHESE_COMMENTS) - else if (serial_char == '(') serial_comment_paranthese_mode[i] = true; - else if (serial_char == ')') serial_comment_paranthese_mode[i] = false; - #endif - else if (!serial_comment_mode[i] - #if ENABLED(PARENTHESE_COMMENTS) - && ! serial_comment_paranthese_mode[i] + if (serial_char == ';') serial_comment_mode[i] = true; + #if ENABLED(PAREN_COMMENTS) + else if (serial_char == '(') serial_comment_paren_mode[i] = true; + else if (serial_char == ')') serial_comment_paren_mode[i] = false; #endif + else if (!serial_comment_mode[i] + #if ENABLED(PAREN_COMMENTS) + && ! serial_comment_paren_mode[i] + #endif ) serial_line_buffer[i][serial_count[i]++] = serial_char; } } // for NUM_SERIAL @@ -442,11 +444,12 @@ inline void get_serial_commands() { */ inline void get_sdcard_commands() { static bool stop_buffering = false, - sd_comment_mode = false; + sd_comment_mode = false + #if ENABLED(PAREN_COMMENTS) + , sd_comment_paren_mode = false + #endif + ; - #if ENABLED(PARENTHESE_COMMENTS) - static bool sd_comment_parenthese_mode = false; - #endif if (!IS_SD_PRINTING) return; /** @@ -467,9 +470,9 @@ inline void get_serial_commands() { if (card_eof || n == -1 || sd_char == '\n' || sd_char == '\r' || ((sd_char == '#' || sd_char == ':') && !sd_comment_mode - #if ENABLED(PARENTHESE_COMMENTS) - && ! sd_comment_parenthese_mode - #endif + #if ENABLED(PAREN_COMMENTS) + && !sd_comment_paren_mode + #endif ) ) { if (card_eof) { @@ -506,8 +509,8 @@ inline void get_serial_commands() { if (sd_char == '#') stop_buffering = true; sd_comment_mode = false; // for new command - #if ENABLED(PARENTHESE_COMMENTS) - sd_comment_parenthese_mode = false; + #if ENABLED(PAREN_COMMENTS) + sd_comment_paren_mode = false; #endif // Skip empty lines and comments @@ -525,17 +528,16 @@ inline void get_serial_commands() { */ } else { - if (sd_char == ';') sd_comment_mode = true; - #if ENABLED(PARENTHESE_COMMENTS) - else if (sd_char == '(') sd_comment_parenthese_mode = true; - else if (sd_char == ')') sd_comment_parenthese_mode = false; + if (sd_char == ';') sd_comment_mode = true; + #if ENABLED(PAREN_COMMENTS) + else if (sd_char == '(') sd_comment_paren_mode = true; + else if (sd_char == ')') sd_comment_paren_mode = false; #endif else if (!sd_comment_mode - #if ENABLED(PARENTHESE_COMMENTS) - && ! sd_comment_parenthese_mode - #endif - ) - command_queue[cmd_queue_index_w][sd_count++] = sd_char; + #if ENABLED(PAREN_COMMENTS) + && ! sd_comment_paren_mode + #endif + ) command_queue[cmd_queue_index_w][sd_count++] = sd_char; } } } diff --git a/buildroot/share/tests/STM32F1_tests b/buildroot/share/tests/STM32F1_tests index 283e68d9b2..b9b91ff66d 100755 --- a/buildroot/share/tests/STM32F1_tests +++ b/buildroot/share/tests/STM32F1_tests @@ -5,8 +5,9 @@ set -e restore_configs opt_set MOTHERBOARD BOARD_STM32F1R -opt_enable EEPROM_SETTINGS EEPROM_CHITCHAT REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT -exec_test $1 $2 "STM32F1R EEPROM_SETTINGS EEPROM_CHITCHAT REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT" +opt_enable EEPROM_SETTINGS EEPROM_CHITCHAT REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT \ + PAREN_COMMENTS GCODE_MOTION_MODES +exec_test $1 $2 "STM32F1R EEPROM_SETTINGS EEPROM_CHITCHAT REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT PAREN_COMMENTS GCODE_MOTION_MODES" opt_enable SPINDLE_LASER_ENABLE exec_test $1 $2 "STM32F1R SPINDLE_LASER_ENABLE"