瀏覽代碼

Merge Implement M110 (PR#2327)

Richard Wackerbarth 10 年之前
父節點
當前提交
47b78ed1af
共有 1 個文件被更改,包括 12 次插入2 次删除
  1. 12
    2
      Marlin/Marlin_main.cpp

+ 12
- 2
Marlin/Marlin_main.cpp 查看文件

@@ -138,6 +138,7 @@
138 138
  * M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating
139 139
  *        Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling
140 140
  *        IF AUTOTEMP is enabled, S<mintemp> B<maxtemp> F<factor>. Exit autotemp by any M109 without F
141
+ * M110 - Set the current line number
141 142
  * M111 - Set debug flags with S<mask>. See flag bits defined in Marlin.h.
142 143
  * M112 - Emergency stop
143 144
  * M114 - Output current position to serial port
@@ -791,8 +792,17 @@ void get_command() {
791 792
       char *npos = strchr(command, 'N');
792 793
       char *apos = strchr(command, '*');
793 794
       if (npos) {
795
+
796
+        boolean M110 = strstr_P(command, PSTR("M110")) != NULL;
797
+
798
+        if (M110) {
799
+          char *n2pos = strchr(command + 4, 'N');
800
+          if (n2pos) npos = n2pos;
801
+        }
802
+
794 803
         gcode_N = strtol(npos + 1, NULL, 10);
795
-        if (gcode_N != gcode_LastN + 1 && strstr_P(command, PSTR("M110")) == NULL) {
804
+
805
+        if (gcode_N != gcode_LastN + 1 && !M110) {
796 806
           gcode_line_error(PSTR(MSG_ERR_LINE_NO));
797 807
           return;
798 808
         }
@@ -807,7 +817,7 @@ void get_command() {
807 817
           }
808 818
           // if no errors, continue parsing
809 819
         }
810
-        else {
820
+        else if (npos == command) {
811 821
           gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM));
812 822
           return;
813 823
         }

Loading…
取消
儲存