Browse Source

Tweak to gcode_line_error/return

Scott Lahteine 6 years ago
parent
commit
cea398849e
1 changed files with 8 additions and 16 deletions
  1. 8
    16
      Marlin/src/gcode/queue.cpp

+ 8
- 16
Marlin/src/gcode/queue.cpp View File

@@ -320,32 +320,24 @@ inline void get_serial_commands() {
320 320
 
321 321
           gcode_N = strtol(npos + 1, NULL, 10);
322 322
 
323
-          if (gcode_N != gcode_LastN + 1 && !M110) {
324
-            gcode_line_error(PSTR(MSG_ERR_LINE_NO), i);
325
-            return;
326
-          }
323
+          if (gcode_N != gcode_LastN + 1 && !M110)
324
+            return gcode_line_error(PSTR(MSG_ERR_LINE_NO), i);
327 325
 
328 326
           char *apos = strrchr(command, '*');
329 327
           if (apos) {
330 328
             uint8_t checksum = 0, count = uint8_t(apos - command);
331 329
             while (count) checksum ^= command[--count];
332
-            if (strtol(apos + 1, NULL, 10) != checksum) {
333
-              gcode_line_error(PSTR(MSG_ERR_CHECKSUM_MISMATCH), i);
334
-              return;
335
-            }
336
-          }
337
-          else {
338
-            gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM), i);
339
-            return;
330
+            if (strtol(apos + 1, NULL, 10) != checksum)
331
+              return gcode_line_error(PSTR(MSG_ERR_CHECKSUM_MISMATCH), i);
340 332
           }
333
+          else
334
+            return gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM), i);
341 335
 
342 336
           gcode_LastN = gcode_N;
343 337
         }
344 338
         #if ENABLED(SDSUPPORT)
345
-          else if (card.saving) {
346
-            gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM), i);
347
-            return;
348
-          }
339
+          else if (card.saving)
340
+            return gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM), i);
349 341
         #endif
350 342
 
351 343
         // Movement commands alert when stopped

Loading…
Cancel
Save