Browse Source

Single pause flag also indicates SD print pause

Scott Lahteine 6 years ago
parent
commit
9686ffedef
3 changed files with 11 additions and 12 deletions
  1. 1
    1
      Marlin/src/Marlin.cpp
  2. 9
    10
      Marlin/src/feature/pause.cpp
  3. 1
    1
      Marlin/src/feature/pause.h

+ 1
- 1
Marlin/src/Marlin.cpp View File

@@ -346,7 +346,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
346 346
 
347 347
   // Prevent steppers timing-out in the middle of M600
348 348
   #if ENABLED(ADVANCED_PAUSE_FEATURE) && ENABLED(PAUSE_PARK_NO_STEPPER_TIMEOUT)
349
-    #define MOVE_AWAY_TEST !move_away_flag
349
+    #define MOVE_AWAY_TEST !did_pause_print
350 350
   #else
351 351
     #define MOVE_AWAY_TEST true
352 352
   #endif

+ 9
- 10
Marlin/src/feature/pause.cpp View File

@@ -54,7 +54,6 @@ static float resume_position[XYZE];
54 54
 
55 55
 #if ENABLED(SDSUPPORT)
56 56
   #include "../sd/cardreader.h"
57
-  static bool sd_print_paused = false;
58 57
 #endif
59 58
 
60 59
 #if HAS_BUZZER
@@ -107,12 +106,12 @@ void do_pause_e_move(const float &length, const float fr) {
107 106
 
108 107
 // public:
109 108
 
110
-bool move_away_flag = false;
109
+uint8_t did_pause_print = 0;
111 110
 
112 111
 bool pause_print(const float &retract, const point_t &park_point, const float &unload_length/*=0*/,
113 112
                  const int8_t max_beep_count/*=0*/, const bool show_lcd/*=false*/
114 113
 ) {
115
-  if (move_away_flag) return false; // already paused
114
+  if (did_pause_print) return false; // already paused
116 115
 
117 116
   #ifdef ACTION_ON_PAUSE
118 117
     SERIAL_ECHOLNPGM("//action:" ACTION_ON_PAUSE);
@@ -132,13 +131,13 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u
132 131
   }
133 132
 
134 133
   // Indicate that the printer is paused
135
-  move_away_flag = true;
134
+  ++did_pause_print;
136 135
 
137 136
   // Pause the print job and timer
138 137
   #if ENABLED(SDSUPPORT)
139 138
     if (IS_SD_PRINTING) {
140 139
       card.pauseSDPrint();
141
-      sd_print_paused = true;
140
+      ++did_pause_print;
142 141
     }
143 142
   #endif
144 143
   print_job_timer.pause();
@@ -256,7 +255,7 @@ void wait_for_filament_reload(const int8_t max_beep_count/*=0*/) {
256 255
 void resume_print(const float &load_length/*=0*/, const float &initial_extrude_length/*=0*/, const int8_t max_beep_count/*=0*/) {
257 256
   bool nozzle_timed_out = false;
258 257
 
259
-  if (!move_away_flag) return;
258
+  if (!did_pause_print) return;
260 259
 
261 260
   // Re-enable the heaters if they timed out
262 261
   HOTEND_LOOP() {
@@ -350,14 +349,14 @@ void resume_print(const float &load_length/*=0*/, const float &initial_extrude_l
350 349
     SERIAL_ECHOLNPGM("//action:" ACTION_ON_RESUME);
351 350
   #endif
352 351
 
352
+  --did_pause_print;
353
+
353 354
   #if ENABLED(SDSUPPORT)
354
-    if (sd_print_paused) {
355
+    if (did_pause_print) {
355 356
       card.startFileprint();
356
-      sd_print_paused = false;
357
+      --did_pause_print;
357 358
     }
358 359
   #endif
359
-
360
-  move_away_flag = false;
361 360
 }
362 361
 
363 362
 #endif // ADVANCED_PAUSE_FEATURE || PARK_HEAD_ON_PAUSE

+ 1
- 1
Marlin/src/feature/pause.h View File

@@ -30,7 +30,7 @@
30 30
 
31 31
 #include "../libs/nozzle.h"
32 32
 
33
-extern bool move_away_flag;
33
+extern bool did_pause_print;
34 34
 
35 35
 bool pause_print(const float &retract, const point_t &park_point, const float &unload_length=0,
36 36
                  const int8_t max_beep_count=0, const bool show_lcd=false

Loading…
Cancel
Save