Fix M118 parameters, with strict guideline

master
Scott Lahteine 7 years ago
parent 44edffa0a9
commit 30e4b85587

@ -8705,8 +8705,8 @@ inline void gcode_M117() { lcd_setstatus(parser.string_arg); }
/** /**
* M118: Display a message in the host console. * M118: Display a message in the host console.
* *
* A Append '// ' for an action command, as in OctoPrint * A1 Append '// ' for an action command, as in OctoPrint
* E Have the host 'echo:' the text * E1 Have the host 'echo:' the text
*/ */
inline void gcode_M118() { inline void gcode_M118() {
if (parser.boolval('E')) SERIAL_ECHO_START(); if (parser.boolval('E')) SERIAL_ECHO_START();

@ -150,7 +150,7 @@ void GCodeParser::parse(char *p) {
#endif #endif
// Only use string_arg for these M codes // 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) #if ENABLED(DEBUG_GCODE_PARSER)
const bool debug = codenum == 800; const bool debug = codenum == 800;
@ -162,6 +162,7 @@ void GCodeParser::parse(char *p) {
* Most codes ignore 'string_arg', but those that want a string will get the right pointer. * 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'. * 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!" * 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; string_arg = NULL;
while (char code = *p++) { // Get the next parameter. A NUL ends the loop while (char code = *p++) { // Get the next parameter. A NUL ends the loop

Loading…
Cancel
Save