Browse Source

Parse N[0-9]+[ ]* differently (PR #2263)

More general solution to skip N[0-9]+[ ]* in the parser as in #2218
Scott Lahteine 9 years ago
parent
commit
ff6081be3a
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      Marlin/Marlin_main.cpp

+ 4
- 3
Marlin/Marlin_main.cpp View File

@@ -5254,12 +5254,13 @@ void process_next_command() {
5254 5254
 
5255 5255
   // Sanitize the current command:
5256 5256
   //  - Skip leading spaces
5257
-  //  - Bypass N...
5257
+  //  - Bypass N[0-9][0-9]*[ ]*
5258 5258
   //  - Overwrite * with nul to mark the end
5259 5259
   while (*current_command == ' ') ++current_command;
5260 5260
   if (*current_command == 'N' && current_command[1] >= '0' && current_command[1] <= '9') {
5261
-    while (*current_command != ' ' && *current_command != 'G' && *current_command != 'M' && *current_command != 'T') ++current_command;
5262
-    while (*current_command == ' ') ++current_command;
5261
+    current_command += 2; // skip N[0-9]
5262
+    while (*current_command >= '0' && *current_command <= '9') ++current_command; // skip [0-9]*
5263
+    while (*current_command == ' ') ++current_command; // skip [ ]*
5263 5264
   }
5264 5265
   char *starpos = strchr(current_command, '*');  // * should always be the last parameter
5265 5266
   if (starpos) *starpos = '\0';

Loading…
Cancel
Save