Merge pull request #4076 from thinkyhead/rc_stop_print

Add an SD Card stop function, use in ultralcd
This commit is contained in:
Scott Lahteine 2016-06-17 18:53:29 -07:00 committed by GitHub
commit 599154f9e2
3 changed files with 13 additions and 6 deletions

View File

@ -282,6 +282,13 @@ void CardReader::pauseSDPrint() {
if (sdprinting) sdprinting = false; if (sdprinting) sdprinting = false;
} }
void CardReader::stopSDPrint() {
if (sdprinting) {
sdprinting = false;
file.close();
}
}
void CardReader::openLogFile(char* name) { void CardReader::openLogFile(char* name) {
logging = true; logging = true;
openFile(name, false); openFile(name, false);

View File

@ -48,6 +48,7 @@ public:
void openAndPrintFile(const char *name); void openAndPrintFile(const char *name);
void startFileprint(); void startFileprint();
void pauseSDPrint(); void pauseSDPrint();
void stopSDPrint();
void getStatus(); void getStatus();
void printingHasFinished(); void printingHasFinished();

View File

@ -496,17 +496,16 @@ static void lcd_status_screen() {
} }
static void lcd_sdcard_stop() { static void lcd_sdcard_stop() {
stepper.quick_stop(); card.stopSDPrint();
#if DISABLED(DELTA) && DISABLED(SCARA)
set_current_position_from_planner();
#endif // !DELTA && !SCARA
clear_command_queue(); clear_command_queue();
card.sdprinting = false; stepper.quick_stop();
card.closefile();
print_job_timer.stop(); print_job_timer.stop();
thermalManager.autotempShutdown(); thermalManager.autotempShutdown();
cancel_heatup = true; cancel_heatup = true;
lcd_setstatus(MSG_PRINT_ABORTED, true); lcd_setstatus(MSG_PRINT_ABORTED, true);
#if DISABLED(DELTA) && DISABLED(SCARA)
set_current_position_from_planner();
#endif // !DELTA && !SCARA
} }
#endif //SDSUPPORT #endif //SDSUPPORT