From 03ef2d6c82048564db284bc3965595c561bf5840 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 28 Nov 2018 19:28:31 -0600 Subject: [PATCH] Fix "paused" message and M125 called by M25 (#12551) --- Marlin/src/feature/pause.cpp | 14 ++++++-------- Marlin/src/gcode/feature/pause/M125.cpp | 9 +++++---- Marlin/src/gcode/feature/pause/M600.cpp | 5 ----- .../src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp | 2 +- Marlin/src/lcd/menu/menu_main.cpp | 7 +------ Marlin/src/lcd/ultralcd.cpp | 8 +++----- Marlin/src/module/temperature.cpp | 2 +- Marlin/src/sd/cardreader.cpp | 9 +++++++-- 8 files changed, 24 insertions(+), 32 deletions(-) diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 0736bfebd8..6d447cd221 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -45,10 +45,7 @@ #include "../feature/runout.h" #endif -#if HAS_LCD_MENU - #include "../lcd/ultralcd.h" -#endif - +#include "../lcd/ultralcd.h" #include "../libs/buzzer.h" #include "../libs/nozzle.h" #include "pause.h" @@ -531,7 +528,7 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le SERIAL_ECHOPAIR("\nextruder_duplication_enabled:", extruder_duplication_enabled); SERIAL_ECHOPAIR("\nactive_extruder:", active_extruder); SERIAL_ECHOPGM("\n\n"); - */ + //*/ if (!did_pause_print) return; @@ -590,9 +587,10 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le } #endif - #if ENABLED(ULTRA_LCD) - ui.reset_status(); - #endif + // Resume the print job timer if it was running + if (print_job_timer.isPaused()) print_job_timer.start(); + + ui.reset_status(); } #endif // ADVANCED_PAUSE_FEATURE diff --git a/Marlin/src/gcode/feature/pause/M125.cpp b/Marlin/src/gcode/feature/pause/M125.cpp index ed98b8fc2c..09e6195920 100644 --- a/Marlin/src/gcode/feature/pause/M125.cpp +++ b/Marlin/src/gcode/feature/pause/M125.cpp @@ -68,15 +68,16 @@ void GcodeSuite::M125() { park_point.y += (active_extruder ? hotend_offset[Y_AXIS][active_extruder] : 0); #endif - const bool job_running = print_job_timer.isRunning(), - sd_printing = IS_SD_PRINTING(); - if (pause_print(retract, park_point)) { + #if ENABLED(SDSUPPORT) + const bool sd_printing = IS_SD_PRINTING() || parser.boolval('S'); // Undocumented parameter + #else + constexpr bool sd_printing = false; + #endif if (!sd_printing) { wait_for_confirmation(); resume_print(); } - if (job_running) print_job_timer.start(); } } diff --git a/Marlin/src/gcode/feature/pause/M600.cpp b/Marlin/src/gcode/feature/pause/M600.cpp index 850bbb3441..0e01c9ddfe 100644 --- a/Marlin/src/gcode/feature/pause/M600.cpp +++ b/Marlin/src/gcode/feature/pause/M600.cpp @@ -129,8 +129,6 @@ void GcodeSuite::M600() { #endif ); - const bool job_running = print_job_timer.isRunning(); - if (pause_print(retract, park_point, unload_length, true DXC_PASS)) { wait_for_confirmation(true, beep_count DXC_PASS); resume_print(slow_load_length, fast_load_length, ADVANCED_PAUSE_PURGE_LENGTH, beep_count DXC_PASS); @@ -141,9 +139,6 @@ void GcodeSuite::M600() { if (active_extruder_before_filament_change != active_extruder) tool_change(active_extruder_before_filament_change, 0, true); #endif - - // Resume the print job timer if it was running - if (job_running) print_job_timer.start(); } #endif // ADVANCED_PAUSE_FEATURE diff --git a/Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp b/Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp index eac8707f99..a079a56356 100644 --- a/Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp +++ b/Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp @@ -113,7 +113,7 @@ void GcodeSuite::M25() { print_job_timer.pause(); #if ENABLED(PARK_HEAD_ON_PAUSE) - enqueue_and_echo_commands_P(PSTR("M125")); // Must be enqueued with pauseSDPrint set to be last in the buffer + enqueue_and_echo_commands_P(PSTR("M125 S")); // To be last in the buffer, must enqueue after pauseSDPrint #endif } diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index b08125f41d..2f02ff9149 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -45,12 +45,7 @@ #if ENABLED(POWER_LOSS_RECOVERY) if (recovery.enabled) recovery.save(true, false); #endif - card.pauseSDPrint(); - print_job_timer.pause(); - #if ENABLED(PARK_HEAD_ON_PAUSE) - enqueue_and_echo_commands_P(PSTR("M125")); - #endif - ui.reset_status(); + enqueue_and_echo_commands_P(PSTR("M25")); } void lcd_sdcard_resume() { diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index 640dc74ae7..6aba70e399 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -26,9 +26,7 @@ #if HAS_SPI_LCD || ENABLED(MALYAN_LCD) || ENABLED(EXTENSIBLE_UI) #include "ultralcd.h" MarlinUI ui; - #if ENABLED(SDSUPPORT) - #include "../sd/cardreader.h" - #endif + #include "../sd/cardreader.h" #if ENABLED(EXTENSIBLE_UI) #define START_OF_UTF8_CHAR(C) (((C) & 0xC0u) != 0x80u) #endif @@ -1243,7 +1241,7 @@ void MarlinUI::update() { static const char printing[] PROGMEM = MSG_PRINTING; static const char welcome[] PROGMEM = WELCOME_MSG; PGM_P msg; - if (print_job_timer.isPaused()) + if (!IS_SD_PRINTING() && print_job_timer.isPaused()) msg = paused; #if ENABLED(SDSUPPORT) else if (IS_SD_PRINTING()) @@ -1257,4 +1255,4 @@ void MarlinUI::update() { set_status_P(msg, -1); } -#endif +#endif // HAS_SPI_LCD || EXTENSIBLE_UI diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 71624a266b..eef5f442af 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -1922,7 +1922,7 @@ void Temperature::isr() { ; /** - * Standard PWM modulation + * Standard heater PWM modulation */ if (pwm_count_tmp >= 127) { pwm_count_tmp -= 127; diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index d8508ad70b..02ddf7f96f 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -1027,15 +1027,20 @@ void CardReader::printingHasFinished() { #if ENABLED(SD_FINISHED_STEPPERRELEASE) && defined(SD_FINISHED_RELEASECOMMAND) planner.finish_and_disable(); #endif + print_job_timer.stop(); - if (print_job_timer.duration() > 60) - enqueue_and_echo_commands_P(PSTR("M31")); + if (print_job_timer.duration() > 60) enqueue_and_echo_commands_P(PSTR("M31")); + #if ENABLED(SDCARD_SORT_ALPHA) presort(); #endif + #if ENABLED(ULTRA_LCD) && ENABLED(LCD_SET_PROGRESS_MANUALLY) ui.progress_bar_percent = 0; #endif + + ui.reset_status(); + #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) ui.reselect_last_file(); #endif