Allow resume from pause with parking enabled (#12893)

Currently, Pause of an SD-Memory card print does not work.    This has been verified to resolve the issue by multiple people.   

I understand more work needs to be done to resolve some of the concerns...
This commit is contained in:
InsanityAutomation 2019-01-15 09:58:54 -05:00 committed by Roxy-3D
parent 85f149befe
commit 59b18aaeef
3 changed files with 34 additions and 18 deletions

View file

@ -31,6 +31,10 @@
#include "../../../sd/cardreader.h" #include "../../../sd/cardreader.h"
#include "../../../module/printcounter.h" #include "../../../module/printcounter.h"
#if HAS_LCD_MENU
#include "../../../lcd/ultralcd.h"
#endif
/** /**
* M125: Store current position and move to filament change position. * M125: Store current position and move to filament change position.
* Called on pause (by M25) to prevent material leaking onto the * Called on pause (by M25) to prevent material leaking onto the
@ -74,12 +78,17 @@ void GcodeSuite::M125() {
constexpr bool sd_printing = false; constexpr bool sd_printing = false;
#endif #endif
if (pause_print(retract, park_point)) { #if HAS_LCD_MENU
// SD Printing simply pauses, leaving the machine in a ready state, const bool show_lcd = parser.seenval('P');
// and can be resumed at any time, so don't wait in a loop here. lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT, ADVANCED_PAUSE_MODE_PAUSE_PRINT, active_extruder);
if (!sd_printing) { #else
wait_for_confirmation(); constexpr bool show_lcd = false;
resume_print(); #endif
if (pause_print(retract, park_point, 0, show_lcd)) {
if (!sd_printing || show_lcd ) {
wait_for_confirmation(false, 0);
resume_print(0, 0, PAUSE_PARK_RETRACT_LENGTH, 0);
} }
} }
} }

View file

@ -114,13 +114,15 @@ void GcodeSuite::M24() {
* M25: Pause SD Print * M25: Pause SD Print
*/ */
void GcodeSuite::M25() { void GcodeSuite::M25() {
// Set initial pause flag to prevent more commands from landing in the queue while we try to pause
#if ENABLED(SDSUPPORT)
if (IS_SD_PRINTING()) { card.pauseSDPrint(); }
#endif
#if ENABLED(PARK_HEAD_ON_PAUSE) #if ENABLED(PARK_HEAD_ON_PAUSE)
M125(); M125();
#else #else
#if ENABLED(SDSUPPORT)
if (IS_SD_PRINTING()) card.pauseSDPrint();
#endif
print_job_timer.pause(); print_job_timer.pause();
ui.reset_status(); ui.reset_status();

View file

@ -32,6 +32,7 @@
#include "../../module/temperature.h" #include "../../module/temperature.h"
#include "../../gcode/queue.h" #include "../../gcode/queue.h"
#include "../../module/printcounter.h" #include "../../module/printcounter.h"
#include "../../module/stepper.h"
#if ENABLED(POWER_LOSS_RECOVERY) #if ENABLED(POWER_LOSS_RECOVERY)
#include "../../feature/power_loss_recovery.h" #include "../../feature/power_loss_recovery.h"
@ -43,12 +44,14 @@ void lcd_pause() {
#endif #endif
#if ENABLED(PARK_HEAD_ON_PAUSE) #if ENABLED(PARK_HEAD_ON_PAUSE)
pause_print(PAUSE_PARK_RETRACT_LENGTH, NOZZLE_PARK_POINT, 0, true); lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT, ADVANCED_PAUSE_MODE_PAUSE_PRINT, active_extruder);
enqueue_and_echo_commands_P(PSTR("M25 P; \n M24"));
#elif ENABLED(SDSUPPORT) #elif ENABLED(SDSUPPORT)
enqueue_and_echo_commands_P(PSTR("M25")); enqueue_and_echo_commands_P(PSTR("M25"));
#elif defined(ACTION_ON_PAUSE) #elif defined(ACTION_ON_PAUSE)
SERIAL_ECHOLNPGM("//action:" ACTION_ON_PAUSE); SERIAL_ECHOLNPGM("//action:" ACTION_ON_PAUSE);
#endif #endif
planner.synchronize();
} }
void lcd_resume() { void lcd_resume() {
@ -97,14 +100,15 @@ void menu_main() {
if (busy) { if (busy) {
MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_pause); MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_pause);
MENU_ITEM(submenu, MSG_TUNE, menu_tune);
}
else {
MENU_ITEM(function, MSG_RESUME_PRINT, lcd_resume);
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
if (card.isFileOpen()) if (card.isFileOpen())
MENU_ITEM(submenu, MSG_STOP_PRINT, menu_sdcard_abort_confirm); MENU_ITEM(submenu, MSG_STOP_PRINT, menu_sdcard_abort_confirm);
#endif #endif
MENU_ITEM(submenu, MSG_TUNE, menu_tune);
}
else {
MENU_ITEM(function, MSG_RESUME_PRINT, lcd_resume);
MENU_ITEM(submenu, MSG_MOTION, menu_motion); MENU_ITEM(submenu, MSG_MOTION, menu_motion);
MENU_ITEM(submenu, MSG_TEMPERATURE, menu_temperature); MENU_ITEM(submenu, MSG_TEMPERATURE, menu_temperature);
} }
@ -154,11 +158,13 @@ void menu_main() {
MENU_ITEM(function, MSG_AUTOSTART, card.beginautostart); MENU_ITEM(function, MSG_AUTOSTART, card.beginautostart);
#endif #endif
if (card.isDetected() && !card.isFileOpen()) { if (card.isDetected()) {
if(!card.isFileOpen()) {
MENU_ITEM(submenu, MSG_CARD_MENU, menu_sdcard);
#if !PIN_EXISTS(SD_DETECT) #if !PIN_EXISTS(SD_DETECT)
MENU_ITEM(gcode, MSG_CHANGE_SDCARD, PSTR("M21")); // SD-card changed by user MENU_ITEM(gcode, MSG_CHANGE_SDCARD, PSTR("M21")); // SD-card changed by user
#endif #endif
MENU_ITEM(submenu, MSG_CARD_MENU, menu_sdcard); }
} }
else { else {
#if !PIN_EXISTS(SD_DETECT) #if !PIN_EXISTS(SD_DETECT)
@ -166,7 +172,6 @@ void menu_main() {
#endif #endif
MENU_ITEM(function, MSG_NO_CARD, NULL); MENU_ITEM(function, MSG_NO_CARD, NULL);
} }
#endif // SDSUPPORT #endif // SDSUPPORT
END_MENU(); END_MENU();