Browse Source

🚸 Emergency Parse M524 (#24761)

Arkadiusz Miśkiewicz 1 year ago
parent
commit
6c813fcd16
No account linked to committer's email address

+ 3
- 0
Marlin/src/feature/e_parser.cpp View File

@@ -33,6 +33,9 @@
33 33
 // Static data members
34 34
 bool EmergencyParser::killed_by_M112, // = false
35 35
      EmergencyParser::quickstop_by_M410,
36
+     #if ENABLED(SDSUPPORT)
37
+       EmergencyParser::sd_abort_by_M524,
38
+     #endif
36 39
      EmergencyParser::enabled;
37 40
 
38 41
 #if ENABLED(HOST_PROMPT_SUPPORT)

+ 19
- 1
Marlin/src/feature/e_parser.h View File

@@ -49,7 +49,7 @@ class EmergencyParser {
49 49
 
50 50
 public:
51 51
 
52
-  // Currently looking for: M108, M112, M410, M876 S[0-9], S000, P000, R000
52
+  // Currently looking for: M108, M112, M410, M524, M876 S[0-9], S000, P000, R000
53 53
   enum State : uint8_t {
54 54
     EP_RESET,
55 55
     EP_N,
@@ -58,6 +58,9 @@ public:
58 58
     EP_M10, EP_M108,
59 59
     EP_M11, EP_M112,
60 60
     EP_M4, EP_M41, EP_M410,
61
+    #if ENABLED(SDSUPPORT)
62
+      EP_M5, EP_M52, EP_M524,
63
+    #endif
61 64
     #if ENABLED(HOST_PROMPT_SUPPORT)
62 65
       EP_M8, EP_M87, EP_M876, EP_M876S, EP_M876SN,
63 66
     #endif
@@ -76,6 +79,10 @@ public:
76 79
   static bool killed_by_M112;
77 80
   static bool quickstop_by_M410;
78 81
 
82
+  #if ENABLED(SDSUPPORT)
83
+    static bool sd_abort_by_M524;
84
+  #endif
85
+
79 86
   #if ENABLED(HOST_PROMPT_SUPPORT)
80 87
     static uint8_t M876_reason;
81 88
   #endif
@@ -145,6 +152,9 @@ public:
145 152
           case ' ': break;
146 153
           case '1': state = EP_M1;     break;
147 154
           case '4': state = EP_M4;     break;
155
+          #if ENABLED(SDSUPPORT)
156
+            case '5': state = EP_M5;   break;
157
+          #endif
148 158
           #if ENABLED(HOST_PROMPT_SUPPORT)
149 159
             case '8': state = EP_M8;     break;
150 160
           #endif
@@ -165,6 +175,11 @@ public:
165 175
       case EP_M4:  state = (c == '1') ? EP_M41  : EP_IGNORE; break;
166 176
       case EP_M41: state = (c == '0') ? EP_M410 : EP_IGNORE; break;
167 177
 
178
+      #if ENABLED(SDSUPPORT)
179
+        case EP_M5:  state = (c == '2') ? EP_M52  : EP_IGNORE; break;
180
+        case EP_M52: state = (c == '4') ? EP_M524 : EP_IGNORE; break;
181
+      #endif
182
+
168 183
       #if ENABLED(HOST_PROMPT_SUPPORT)
169 184
 
170 185
         case EP_M8:  state = (c == '7') ? EP_M87  : EP_IGNORE; break;
@@ -200,6 +215,9 @@ public:
200 215
             case EP_M108: wait_for_user = wait_for_heatup = false; break;
201 216
             case EP_M112: killed_by_M112 = true; break;
202 217
             case EP_M410: quickstop_by_M410 = true; break;
218
+            #if ENABLED(SDSUPPORT)
219
+              case EP_M524: sd_abort_by_M524 = true; break;
220
+            #endif
203 221
             #if ENABLED(HOST_PROMPT_SUPPORT)
204 222
               case EP_M876SN: hostui.handle_response(M876_reason); break;
205 223
             #endif

+ 6
- 0
Marlin/src/module/temperature.cpp View File

@@ -1848,6 +1848,12 @@ void Temperature::task() {
1848 1848
       emergency_parser.quickstop_by_M410 = false; // quickstop_stepper may call idle so clear this now!
1849 1849
       quickstop_stepper();
1850 1850
     }
1851
+
1852
+    if (emergency_parser.sd_abort_by_M524) { // abort SD print immediately
1853
+      emergency_parser.sd_abort_by_M524 = false;
1854
+      card.flag.abort_sd_printing = true;
1855
+      gcode.process_subcommands_now(F("M524"));
1856
+    }
1851 1857
   #endif
1852 1858
 
1853 1859
   if (!updateTemperaturesIfReady()) return; // Will also reset the watchdog if temperatures are ready

Loading…
Cancel
Save