From 38873596ece459ae1d3b65bb8d7905287c3dae6a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 8 Feb 2020 23:11:45 -0600 Subject: [PATCH] Tweak parser warning --- Marlin/src/core/serial.h | 5 ++--- Marlin/src/gcode/gcode.cpp | 6 +++--- Marlin/src/gcode/parser.cpp | 10 ++++++---- Marlin/src/gcode/parser.h | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Marlin/src/core/serial.h b/Marlin/src/core/serial.h index c571faf37b..812ff5471f 100644 --- a/Marlin/src/core/serial.h +++ b/Marlin/src/core/serial.h @@ -260,8 +260,8 @@ extern uint8_t marlin_debug_flags; #define SERIAL_ERROR_START() serial_error_start() #define SERIAL_EOL() SERIAL_CHAR('\n') -#define SERIAL_ECHO_MSG(S) do{ SERIAL_ECHO_START(); SERIAL_ECHOLNPGM(S); }while(0) -#define SERIAL_ERROR_MSG(S) do{ SERIAL_ERROR_START(); SERIAL_ECHOLNPGM(S); }while(0) +#define SERIAL_ECHO_MSG(V...) do{ SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR(V); }while(0) +#define SERIAL_ERROR_MSG(V...) do{ SERIAL_ERROR_START(); SERIAL_ECHOLNPAIR(V); }while(0) #define SERIAL_ECHO_SP(C) serial_spaces(C) @@ -292,7 +292,6 @@ void serialprint_truefalse(const bool tf); void serial_spaces(uint8_t count); void print_bin(const uint16_t val); - void print_xyz(const float &x, const float &y, const float &z, PGM_P const prefix=nullptr, PGM_P const suffix=nullptr); inline void print_xyz(const xyz_pos_t &xyz, PGM_P const prefix=nullptr, PGM_P const suffix=nullptr) { diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 164ae931d3..06ab3af52a 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -353,7 +353,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 800: parser.debug(); break; // G800: GCode Parser Test for G #endif - default: parser.unknown_command_error(); break; + default: parser.unknown_command_warning(); break; } break; @@ -856,7 +856,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 7219: M7219(); break; // M7219: Set LEDs, columns, and rows #endif - default: parser.unknown_command_error(); break; + default: parser.unknown_command_warning(); break; } break; @@ -866,7 +866,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { #if ENABLED(WIFI_CUSTOM_COMMAND) if (wifi_custom_command(parser.command_ptr)) break; #endif - parser.unknown_command_error(); + parser.unknown_command_warning(); } if (!no_ok) queue.ok_to_send(); diff --git a/Marlin/src/gcode/parser.cpp b/Marlin/src/gcode/parser.cpp index 100bbae5ef..75f88df76b 100644 --- a/Marlin/src/gcode/parser.cpp +++ b/Marlin/src/gcode/parser.cpp @@ -333,9 +333,8 @@ void GCodeParser::parse(char *p) { #endif // CNC_COORDINATE_SYSTEMS -void GCodeParser::unknown_command_error() { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR(MSG_UNKNOWN_COMMAND, command_ptr, "\""); +void GCodeParser::unknown_command_warning() { + SERIAL_ECHO_MSG(MSG_UNKNOWN_COMMAND, command_ptr, "\""); } #if ENABLED(DEBUG_GCODE_PARSER) @@ -351,7 +350,10 @@ void GCodeParser::unknown_command_error() { #else SERIAL_ECHOPAIR(" args: { ", command_args, " }"); #endif - if (string_arg) SERIAL_ECHOPAIR(" string: \"", string_arg, "\""); + if (string_arg) { + SERIAL_ECHOPAIR(" string: \"", string_arg); + SERIAL_CHAR('"'); + } SERIAL_ECHOLNPGM("\n"); for (char c = 'A'; c <= 'Z'; ++c) { if (seen(c)) { diff --git a/Marlin/src/gcode/parser.h b/Marlin/src/gcode/parser.h index b4a18b364b..cce8abe5fd 100644 --- a/Marlin/src/gcode/parser.h +++ b/Marlin/src/gcode/parser.h @@ -366,7 +366,7 @@ public: static inline feedRate_t value_feedrate() { return MMM_TO_MMS(value_linear_units()); } - void unknown_command_error(); + void unknown_command_warning(); // Provide simple value accessors with default option static inline float floatval(const char c, const float dval=0.0) { return seenval(c) ? value_float() : dval; }