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
 #include "../../../sd/cardreader.h"
31
 #include "../../../sd/cardreader.h"
32
 #include "../../../module/printcounter.h"
32
 #include "../../../module/printcounter.h"
33
 
33
 
34
+#if HAS_LCD_MENU
35
+  #include "../../../lcd/ultralcd.h"
36
+#endif
37
+
34
 /**
38
 /**
35
  * M125: Store current position and move to filament change position.
39
  * M125: Store current position and move to filament change position.
36
  *       Called on pause (by M25) to prevent material leaking onto the
40
  *       Called on pause (by M25) to prevent material leaking onto the
74
     constexpr bool sd_printing = false;
78
     constexpr bool sd_printing = false;
75
   #endif
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
  * M25: Pause SD Print
114
  * M25: Pause SD Print
115
  */
115
  */
116
 void GcodeSuite::M25() {
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
   #if ENABLED(PARK_HEAD_ON_PAUSE)
123
   #if ENABLED(PARK_HEAD_ON_PAUSE)
118
     M125();
124
     M125();
119
   #else
125
   #else
120
-    #if ENABLED(SDSUPPORT)
121
-      if (IS_SD_PRINTING()) card.pauseSDPrint();
122
-    #endif
123
-
124
     print_job_timer.pause();
126
     print_job_timer.pause();
125
     ui.reset_status();
127
     ui.reset_status();
126
 
128
 

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

32
 #include "../../module/temperature.h"
32
 #include "../../module/temperature.h"
33
 #include "../../gcode/queue.h"
33
 #include "../../gcode/queue.h"
34
 #include "../../module/printcounter.h"
34
 #include "../../module/printcounter.h"
35
+#include "../../module/stepper.h"
35
 
36
 
36
 #if ENABLED(POWER_LOSS_RECOVERY)
37
 #if ENABLED(POWER_LOSS_RECOVERY)
37
   #include "../../feature/power_loss_recovery.h"
38
   #include "../../feature/power_loss_recovery.h"
43
   #endif
44
   #endif
44
 
45
 
45
   #if ENABLED(PARK_HEAD_ON_PAUSE)
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
   #elif ENABLED(SDSUPPORT)
49
   #elif ENABLED(SDSUPPORT)
48
     enqueue_and_echo_commands_P(PSTR("M25"));
50
     enqueue_and_echo_commands_P(PSTR("M25"));
49
   #elif defined(ACTION_ON_PAUSE)
51
   #elif defined(ACTION_ON_PAUSE)
50
     SERIAL_ECHOLNPGM("//action:" ACTION_ON_PAUSE);
52
     SERIAL_ECHOLNPGM("//action:" ACTION_ON_PAUSE);
51
   #endif
53
   #endif
54
+  planner.synchronize();
52
 }
55
 }
53
 
56
 
54
 void lcd_resume() {
57
 void lcd_resume() {
97
 
100
 
98
   if (busy) {
101
   if (busy) {
99
     MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_pause);
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
     #if ENABLED(SDSUPPORT)
103
     #if ENABLED(SDSUPPORT)
105
       if (card.isFileOpen())
104
       if (card.isFileOpen())
106
         MENU_ITEM(submenu, MSG_STOP_PRINT, menu_sdcard_abort_confirm);
105
         MENU_ITEM(submenu, MSG_STOP_PRINT, menu_sdcard_abort_confirm);
107
     #endif
106
     #endif
107
+    MENU_ITEM(submenu, MSG_TUNE, menu_tune);
108
+  }
109
+  else {
110
+    MENU_ITEM(function, MSG_RESUME_PRINT, lcd_resume);
111
+    
108
     MENU_ITEM(submenu, MSG_MOTION, menu_motion);
112
     MENU_ITEM(submenu, MSG_MOTION, menu_motion);
109
     MENU_ITEM(submenu, MSG_TEMPERATURE, menu_temperature);
113
     MENU_ITEM(submenu, MSG_TEMPERATURE, menu_temperature);
110
   }
114
   }
154
         MENU_ITEM(function, MSG_AUTOSTART, card.beginautostart);
158
         MENU_ITEM(function, MSG_AUTOSTART, card.beginautostart);
155
     #endif
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
       #if !PIN_EXISTS(SD_DETECT)
164
       #if !PIN_EXISTS(SD_DETECT)
159
         MENU_ITEM(gcode, MSG_CHANGE_SDCARD, PSTR("M21"));  // SD-card changed by user
165
         MENU_ITEM(gcode, MSG_CHANGE_SDCARD, PSTR("M21"));  // SD-card changed by user
160
       #endif
166
       #endif
161
-      MENU_ITEM(submenu, MSG_CARD_MENU, menu_sdcard);
167
+      }
162
     }
168
     }
163
     else {
169
     else {
164
       #if !PIN_EXISTS(SD_DETECT)
170
       #if !PIN_EXISTS(SD_DETECT)
166
       #endif
172
       #endif
167
       MENU_ITEM(function, MSG_NO_CARD, NULL);
173
       MENU_ITEM(function, MSG_NO_CARD, NULL);
168
     }
174
     }
169
-
170
   #endif // SDSUPPORT
175
   #endif // SDSUPPORT
171
 
176
 
172
   END_MENU();
177
   END_MENU();

Loading…
Cancel
Save