From d5ad51821ccb2c2750a8823b810b2e232f4250e7 Mon Sep 17 00:00:00 2001 From: Scott Lahteine <github@thinkyhead.com> Date: Tue, 23 Jan 2018 22:21:52 -0600 Subject: [PATCH] Simplify G-code debug option --- Marlin/gcode.cpp | 8 +------- Marlin/gcode.h | 13 +++++++------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Marlin/gcode.cpp b/Marlin/gcode.cpp index 817640745d3..8b3f25241c7 100644 --- a/Marlin/gcode.cpp +++ b/Marlin/gcode.cpp @@ -211,13 +211,7 @@ void GCodeParser::parse(char *p) { #endif #if ENABLED(FASTER_GCODE_PARSER) - { - set(code, has_num ? p : NULL // Set parameter exists and pointer (NULL for no number) - #if ENABLED(DEBUG_GCODE_PARSER) - , debug - #endif - ); - } + set(code, has_num ? p : NULL); // Set parameter exists and pointer (NULL for no number) #endif } else if (!string_arg) { // Not A-Z? First time, keep as the string_arg diff --git a/Marlin/gcode.h b/Marlin/gcode.h index 52cedeb65bf..eb2d304c925 100644 --- a/Marlin/gcode.h +++ b/Marlin/gcode.h @@ -116,17 +116,13 @@ public: } // Set the flag and pointer for a parameter - static void set(const char c, char * const ptr - #if ENABLED(DEBUG_GCODE_PARSER) - , const bool debug=false - #endif - ) { + static void set(const char c, char * const ptr) { const uint8_t ind = LETTER_BIT(c); if (ind >= COUNT(param)) return; // Only A-Z SBI(codebits, ind); // parameter exists param[ind] = ptr ? ptr - command_ptr : 0; // parameter offset or 0 #if ENABLED(DEBUG_GCODE_PARSER) - if (debug) { + if (codenum == 800) { const uint16_t * const adr = (uint16_t*)&codebits; SERIAL_ECHOPAIR("Set bit ", (int)ind); SERIAL_ECHOPAIR(" of codebits (", hex_address((void*)adr[1])); @@ -143,6 +139,11 @@ public: if (ind >= COUNT(param)) return false; // Only A-Z const bool b = TEST(codebits, ind); if (b) { + #if ENABLED(DEBUG_GCODE_PARSER) + if (codenum == 800) { + SERIAL_CHAR('\''); SERIAL_CHAR(c); SERIAL_ECHOLNPGM("' is seen"); + } + #endif char * const ptr = command_ptr + param[ind]; value_ptr = param[ind] && valid_float(ptr) ? ptr : (char*)NULL; }