Browse Source

Fix pause/resume SD print

Followup to #12551, addressing #12566
pull/1/head
Scott Lahteine 6 years ago
parent
commit
261c6f4b96
  1. 5
      Marlin/src/gcode/feature/pause/M125.cpp
  2. 15
      Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp
  3. 2
      Marlin/src/lcd/menu/menu_main.cpp
  4. 4
      Marlin/src/libs/stopwatch.cpp
  5. 2
      Marlin/src/libs/stopwatch.h

5
Marlin/src/gcode/feature/pause/M125.cpp

@ -68,12 +68,13 @@ void GcodeSuite::M125() {
park_point.y += (active_extruder ? hotend_offset[Y_AXIS][active_extruder] : 0);
#endif
if (pause_print(retract, park_point)) {
#if ENABLED(SDSUPPORT)
const bool sd_printing = IS_SD_PRINTING() || parser.boolval('S'); // Undocumented parameter
const bool sd_printing = IS_SD_PRINTING();
#else
constexpr bool sd_printing = false;
#endif
if (pause_print(retract, park_point)) {
if (!sd_printing) {
wait_for_confirmation();
resume_print();

15
Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp

@ -91,17 +91,11 @@ void GcodeSuite::M24() {
#if ENABLED(POWER_LOSS_RECOVERY)
if (parser.seenval('S')) card.setIndex(parser.value_long());
if (parser.seenval('T')) print_job_timer.resume(parser.value_long());
#endif
card.startFileprint();
#if ENABLED(POWER_LOSS_RECOVERY)
if (parser.seenval('T'))
print_job_timer.resume(parser.value_long());
else
#endif
print_job_timer.start();
ui.reset_status();
}
@ -109,11 +103,12 @@ void GcodeSuite::M24() {
* M25: Pause SD Print
*/
void GcodeSuite::M25() {
#if ENABLED(PARK_HEAD_ON_PAUSE)
M125();
#else
card.pauseSDPrint();
print_job_timer.pause();
#if ENABLED(PARK_HEAD_ON_PAUSE)
enqueue_and_echo_commands_P(PSTR("M125 S")); // To be last in the buffer, must enqueue after pauseSDPrint
ui.reset_status();
#endif
}

2
Marlin/src/lcd/menu/menu_main.cpp

@ -54,8 +54,8 @@
#else
card.startFileprint();
print_job_timer.start();
#endif
ui.reset_status();
#endif
}
void lcd_sdcard_stop() {

4
Marlin/src/libs/stopwatch.cpp

@ -71,13 +71,13 @@ bool Stopwatch::start() {
else return false;
}
void Stopwatch::resume(const millis_t duration) {
void Stopwatch::resume(const millis_t with_time) {
#if ENABLED(DEBUG_STOPWATCH)
Stopwatch::debug(PSTR("resume"));
#endif
reset();
if ((accumulator = duration)) state = RUNNING;
if ((accumulator = with_time)) state = RUNNING;
}
void Stopwatch::reset() {

2
Marlin/src/libs/stopwatch.h

@ -75,7 +75,7 @@ class Stopwatch {
* @brief Resume the stopwatch
* @details Resume a timer from a given duration
*/
static void resume(const millis_t duration);
static void resume(const millis_t with_time);
/**
* @brief Reset the stopwatch

Loading…
Cancel
Save