Pārlūkot izejas kodu

Single pause flag also indicates SD print pause

Scott Lahteine 7 gadus atpakaļ
vecāks
revīzija
9686ffedef
3 mainītis faili ar 11 papildinājumiem un 12 dzēšanām
  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 Parādīt failu

346
 
346
 
347
   // Prevent steppers timing-out in the middle of M600
347
   // Prevent steppers timing-out in the middle of M600
348
   #if ENABLED(ADVANCED_PAUSE_FEATURE) && ENABLED(PAUSE_PARK_NO_STEPPER_TIMEOUT)
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
   #else
350
   #else
351
     #define MOVE_AWAY_TEST true
351
     #define MOVE_AWAY_TEST true
352
   #endif
352
   #endif

+ 9
- 10
Marlin/src/feature/pause.cpp Parādīt failu

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

+ 1
- 1
Marlin/src/feature/pause.h Parādīt failu

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

Notiek ielāde…
Atcelt
Saglabāt