Sfoglia il codice sorgente

Abort SD printing more safely (#10407)

Allow the current command to complete when aborting an SD print, otherwise some commands (G28, G29, etc.) will cause trouble.
Scott Lahteine 7 anni fa
parent
commit
6c7a17dba6
Nessun account collegato all'indirizzo email del committer
3 ha cambiato i file con 29 aggiunte e 13 eliminazioni
  1. 20
    0
      Marlin/src/Marlin.cpp
  2. 3
    13
      Marlin/src/lcd/ultralcd.cpp
  3. 6
    0
      Marlin/src/lcd/ultralcd.h

+ 20
- 0
Marlin/src/Marlin.cpp Vedi File

898
   #endif
898
   #endif
899
 
899
 
900
   for (;;) {
900
   for (;;) {
901
+
902
+    #if ENABLED(SDSUPPORT) && ENABLED(ULTIPANEL)
903
+      if (abort_sd_printing) {
904
+        abort_sd_printing = false;
905
+        card.stopSDPrint(
906
+          #if SD_RESORT
907
+            true
908
+          #endif
909
+        );
910
+        clear_command_queue();
911
+        quickstop_stepper();
912
+        print_job_timer.stop();
913
+        thermalManager.disable_all_heaters();
914
+        #if FAN_COUNT > 0
915
+          for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0;
916
+        #endif
917
+        wait_for_heatup = false;
918
+      }
919
+    #endif // SDSUPPORT && ULTIPANEL
920
+
901
     if (commands_in_queue < BUFSIZE) get_available_commands();
921
     if (commands_in_queue < BUFSIZE) get_available_commands();
902
     advance_command_queue();
922
     advance_command_queue();
903
     endstops.report_state();
923
     endstops.report_state();

+ 3
- 13
Marlin/src/lcd/ultralcd.cpp Vedi File

836
       lcd_reset_status();
836
       lcd_reset_status();
837
     }
837
     }
838
 
838
 
839
+    bool abort_sd_printing; // =false
840
+
839
     void lcd_sdcard_stop() {
841
     void lcd_sdcard_stop() {
840
-      card.stopSDPrint(
841
-        #if SD_RESORT
842
-          true
843
-        #endif
844
-      );
845
-      clear_command_queue();
846
-      quickstop_stepper();
847
-      print_job_timer.stop();
848
-      thermalManager.disable_all_heaters();
849
-      #if FAN_COUNT > 0
850
-        for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0;
851
-      #endif
852
-      wait_for_heatup = false;
842
+      abort_sd_printing = true;
853
       lcd_setstatusPGM(PSTR(MSG_PRINT_ABORTED), -1);
843
       lcd_setstatusPGM(PSTR(MSG_PRINT_ABORTED), -1);
854
       lcd_return_to_status();
844
       lcd_return_to_status();
855
     }
845
     }

+ 6
- 0
Marlin/src/lcd/ultralcd.h Vedi File

261
   void lcd_reselect_last_file();
261
   void lcd_reselect_last_file();
262
 #endif
262
 #endif
263
 
263
 
264
+#if ENABLED(ULTIPANEL) && ENABLED(SDSUPPORT)
265
+  extern bool abort_sd_printing;
266
+#else
267
+  constexpr bool abort_sd_printing = false;
268
+#endif
269
+
264
 #endif // ULTRALCD_H
270
 #endif // ULTRALCD_H

Loading…
Annulla
Salva