Tweak parser warning

This commit is contained in:
Scott Lahteine 2020-02-08 23:11:45 -06:00
parent ffcbba4447
commit 38873596ec
4 changed files with 12 additions and 11 deletions

View file

@ -260,8 +260,8 @@ extern uint8_t marlin_debug_flags;
#define SERIAL_ERROR_START() serial_error_start() #define SERIAL_ERROR_START() serial_error_start()
#define SERIAL_EOL() SERIAL_CHAR('\n') #define SERIAL_EOL() SERIAL_CHAR('\n')
#define SERIAL_ECHO_MSG(S) do{ SERIAL_ECHO_START(); SERIAL_ECHOLNPGM(S); }while(0) #define SERIAL_ECHO_MSG(V...) do{ SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR(V); }while(0)
#define SERIAL_ERROR_MSG(S) do{ SERIAL_ERROR_START(); SERIAL_ECHOLNPGM(S); }while(0) #define SERIAL_ERROR_MSG(V...) do{ SERIAL_ERROR_START(); SERIAL_ECHOLNPAIR(V); }while(0)
#define SERIAL_ECHO_SP(C) serial_spaces(C) #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 serial_spaces(uint8_t count);
void print_bin(const uint16_t val); 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); 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) { inline void print_xyz(const xyz_pos_t &xyz, PGM_P const prefix=nullptr, PGM_P const suffix=nullptr) {

View file

@ -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 case 800: parser.debug(); break; // G800: GCode Parser Test for G
#endif #endif
default: parser.unknown_command_error(); break; default: parser.unknown_command_warning(); break;
} }
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 case 7219: M7219(); break; // M7219: Set LEDs, columns, and rows
#endif #endif
default: parser.unknown_command_error(); break; default: parser.unknown_command_warning(); break;
} }
break; break;
@ -866,7 +866,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
#if ENABLED(WIFI_CUSTOM_COMMAND) #if ENABLED(WIFI_CUSTOM_COMMAND)
if (wifi_custom_command(parser.command_ptr)) break; if (wifi_custom_command(parser.command_ptr)) break;
#endif #endif
parser.unknown_command_error(); parser.unknown_command_warning();
} }
if (!no_ok) queue.ok_to_send(); if (!no_ok) queue.ok_to_send();

View file

@ -333,9 +333,8 @@ void GCodeParser::parse(char *p) {
#endif // CNC_COORDINATE_SYSTEMS #endif // CNC_COORDINATE_SYSTEMS
void GCodeParser::unknown_command_error() { void GCodeParser::unknown_command_warning() {
SERIAL_ECHO_START(); SERIAL_ECHO_MSG(MSG_UNKNOWN_COMMAND, command_ptr, "\"");
SERIAL_ECHOLNPAIR(MSG_UNKNOWN_COMMAND, command_ptr, "\"");
} }
#if ENABLED(DEBUG_GCODE_PARSER) #if ENABLED(DEBUG_GCODE_PARSER)
@ -351,7 +350,10 @@ void GCodeParser::unknown_command_error() {
#else #else
SERIAL_ECHOPAIR(" args: { ", command_args, " }"); SERIAL_ECHOPAIR(" args: { ", command_args, " }");
#endif #endif
if (string_arg) SERIAL_ECHOPAIR(" string: \"", string_arg, "\""); if (string_arg) {
SERIAL_ECHOPAIR(" string: \"", string_arg);
SERIAL_CHAR('"');
}
SERIAL_ECHOLNPGM("\n"); SERIAL_ECHOLNPGM("\n");
for (char c = 'A'; c <= 'Z'; ++c) { for (char c = 'A'; c <= 'Z'; ++c) {
if (seen(c)) { if (seen(c)) {

View file

@ -366,7 +366,7 @@ public:
static inline feedRate_t value_feedrate() { return MMM_TO_MMS(value_linear_units()); } 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 // 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; } static inline float floatval(const char c, const float dval=0.0) { return seenval(c) ? value_float() : dval; }