Fix pause/resume SD print

Followup to #12551, addressing #12566
This commit is contained in:
Scott Lahteine 2018-11-30 19:22:56 -06:00
parent 2224a4d61a
commit 261c6f4b96
6 changed files with 18 additions and 22 deletions

View file

@ -92,4 +92,4 @@ bool load_filament(const float &slow_load_length=0, const float &fast_load_lengt
bool unload_filament(const float &unload_length, const bool show_lcd=false, const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_PAUSE_PRINT); bool unload_filament(const float &unload_length, const bool show_lcd=false, const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_PAUSE_PRINT);
#endif //ADVANCED_PAUSE_FEATURE #endif // ADVANCED_PAUSE_FEATURE

View file

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

View file

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

View file

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

View file

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

View file

@ -75,7 +75,7 @@ class Stopwatch {
* @brief Resume the stopwatch * @brief Resume the stopwatch
* @details Resume a timer from a given duration * @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 * @brief Reset the stopwatch