Skip to content

Commit

Permalink
Tweak parser warning
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Feb 9, 2020
1 parent ffcbba4 commit 3887359
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
5 changes: 2 additions & 3 deletions Marlin/src/core/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/gcode/gcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand All @@ -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();
Expand Down
10 changes: 6 additions & 4 deletions Marlin/src/gcode/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ class GCodeParser {

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; }
Expand Down

0 comments on commit 3887359

Please sign in to comment.