Pārlūkot izejas kodu

Add M524 to abort SD printing (#12155)

TheSFReader 6 gadus atpakaļ
vecāks
revīzija
1fb9b299d4

+ 3
- 6
Marlin/src/Marlin.cpp Parādīt failu

972
 
972
 
973
     #if ENABLED(SDSUPPORT)
973
     #if ENABLED(SDSUPPORT)
974
       card.checkautostart();
974
       card.checkautostart();
975
-    #endif
976
-
977
-    #if ENABLED(SDSUPPORT) && (ENABLED(ULTIPANEL) || ENABLED(EXTENSIBLE_UI))
978
-      if (abort_sd_printing) {
979
-        abort_sd_printing = false;
975
+    
976
+      if (card.abort_sd_printing) {
980
         card.stopSDPrint(
977
         card.stopSDPrint(
981
           #if SD_RESORT
978
           #if SD_RESORT
982
             true
979
             true
992
           card.removeJobRecoveryFile();
989
           card.removeJobRecoveryFile();
993
         #endif
990
         #endif
994
       }
991
       }
995
-    #endif // SDSUPPORT && (ENABLED(ULTIPANEL) || ENABLED(EXTENSIBLE_UI))
992
+    #endif // SDSUPPORT
996
 
993
 
997
     if (commands_in_queue < BUFSIZE) get_available_commands();
994
     if (commands_in_queue < BUFSIZE) get_available_commands();
998
     advance_command_queue();
995
     advance_command_queue();

+ 4
- 0
Marlin/src/gcode/gcode.cpp Parādīt failu

584
         case 504: M504(); break;                                  // M504: Validate EEPROM contents
584
         case 504: M504(); break;                                  // M504: Validate EEPROM contents
585
       #endif
585
       #endif
586
 
586
 
587
+      #if ENABLED(SDSUPPORT)
588
+        case 524: M524(); break;                                   // M524: Abort the current SD print job
589
+      #endif
590
+      
587
       #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
591
       #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
588
         case 540: M540(); break;                                  // M540: Set abort on endstop hit for SD printing
592
         case 540: M540(); break;                                  // M540: Set abort on endstop hit for SD printing
589
       #endif
593
       #endif

+ 5
- 0
Marlin/src/gcode/gcode.h Parādīt failu

202
  * M501 - Restore parameters from EEPROM. (Requires EEPROM_SETTINGS)
202
  * M501 - Restore parameters from EEPROM. (Requires EEPROM_SETTINGS)
203
  * M502 - Revert to the default "factory settings". ** Does not write them to EEPROM! **
203
  * M502 - Revert to the default "factory settings". ** Does not write them to EEPROM! **
204
  * M503 - Print the current settings (in memory): "M503 S<verbose>". S0 specifies compact output.
204
  * M503 - Print the current settings (in memory): "M503 S<verbose>". S0 specifies compact output.
205
+ * M524 - Abort the current SD print job (started with M24)
205
  * M540 - Enable/disable SD card abort on endstop hit: "M540 S<state>". (Requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
206
  * M540 - Enable/disable SD card abort on endstop hit: "M540 S<state>". (Requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
206
  * M600 - Pause for filament change: "M600 X<pos> Y<pos> Z<raise> E<first_retract> L<later_retract>". (Requires ADVANCED_PAUSE_FEATURE)
207
  * M600 - Pause for filament change: "M600 X<pos> Y<pos> Z<raise> E<first_retract> L<later_retract>". (Requires ADVANCED_PAUSE_FEATURE)
207
  * M603 - Configure filament change: "M603 T<tool> U<unload_length> L<load_length>". (Requires ADVANCED_PAUSE_FEATURE)
208
  * M603 - Configure filament change: "M603 T<tool> U<unload_length> L<load_length>". (Requires ADVANCED_PAUSE_FEATURE)
719
     static void M504();
720
     static void M504();
720
   #endif
721
   #endif
721
 
722
 
723
+  #if ENABLED(SDSUPPORT)
724
+    static void M524();
725
+  #endif
726
+    
722
   #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
727
   #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
723
     static void M540();
728
     static void M540();
724
   #endif
729
   #endif

Marlin/src/gcode/sdcard/M20-M30_M32-M34_M928.cpp → Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp Parādīt failu

245
 #endif // SDCARD_SORT_ALPHA && SDSORT_GCODE
245
 #endif // SDCARD_SORT_ALPHA && SDSORT_GCODE
246
 
246
 
247
 /**
247
 /**
248
+ * M524: Abort the current SD print job (started with M24)
249
+ */
250
+void GcodeSuite::M524() {
251
+  if (IS_SD_PRINTING()) card.abort_sd_printing = true;
252
+}
253
+
254
+/**
248
  * M928: Start SD Write
255
  * M928: Start SD Write
249
  */
256
  */
250
 void GcodeSuite::M928() {
257
 void GcodeSuite::M928() {

+ 1
- 5
Marlin/src/lcd/extensible_ui/ui_api.cpp Parādīt failu

37
 #if ENABLED(SDSUPPORT)
37
 #if ENABLED(SDSUPPORT)
38
   #include "../../sd/cardreader.h"
38
   #include "../../sd/cardreader.h"
39
   #include "../../feature/emergency_parser.h"
39
   #include "../../feature/emergency_parser.h"
40
-
41
-  bool abort_sd_printing; // =false
42
-#else
43
-  constexpr bool abort_sd_printing = false;
44
 #endif
40
 #endif
45
 
41
 
46
 #if ENABLED(PRINTCOUNTER)
42
 #if ENABLED(PRINTCOUNTER)
476
   void stopPrint() {
472
   void stopPrint() {
477
     #if ENABLED(SDSUPPORT)
473
     #if ENABLED(SDSUPPORT)
478
       wait_for_heatup = wait_for_user = false;
474
       wait_for_heatup = wait_for_user = false;
479
-      abort_sd_printing = true;
475
+      card.abort_sd_printing = true;
480
       UI::onStatusChanged(PSTR(MSG_PRINT_ABORTED));
476
       UI::onStatusChanged(PSTR(MSG_PRINT_ABORTED));
481
     #endif
477
     #endif
482
   }
478
   }

+ 1
- 3
Marlin/src/lcd/ultralcd.cpp Parādīt failu

895
       lcd_reset_status();
895
       lcd_reset_status();
896
     }
896
     }
897
 
897
 
898
-    bool abort_sd_printing; // =false
899
-
900
     void lcd_sdcard_stop() {
898
     void lcd_sdcard_stop() {
901
       wait_for_heatup = wait_for_user = false;
899
       wait_for_heatup = wait_for_user = false;
902
-      abort_sd_printing = true;
900
+      card.abort_sd_printing = true;
903
       lcd_setstatusPGM(PSTR(MSG_PRINT_ABORTED), -1);
901
       lcd_setstatusPGM(PSTR(MSG_PRINT_ABORTED), -1);
904
       lcd_return_to_status();
902
       lcd_return_to_status();
905
     }
903
     }

+ 0
- 5
Marlin/src/lcd/ultralcd.h Parādīt failu

288
   void lcd_reselect_last_file();
288
   void lcd_reselect_last_file();
289
 #endif
289
 #endif
290
 
290
 
291
-#if (ENABLED(EXTENSIBLE_UI) || ENABLED(ULTIPANEL)) && ENABLED(SDSUPPORT)
292
-  extern bool abort_sd_printing;
293
-#else
294
-  constexpr bool abort_sd_printing = false;
295
-#endif
296
 
291
 
297
 #endif // ULTRALCD_H
292
 #endif // ULTRALCD_H

+ 1
- 1
Marlin/src/sd/cardreader.cpp Parādīt failu

351
   #if ENABLED(ADVANCED_PAUSE_FEATURE)
351
   #if ENABLED(ADVANCED_PAUSE_FEATURE)
352
     did_pause_print = 0;
352
     did_pause_print = 0;
353
   #endif
353
   #endif
354
-  sdprinting = false;
354
+  sdprinting = abort_sd_printing = false;
355
   if (isFileOpen()) file.close();
355
   if (isFileOpen()) file.close();
356
   #if SD_RESORT
356
   #if SD_RESORT
357
     if (re_sort) presort();
357
     if (re_sort) presort();

+ 1
- 1
Marlin/src/sd/cardreader.h Parādīt failu

149
   FORCE_INLINE char* longest_filename() { return longFilename[0] ? longFilename : filename; }
149
   FORCE_INLINE char* longest_filename() { return longFilename[0] ? longFilename : filename; }
150
 
150
 
151
 public:
151
 public:
152
-  bool saving, logging, sdprinting, cardOK, filenameIsDir;
152
+  bool saving, logging, sdprinting, cardOK, filenameIsDir, abort_sd_printing;
153
   char filename[FILENAME_LENGTH], longFilename[LONG_FILENAME_LENGTH];
153
   char filename[FILENAME_LENGTH], longFilename[LONG_FILENAME_LENGTH];
154
   int8_t autostart_index;
154
   int8_t autostart_index;
155
 private:
155
 private:

Notiek ielāde…
Atcelt
Saglabāt