Pārlūkot izejas kodu

Fix pause/resume SD print

Followup to #12551, addressing #12566
Scott Lahteine 6 gadus atpakaļ
vecāks
revīzija
261c6f4b96

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

@@ -92,4 +92,4 @@ bool load_filament(const float &slow_load_length=0, const float &fast_load_lengt
92 92
 
93 93
 bool unload_filament(const float &unload_length, const bool show_lcd=false, const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_PAUSE_PRINT);
94 94
 
95
-#endif //ADVANCED_PAUSE_FEATURE
95
+#endif // ADVANCED_PAUSE_FEATURE

+ 6
- 5
Marlin/src/gcode/feature/pause/M125.cpp Parādīt failu

@@ -68,12 +68,13 @@ void GcodeSuite::M125() {
68 68
     park_point.y += (active_extruder ? hotend_offset[Y_AXIS][active_extruder] : 0);
69 69
   #endif
70 70
 
71
+  #if ENABLED(SDSUPPORT)
72
+    const bool sd_printing = IS_SD_PRINTING();
73
+  #else
74
+    constexpr bool sd_printing = false;
75
+  #endif
76
+
71 77
   if (pause_print(retract, park_point)) {
72
-    #if ENABLED(SDSUPPORT)
73
-      const bool sd_printing = IS_SD_PRINTING() || parser.boolval('S'); // Undocumented parameter
74
-    #else
75
-      constexpr bool sd_printing = false;
76
-    #endif
77 78
     if (!sd_printing) {
78 79
       wait_for_confirmation();
79 80
       resume_print();

+ 7
- 12
Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp Parādīt failu

@@ -91,17 +91,11 @@ void GcodeSuite::M24() {
91 91
 
92 92
   #if ENABLED(POWER_LOSS_RECOVERY)
93 93
     if (parser.seenval('S')) card.setIndex(parser.value_long());
94
+    if (parser.seenval('T')) print_job_timer.resume(parser.value_long());
94 95
   #endif
95 96
 
96 97
   card.startFileprint();
97
-
98
-  #if ENABLED(POWER_LOSS_RECOVERY)
99
-    if (parser.seenval('T'))
100
-      print_job_timer.resume(parser.value_long());
101
-    else
102
-  #endif
103
-      print_job_timer.start();
104
-
98
+  print_job_timer.start();
105 99
   ui.reset_status();
106 100
 }
107 101
 
@@ -109,11 +103,12 @@ void GcodeSuite::M24() {
109 103
  * M25: Pause SD Print
110 104
  */
111 105
 void GcodeSuite::M25() {
112
-  card.pauseSDPrint();
113
-  print_job_timer.pause();
114
-
115 106
   #if ENABLED(PARK_HEAD_ON_PAUSE)
116
-    enqueue_and_echo_commands_P(PSTR("M125 S")); // To be last in the buffer, must enqueue after pauseSDPrint
107
+    M125();
108
+  #else
109
+    card.pauseSDPrint();
110
+    print_job_timer.pause();
111
+    ui.reset_status();
117 112
   #endif
118 113
 }
119 114
 

+ 1
- 1
Marlin/src/lcd/menu/menu_main.cpp Parādīt failu

@@ -54,8 +54,8 @@
54 54
     #else
55 55
       card.startFileprint();
56 56
       print_job_timer.start();
57
+      ui.reset_status();
57 58
     #endif
58
-    ui.reset_status();
59 59
   }
60 60
 
61 61
   void lcd_sdcard_stop() {

+ 2
- 2
Marlin/src/libs/stopwatch.cpp Parādīt failu

@@ -71,13 +71,13 @@ bool Stopwatch::start() {
71 71
   else return false;
72 72
 }
73 73
 
74
-void Stopwatch::resume(const millis_t duration) {
74
+void Stopwatch::resume(const millis_t with_time) {
75 75
   #if ENABLED(DEBUG_STOPWATCH)
76 76
     Stopwatch::debug(PSTR("resume"));
77 77
   #endif
78 78
 
79 79
   reset();
80
-  if ((accumulator = duration)) state = RUNNING;
80
+  if ((accumulator = with_time)) state = RUNNING;
81 81
 }
82 82
 
83 83
 void Stopwatch::reset() {

+ 1
- 1
Marlin/src/libs/stopwatch.h Parādīt failu

@@ -75,7 +75,7 @@ class Stopwatch {
75 75
      * @brief Resume the stopwatch
76 76
      * @details Resume a timer from a given duration
77 77
      */
78
-    static void resume(const millis_t duration);
78
+    static void resume(const millis_t with_time);
79 79
 
80 80
     /**
81 81
      * @brief Reset the stopwatch

Notiek ielāde…
Atcelt
Saglabāt