Browse Source

Move abortSDPrinting with others

Scott Lahteine 4 years ago
parent
commit
583fc4ee2a
1 changed files with 25 additions and 25 deletions
  1. 25
    25
      Marlin/src/Marlin.cpp

+ 25
- 25
Marlin/src/Marlin.cpp View File

@@ -378,6 +378,28 @@ void startOrResumeJob() {
378 378
   print_job_timer.start();
379 379
 }
380 380
 
381
+void abortSDPrinting() {
382
+  card.stopSDPrint(
383
+    #if SD_RESORT
384
+      true
385
+    #endif
386
+  );
387
+  queue.clear();
388
+  quickstop_stepper();
389
+  print_job_timer.stop();
390
+  #if DISABLED(SD_ABORT_NO_COOLDOWN)
391
+    thermalManager.disable_all_heaters();
392
+  #endif
393
+  thermalManager.zero_fan_speeds();
394
+  wait_for_heatup = false;
395
+  #if ENABLED(POWER_LOSS_RECOVERY)
396
+    card.removeJobRecoveryFile();
397
+  #endif
398
+  #ifdef EVENT_GCODE_SD_STOP
399
+    queue.inject_P(PSTR(EVENT_GCODE_SD_STOP));
400
+  #endif
401
+}
402
+
381 403
 /**
382 404
  * Manage several activities:
383 405
  *  - Check for Filament Runout
@@ -1124,34 +1146,12 @@ void loop() {
1124 1146
     idle(); // Do an idle first so boot is slightly faster
1125 1147
 
1126 1148
     #if ENABLED(SDSUPPORT)
1127
-
1128 1149
       card.checkautostart();
1129
-
1130
-      if (card.flag.abort_sd_printing) {
1131
-        card.stopSDPrint(
1132
-          #if SD_RESORT
1133
-            true
1134
-          #endif
1135
-        );
1136
-        queue.clear();
1137
-        quickstop_stepper();
1138
-        print_job_timer.stop();
1139
-        #if DISABLED(SD_ABORT_NO_COOLDOWN)
1140
-          thermalManager.disable_all_heaters();
1141
-        #endif
1142
-        thermalManager.zero_fan_speeds();
1143
-        wait_for_heatup = false;
1144
-        #if ENABLED(POWER_LOSS_RECOVERY)
1145
-          card.removeJobRecoveryFile();
1146
-        #endif
1147
-        #ifdef EVENT_GCODE_SD_STOP
1148
-          queue.inject_P(PSTR(EVENT_GCODE_SD_STOP));
1149
-        #endif
1150
-      }
1151
-
1152
-    #endif // SDSUPPORT
1150
+      if (card.flag.abort_sd_printing) abortSDPrinting();
1151
+    #endif
1153 1152
 
1154 1153
     queue.advance();
1154
+
1155 1155
     endstops.event_handler();
1156 1156
   }
1157 1157
 }

Loading…
Cancel
Save