From e6aba99f162822a3e0d7016151719d4499e5a5ca Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 6 Nov 2017 22:57:01 -0600 Subject: [PATCH] Fix M118 parameters, with strict guideline --- Marlin/src/gcode/host/M118.cpp | 4 ++-- Marlin/src/gcode/parser.cpp | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Marlin/src/gcode/host/M118.cpp b/Marlin/src/gcode/host/M118.cpp index 30a41876f4..63e195ae63 100644 --- a/Marlin/src/gcode/host/M118.cpp +++ b/Marlin/src/gcode/host/M118.cpp @@ -25,8 +25,8 @@ /** * M118: Display a message in the host console. * - * A Append '// ' for an action command, as in OctoPrint - * E Have the host 'echo:' the text + * A1 Append '// ' for an action command, as in OctoPrint + * E1 Have the host 'echo:' the text */ void GcodeSuite::M118() { if (parser.boolval('E')) SERIAL_ECHO_START(); diff --git a/Marlin/src/gcode/parser.cpp b/Marlin/src/gcode/parser.cpp index 06dd8ffbdf..b71856b0a1 100644 --- a/Marlin/src/gcode/parser.cpp +++ b/Marlin/src/gcode/parser.cpp @@ -155,7 +155,7 @@ void GCodeParser::parse(char *p) { #endif // Only use string_arg for these M codes - if (letter == 'M') switch (codenum) { case 23: case 28: case 30: case 117: case 118: case 928: string_arg = p; return; default: break; } + if (letter == 'M') switch (codenum) { case 23: case 28: case 30: case 117: case 928: string_arg = p; return; default: break; } #if ENABLED(DEBUG_GCODE_PARSER) const bool debug = codenum == 800; @@ -167,6 +167,7 @@ void GCodeParser::parse(char *p) { * Most codes ignore 'string_arg', but those that want a string will get the right pointer. * The following loop assigns the first "parameter" having no numeric value to 'string_arg'. * This allows M0/M1 with expire time to work: "M0 S5 You Win!" + * For 'M118' you must use 'E1' and 'A1' rather than just 'E' or 'A' */ string_arg = NULL; while (char code = *p++) { // Get the next parameter. A NUL ends the loop