Browse Source

Optimize emergency parser check

Scott Lahteine 4 years ago
parent
commit
3ba374a29e
1 changed files with 4 additions and 5 deletions
  1. 4
    5
      Marlin/src/gcode/queue.cpp

+ 4
- 5
Marlin/src/gcode/queue.cpp View File

@@ -538,12 +538,11 @@ void GCodeQueue::get_serial_commands() {
538 538
 
539 539
         #if DISABLED(EMERGENCY_PARSER)
540 540
           // Process critical commands early
541
-          if (strcmp_P(command, PSTR("M108")) == 0) {
542
-            wait_for_heatup = false;
543
-            TERN_(HAS_LCD_MENU, wait_for_user = false);
541
+          if (command[0] == 'M') switch (command[3]) {
542
+            case '8': if (command[2] == '0' && command[1] == '1') { wait_for_heatup = false; TERN_(HAS_LCD_MENU, wait_for_user = false); } break;
543
+            case '2': if (command[2] == '1' && command[1] == '1') kill(M112_KILL_STR, nullptr, true); break;
544
+            case '0': if (command[1] == '4' && command[2] == '1') quickstop_stepper(); break;
544 545
           }
545
-          if (strcmp_P(command, PSTR("M112")) == 0) kill(M112_KILL_STR, nullptr, true);
546
-          if (strcmp_P(command, PSTR("M410")) == 0) quickstop_stepper();
547 546
         #endif
548 547
 
549 548
         #if defined(NO_TIMEOUTS) && NO_TIMEOUTS > 0

Loading…
Cancel
Save