Browse Source

Allow resume from pause with parking enabled (#12893)

Currently, Pause of an SD-Memory card print does not work.    This has been verified to resolve the issue by multiple people.   

I understand more work needs to be done to resolve some of the concerns...
InsanityAutomation 6 years ago
parent
commit
59b18aaeef

+ 15
- 6
Marlin/src/gcode/feature/pause/M125.cpp View File

@@ -31,6 +31,10 @@
31 31
 #include "../../../sd/cardreader.h"
32 32
 #include "../../../module/printcounter.h"
33 33
 
34
+#if HAS_LCD_MENU
35
+  #include "../../../lcd/ultralcd.h"
36
+#endif
37
+
34 38
 /**
35 39
  * M125: Store current position and move to filament change position.
36 40
  *       Called on pause (by M25) to prevent material leaking onto the
@@ -74,12 +78,17 @@ void GcodeSuite::M125() {
74 78
     constexpr bool sd_printing = false;
75 79
   #endif
76 80
 
77
-  if (pause_print(retract, park_point)) {
78
-    // SD Printing simply pauses, leaving the machine in a ready state,
79
-    // and can be resumed at any time, so don't wait in a loop here.
80
-    if (!sd_printing) {
81
-      wait_for_confirmation();
82
-      resume_print();
81
+  #if HAS_LCD_MENU
82
+    const bool show_lcd = parser.seenval('P');
83
+    lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT, ADVANCED_PAUSE_MODE_PAUSE_PRINT, active_extruder);
84
+  #else
85
+    constexpr bool show_lcd = false;
86
+  #endif
87
+
88
+  if (pause_print(retract, park_point, 0, show_lcd)) {
89
+    if (!sd_printing || show_lcd ) {
90
+      wait_for_confirmation(false, 0);
91
+      resume_print(0, 0, PAUSE_PARK_RETRACT_LENGTH, 0);
83 92
     }
84 93
   }
85 94
 }

+ 6
- 4
Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp View File

@@ -114,13 +114,15 @@ void GcodeSuite::M24() {
114 114
  * M25: Pause SD Print
115 115
  */
116 116
 void GcodeSuite::M25() {
117
+  
118
+  // Set initial pause flag to prevent more commands from landing in the queue while we try to pause
119
+  #if ENABLED(SDSUPPORT)
120
+    if (IS_SD_PRINTING()) { card.pauseSDPrint(); }
121
+  #endif
122
+
117 123
   #if ENABLED(PARK_HEAD_ON_PAUSE)
118 124
     M125();
119 125
   #else
120
-    #if ENABLED(SDSUPPORT)
121
-      if (IS_SD_PRINTING()) card.pauseSDPrint();
122
-    #endif
123
-
124 126
     print_job_timer.pause();
125 127
     ui.reset_status();
126 128
 

+ 13
- 8
Marlin/src/lcd/menu/menu_main.cpp View File

@@ -32,6 +32,7 @@
32 32
 #include "../../module/temperature.h"
33 33
 #include "../../gcode/queue.h"
34 34
 #include "../../module/printcounter.h"
35
+#include "../../module/stepper.h"
35 36
 
36 37
 #if ENABLED(POWER_LOSS_RECOVERY)
37 38
   #include "../../feature/power_loss_recovery.h"
@@ -43,12 +44,14 @@ void lcd_pause() {
43 44
   #endif
44 45
 
45 46
   #if ENABLED(PARK_HEAD_ON_PAUSE)
46
-    pause_print(PAUSE_PARK_RETRACT_LENGTH, NOZZLE_PARK_POINT, 0, true);
47
+    lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT, ADVANCED_PAUSE_MODE_PAUSE_PRINT, active_extruder);
48
+    enqueue_and_echo_commands_P(PSTR("M25 P; \n M24"));
47 49
   #elif ENABLED(SDSUPPORT)
48 50
     enqueue_and_echo_commands_P(PSTR("M25"));
49 51
   #elif defined(ACTION_ON_PAUSE)
50 52
     SERIAL_ECHOLNPGM("//action:" ACTION_ON_PAUSE);
51 53
   #endif
54
+  planner.synchronize();
52 55
 }
53 56
 
54 57
 void lcd_resume() {
@@ -97,14 +100,15 @@ void menu_main() {
97 100
 
98 101
   if (busy) {
99 102
     MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_pause);
100
-    MENU_ITEM(submenu, MSG_TUNE, menu_tune);
101
-  }
102
-  else {
103
-    MENU_ITEM(function, MSG_RESUME_PRINT, lcd_resume);
104 103
     #if ENABLED(SDSUPPORT)
105 104
       if (card.isFileOpen())
106 105
         MENU_ITEM(submenu, MSG_STOP_PRINT, menu_sdcard_abort_confirm);
107 106
     #endif
107
+    MENU_ITEM(submenu, MSG_TUNE, menu_tune);
108
+  }
109
+  else {
110
+    MENU_ITEM(function, MSG_RESUME_PRINT, lcd_resume);
111
+    
108 112
     MENU_ITEM(submenu, MSG_MOTION, menu_motion);
109 113
     MENU_ITEM(submenu, MSG_TEMPERATURE, menu_temperature);
110 114
   }
@@ -154,11 +158,13 @@ void menu_main() {
154 158
         MENU_ITEM(function, MSG_AUTOSTART, card.beginautostart);
155 159
     #endif
156 160
 
157
-    if (card.isDetected() && !card.isFileOpen()) {
161
+    if (card.isDetected()) {
162
+      if(!card.isFileOpen()) {
163
+      MENU_ITEM(submenu, MSG_CARD_MENU, menu_sdcard);
158 164
       #if !PIN_EXISTS(SD_DETECT)
159 165
         MENU_ITEM(gcode, MSG_CHANGE_SDCARD, PSTR("M21"));  // SD-card changed by user
160 166
       #endif
161
-      MENU_ITEM(submenu, MSG_CARD_MENU, menu_sdcard);
167
+      }
162 168
     }
163 169
     else {
164 170
       #if !PIN_EXISTS(SD_DETECT)
@@ -166,7 +172,6 @@ void menu_main() {
166 172
       #endif
167 173
       MENU_ITEM(function, MSG_NO_CARD, NULL);
168 174
     }
169
-
170 175
   #endif // SDSUPPORT
171 176
 
172 177
   END_MENU();

Loading…
Cancel
Save