Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions Marlin/src/gcode/feature/pause/M125.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
#include "../../../sd/cardreader.h"
#include "../../../module/printcounter.h"

#if HAS_LCD_MENU
#include "../../../lcd/ultralcd.h"
#endif

/**
* M125: Store current position and move to filament change position.
* Called on pause (by M25) to prevent material leaking onto the
Expand Down Expand Up @@ -74,12 +78,17 @@ void GcodeSuite::M125() {
constexpr bool sd_printing = false;
#endif

if (pause_print(retract, park_point)) {
// SD Printing simply pauses, leaving the machine in a ready state,
// and can be resumed at any time, so don't wait in a loop here.
if (!sd_printing) {
wait_for_confirmation();
resume_print();
#if HAS_LCD_MENU
const bool show_lcd = parser.seenval('P');
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT, ADVANCED_PAUSE_MODE_PAUSE_PRINT, active_extruder);
#else
constexpr bool show_lcd = false;
#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);
}
}
}
Expand Down
10 changes: 6 additions & 4 deletions Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,15 @@ void GcodeSuite::M24() {
* M25: Pause SD Print
*/
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)
M125();
#else
#if ENABLED(SDSUPPORT)
if (IS_SD_PRINTING()) card.pauseSDPrint();
#endif

print_job_timer.pause();
ui.reset_status();

Expand Down
18 changes: 12 additions & 6 deletions Marlin/src/lcd/menu/menu_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "../../module/temperature.h"
#include "../../gcode/queue.h"
#include "../../module/printcounter.h"
#include "../../module/stepper.h"

#if ENABLED(POWER_LOSS_RECOVERY)
#include "../../feature/power_loss_recovery.h"
Expand All @@ -43,12 +44,14 @@ void lcd_pause() {
#endif

#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)
enqueue_and_echo_commands_P(PSTR("M25"));
#elif defined(ACTION_ON_PAUSE)
SERIAL_ECHOLNPGM("//action:" ACTION_ON_PAUSE);
#endif
planner.synchronize();
}

void lcd_resume() {
Expand Down Expand Up @@ -97,14 +100,15 @@ void menu_main() {

if (busy) {
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 (card.isFileOpen())
MENU_ITEM(submenu, MSG_STOP_PRINT, menu_sdcard_abort_confirm);
#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_TEMPERATURE, menu_temperature);
}
Expand Down Expand Up @@ -153,11 +157,13 @@ void menu_main() {
#endif

#if ENABLED(SDSUPPORT)
if (card.isDetected() && !card.isFileOpen()) {
if (card.isDetected()) {
if(!card.isFileOpen()) {
MENU_ITEM(submenu, MSG_CARD_MENU, menu_sdcard);
#if !PIN_EXISTS(SD_DETECT)
MENU_ITEM(gcode, MSG_CHANGE_SDCARD, PSTR("M21")); // SD-card changed by user
#endif
}
}
else {
MENU_ITEM(function, MSG_NO_CARD, NULL);
Expand Down