From 30976f977386d836c3d9f0a06632db4ace092a32 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 23 Jun 2015 17:50:09 -0700 Subject: [PATCH 1/4] Allow M110 to handle a second N argument --- Marlin/Marlin_main.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 9a7c29094..352a134b9 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -791,8 +791,17 @@ void get_command() { char *npos = strchr(command, 'N'); char *apos = strchr(command, '*'); if (npos) { + + boolean M110 = strstr_P(command, PSTR("M110")) != NULL; + + if (M110) { + char *n2pos = strchr(command + 4, 'N'); + if (n2pos) npos = n2pos; + } + gcode_N = strtol(npos + 1, NULL, 10); - if (gcode_N != gcode_LastN + 1 && strstr_P(command, PSTR("M110")) == NULL) { + + if (!M110 && gcode_N != gcode_LastN + 1) { gcode_line_error(PSTR(MSG_ERR_LINE_NO)); return; } From 862c72b030da076909e048d36cc2d33b8b6ad4a6 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 23 Jun 2015 17:57:38 -0700 Subject: [PATCH 2/4] Put the mandatory test of gcode_N first --- Marlin/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 352a134b9..69f65e737 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -801,7 +801,7 @@ void get_command() { gcode_N = strtol(npos + 1, NULL, 10); - if (!M110 && gcode_N != gcode_LastN + 1) { + if (gcode_N != gcode_LastN + 1 && !M110) { gcode_line_error(PSTR(MSG_ERR_LINE_NO)); return; } From aaad65ff5de9062cad44d5fe8b44cfd0ba2550cb Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 23 Jun 2015 20:46:25 -0700 Subject: [PATCH 3/4] Include a comment documenting M110 --- Marlin/Marlin_main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 69f65e737..72ff4db16 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -138,6 +138,7 @@ * M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating * Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling * IF AUTOTEMP is enabled, S B F. Exit autotemp by any M109 without F + * M110 - Set the current line number * M111 - Set debug flags with S. See flag bits defined in Marlin.h. * M112 - Emergency stop * M114 - Output current position to serial port From f6ca5a8da8c45627aaef4b513adbaa9a8479ba37 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 25 Jun 2015 16:29:17 -0700 Subject: [PATCH 4/4] Allow "M110 N123" without a checksum --- Marlin/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 72ff4db16..6b36b64ed 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -817,7 +817,7 @@ void get_command() { } // if no errors, continue parsing } - else { + else if (npos == command) { gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM)); return; }