Ver código fonte

Add an SD Card stop function, use in ultralcd

Scott Lahteine 8 anos atrás
pai
commit
bbf5b486c3
3 arquivos alterados com 13 adições e 6 exclusões
  1. 7
    0
      Marlin/cardreader.cpp
  2. 1
    0
      Marlin/cardreader.h
  3. 5
    6
      Marlin/ultralcd.cpp

+ 7
- 0
Marlin/cardreader.cpp Ver arquivo

@@ -282,6 +282,13 @@ void CardReader::pauseSDPrint() {
282 282
   if (sdprinting) sdprinting = false;
283 283
 }
284 284
 
285
+void CardReader::stopSDPrint() {
286
+  if (sdprinting) {
287
+    sdprinting = false;
288
+    file.close();
289
+  }
290
+}
291
+
285 292
 void CardReader::openLogFile(char* name) {
286 293
   logging = true;
287 294
   openFile(name, false);

+ 1
- 0
Marlin/cardreader.h Ver arquivo

@@ -48,6 +48,7 @@ public:
48 48
   void openAndPrintFile(const char *name);
49 49
   void startFileprint();
50 50
   void pauseSDPrint();
51
+  void stopSDPrint();
51 52
   void getStatus();
52 53
   void printingHasFinished();
53 54
 

+ 5
- 6
Marlin/ultralcd.cpp Ver arquivo

@@ -496,17 +496,16 @@ static void lcd_status_screen() {
496 496
     }
497 497
 
498 498
     static void lcd_sdcard_stop() {
499
-      stepper.quick_stop();
500
-      #if DISABLED(DELTA) && DISABLED(SCARA)
501
-        set_current_position_from_planner();
502
-      #endif // !DELTA && !SCARA
499
+      card.stopSDPrint();
503 500
       clear_command_queue();
504
-      card.sdprinting = false;
505
-      card.closefile();
501
+      stepper.quick_stop();
506 502
       print_job_timer.stop();
507 503
       thermalManager.autotempShutdown();
508 504
       cancel_heatup = true;
509 505
       lcd_setstatus(MSG_PRINT_ABORTED, true);
506
+      #if DISABLED(DELTA) && DISABLED(SCARA)
507
+        set_current_position_from_planner();
508
+      #endif // !DELTA && !SCARA
510 509
     }
511 510
 
512 511
   #endif //SDSUPPORT

Carregando…
Cancelar
Salvar