Single pause flag also indicates SD print pause

This commit is contained in:
Scott Lahteine 2017-12-30 04:03:41 -06:00
parent 6d94bbf618
commit 9686ffedef
3 changed files with 11 additions and 12 deletions

View file

@ -346,7 +346,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
// Prevent steppers timing-out in the middle of M600 // Prevent steppers timing-out in the middle of M600
#if ENABLED(ADVANCED_PAUSE_FEATURE) && ENABLED(PAUSE_PARK_NO_STEPPER_TIMEOUT) #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 #else
#define MOVE_AWAY_TEST true #define MOVE_AWAY_TEST true
#endif #endif

View file

@ -54,7 +54,6 @@ static float resume_position[XYZE];
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
#include "../sd/cardreader.h" #include "../sd/cardreader.h"
static bool sd_print_paused = false;
#endif #endif
#if HAS_BUZZER #if HAS_BUZZER
@ -107,12 +106,12 @@ void do_pause_e_move(const float &length, const float fr) {
// public: // 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*/, 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*/ 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 #ifdef ACTION_ON_PAUSE
SERIAL_ECHOLNPGM("//action:" 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 // Indicate that the printer is paused
move_away_flag = true; ++did_pause_print;
// Pause the print job and timer // Pause the print job and timer
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
if (IS_SD_PRINTING) { if (IS_SD_PRINTING) {
card.pauseSDPrint(); card.pauseSDPrint();
sd_print_paused = true; ++did_pause_print;
} }
#endif #endif
print_job_timer.pause(); 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*/) { 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; bool nozzle_timed_out = false;
if (!move_away_flag) return; if (!did_pause_print) return;
// Re-enable the heaters if they timed out // Re-enable the heaters if they timed out
HOTEND_LOOP() { 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); SERIAL_ECHOLNPGM("//action:" ACTION_ON_RESUME);
#endif #endif
--did_pause_print;
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
if (sd_print_paused) { if (did_pause_print) {
card.startFileprint(); card.startFileprint();
sd_print_paused = false; --did_pause_print;
} }
#endif #endif
move_away_flag = false;
} }
#endif // ADVANCED_PAUSE_FEATURE || PARK_HEAD_ON_PAUSE #endif // ADVANCED_PAUSE_FEATURE || PARK_HEAD_ON_PAUSE

View file

@ -30,7 +30,7 @@
#include "../libs/nozzle.h" #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, 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 const int8_t max_beep_count=0, const bool show_lcd=false