From 9686ffedeffa75ef3299512f9f032bcf216ec8b6 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 30 Dec 2017 04:03:41 -0600 Subject: [PATCH] Single pause flag also indicates SD print pause --- Marlin/src/Marlin.cpp | 2 +- Marlin/src/feature/pause.cpp | 19 +++++++++---------- Marlin/src/feature/pause.h | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index 7a6c65ffa9..a12cbdb25b 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -346,7 +346,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) { // Prevent steppers timing-out in the middle of M600 #if ENABLED(ADVANCED_PAUSE_FEATURE) && ENABLED(PAUSE_PARK_NO_STEPPER_TIMEOUT) - #define MOVE_AWAY_TEST !move_away_flag + #define MOVE_AWAY_TEST !did_pause_print #else #define MOVE_AWAY_TEST true #endif diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index f41e346ef5..92f4f9d6be 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -54,7 +54,6 @@ static float resume_position[XYZE]; #if ENABLED(SDSUPPORT) #include "../sd/cardreader.h" - static bool sd_print_paused = false; #endif #if HAS_BUZZER @@ -107,12 +106,12 @@ void do_pause_e_move(const float &length, const float fr) { // public: -bool move_away_flag = false; +uint8_t did_pause_print = 0; bool pause_print(const float &retract, const point_t &park_point, const float &unload_length/*=0*/, const int8_t max_beep_count/*=0*/, const bool show_lcd/*=false*/ ) { - if (move_away_flag) return false; // already paused + if (did_pause_print) return false; // already paused #ifdef ACTION_ON_PAUSE SERIAL_ECHOLNPGM("//action:" ACTION_ON_PAUSE); @@ -132,13 +131,13 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u } // Indicate that the printer is paused - move_away_flag = true; + ++did_pause_print; // Pause the print job and timer #if ENABLED(SDSUPPORT) if (IS_SD_PRINTING) { card.pauseSDPrint(); - sd_print_paused = true; + ++did_pause_print; } #endif print_job_timer.pause(); @@ -256,7 +255,7 @@ void wait_for_filament_reload(const int8_t max_beep_count/*=0*/) { void resume_print(const float &load_length/*=0*/, const float &initial_extrude_length/*=0*/, const int8_t max_beep_count/*=0*/) { bool nozzle_timed_out = false; - if (!move_away_flag) return; + if (!did_pause_print) return; // Re-enable the heaters if they timed out HOTEND_LOOP() { @@ -350,14 +349,14 @@ void resume_print(const float &load_length/*=0*/, const float &initial_extrude_l SERIAL_ECHOLNPGM("//action:" ACTION_ON_RESUME); #endif + --did_pause_print; + #if ENABLED(SDSUPPORT) - if (sd_print_paused) { + if (did_pause_print) { card.startFileprint(); - sd_print_paused = false; + --did_pause_print; } #endif - - move_away_flag = false; } #endif // ADVANCED_PAUSE_FEATURE || PARK_HEAD_ON_PAUSE diff --git a/Marlin/src/feature/pause.h b/Marlin/src/feature/pause.h index 2eb4eb44a8..c17a7a44da 100644 --- a/Marlin/src/feature/pause.h +++ b/Marlin/src/feature/pause.h @@ -30,7 +30,7 @@ #include "../libs/nozzle.h" -extern bool move_away_flag; +extern bool did_pause_print; bool pause_print(const float &retract, const point_t &park_point, const float &unload_length=0, const int8_t max_beep_count=0, const bool show_lcd=false