From ecffe92e2021c75b725d2403a5f59d4c874fb80d Mon Sep 17 00:00:00 2001
From: Scott Lahteine <sourcetree@thinkyhead.com>
Date: Wed, 6 Jul 2016 11:52:36 -0700
Subject: [PATCH] Group EMERGENCY_PARSER commands

---
 Marlin/Marlin_main.cpp | 65 +++++++++++++++++++-----------------------
 1 file changed, 30 insertions(+), 35 deletions(-)

diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp
index ab7ef8f05d..c4cdbb7315 100644
--- a/Marlin/Marlin_main.cpp
+++ b/Marlin/Marlin_main.cpp
@@ -4543,6 +4543,26 @@ inline void gcode_M105() {
    */
   inline void gcode_M108() { wait_for_heatup = false; }
 
+
+  /**
+   * M112: Emergency Stop
+   */
+  inline void gcode_M112() { kill(PSTR(MSG_KILLED)); }
+
+
+  /**
+   * M410: Quickstop - Abort all planned moves
+   *
+   * This will stop the carriages mid-move, so most likely they
+   * will be out of sync with the stepper position after this.
+   */
+  inline void gcode_M410() {
+    stepper.quick_stop();
+    #if DISABLED(DELTA) && DISABLED(SCARA)
+      set_current_position_from_planner();
+    #endif
+  }
+
 #endif
 
 /**
@@ -4815,13 +4835,6 @@ inline void gcode_M111() {
   SERIAL_EOL;
 }
 
-/**
- * M112: Emergency Stop
- */
-#if DISABLED(EMERGENCY_PARSER)
-  inline void gcode_M112() { kill(PSTR(MSG_KILLED)); }
-#endif
-
 #if ENABLED(HOST_KEEPALIVE_FEATURE)
 
   /**
@@ -5994,22 +6007,6 @@ inline void gcode_M400() { stepper.synchronize(); }
   }
 #endif
 
-/**
- * M410: Quickstop - Abort all planned moves
- *
- * This will stop the carriages mid-move, so most likely they
- * will be out of sync with the stepper position after this.
- */
-
-#if DISABLED(EMERGENCY_PARSER)
-  inline void gcode_M410() {
-    stepper.quick_stop();
-    #if DISABLED(DELTA) && DISABLED(SCARA)
-      set_current_position_from_planner();
-    #endif
-  }
-#endif
-
 #if ENABLED(MESH_BED_LEVELING)
 
   /**
@@ -6965,9 +6962,19 @@ void process_next_command() {
         break;
 
       #if DISABLED(EMERGENCY_PARSER)
+
+        case 108: // M108: Cancel Waiting
+          gcode_M108();
+          break;
+
         case 112: // M112: Emergency Stop
           gcode_M112();
           break;
+
+        case 410: // M410 quickstop - Abort all the planned moves.
+          gcode_M410();
+          break;
+
       #endif
 
       #if ENABLED(HOST_KEEPALIVE_FEATURE)
@@ -6987,12 +6994,6 @@ void process_next_command() {
         KEEPALIVE_STATE(NOT_BUSY);
         return; // "ok" already printed
 
-      #if DISABLED(EMERGENCY_PARSER)
-        case 108:
-          gcode_M108();
-          break;
-      #endif
-
       case 109: // M109: Wait for temperature
         gcode_M109();
         break;
@@ -7276,12 +7277,6 @@ void process_next_command() {
           break;
       #endif // ENABLED(FILAMENT_WIDTH_SENSOR)
 
-      #if DISABLED(EMERGENCY_PARSER)
-        case 410: // M410 quickstop - Abort all the planned moves.
-          gcode_M410();
-          break;
-      #endif
-
       #if ENABLED(MESH_BED_LEVELING)
         case 420: // M420 Enable/Disable Mesh Bed Leveling
           gcode_M420();
-- 
GitLab