浏览代码

Add an SD Card stop function, use in ultralcd

Scott Lahteine 9 年前
父节点
当前提交
bbf5b486c3
共有 3 个文件被更改,包括 13 次插入6 次删除
  1. 7
    0
      Marlin/cardreader.cpp
  2. 1
    0
      Marlin/cardreader.h
  3. 5
    6
      Marlin/ultralcd.cpp

+ 7
- 0
Marlin/cardreader.cpp 查看文件

282
   if (sdprinting) sdprinting = false;
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
 void CardReader::openLogFile(char* name) {
292
 void CardReader::openLogFile(char* name) {
286
   logging = true;
293
   logging = true;
287
   openFile(name, false);
294
   openFile(name, false);

+ 1
- 0
Marlin/cardreader.h 查看文件

48
   void openAndPrintFile(const char *name);
48
   void openAndPrintFile(const char *name);
49
   void startFileprint();
49
   void startFileprint();
50
   void pauseSDPrint();
50
   void pauseSDPrint();
51
+  void stopSDPrint();
51
   void getStatus();
52
   void getStatus();
52
   void printingHasFinished();
53
   void printingHasFinished();
53
 
54
 

+ 5
- 6
Marlin/ultralcd.cpp 查看文件

496
     }
496
     }
497
 
497
 
498
     static void lcd_sdcard_stop() {
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
       clear_command_queue();
500
       clear_command_queue();
504
-      card.sdprinting = false;
505
-      card.closefile();
501
+      stepper.quick_stop();
506
       print_job_timer.stop();
502
       print_job_timer.stop();
507
       thermalManager.autotempShutdown();
503
       thermalManager.autotempShutdown();
508
       cancel_heatup = true;
504
       cancel_heatup = true;
509
       lcd_setstatus(MSG_PRINT_ABORTED, true);
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
   #endif //SDSUPPORT
511
   #endif //SDSUPPORT

正在加载...
取消
保存