Bladeren bron

Advanced pause fixes (#7518)

* Disallow filament change while paused

* Use kinematic movemements in pause_print and resume_print
Thomas Moore 7 jaren geleden
bovenliggende
commit
257b693ab0
3 gewijzigde bestanden met toevoegingen van 20 en 32 verwijderingen
  1. 17
    31
      Marlin/Marlin_main.cpp
  2. 2
    0
      Marlin/cardreader.h
  3. 1
    1
      Marlin/ultralcd.cpp

+ 17
- 31
Marlin/Marlin_main.cpp Bestand weergeven

@@ -6192,32 +6192,25 @@ inline void gcode_M17() {
6192 6192
         lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT);
6193 6193
       #endif
6194 6194
     }
6195
-    stepper.synchronize();
6196 6195
 
6197 6196
     // Save current position
6197
+    stepper.synchronize();
6198 6198
     COPY(resume_position, current_position);
6199
-    set_destination_to_current();
6200 6199
 
6201 6200
     if (retract) {
6202 6201
       // Initial retract before move to filament change position
6202
+      set_destination_to_current();
6203 6203
       destination[E_AXIS] += retract;
6204 6204
       RUNPLAN(PAUSE_PARK_RETRACT_FEEDRATE);
6205
+      stepper.synchronize();
6205 6206
     }
6206 6207
 
6207 6208
     // Lift Z axis
6208
-    if (z_lift > 0) {
6209
-      destination[Z_AXIS] += z_lift;
6210
-      NOMORE(destination[Z_AXIS], Z_MAX_POS);
6211
-      RUNPLAN(PAUSE_PARK_Z_FEEDRATE);
6212
-    }
6209
+    if (z_lift > 0)
6210
+      do_blocking_move_to_z(current_position[Z_AXIS] + z_lift, PAUSE_PARK_Z_FEEDRATE);
6213 6211
 
6214 6212
     // Move XY axes to filament exchange position
6215
-    destination[X_AXIS] = x_pos;
6216
-    destination[Y_AXIS] = y_pos;
6217
-
6218
-    clamp_to_software_endstops(destination);
6219
-    RUNPLAN(PAUSE_PARK_XY_FEEDRATE);
6220
-    stepper.synchronize();
6213
+    do_blocking_move_to_xy(x_pos, y_pos, PAUSE_PARK_XY_FEEDRATE);
6221 6214
 
6222 6215
     if (unload_length != 0) {
6223 6216
       if (show_lcd) {
@@ -6228,6 +6221,7 @@ inline void gcode_M17() {
6228 6221
       }
6229 6222
 
6230 6223
       // Unload filament
6224
+      set_destination_to_current();
6231 6225
       destination[E_AXIS] += unload_length;
6232 6226
       RUNPLAN(FILAMENT_CHANGE_UNLOAD_FEEDRATE);
6233 6227
       stepper.synchronize();
@@ -6355,7 +6349,6 @@ inline void gcode_M17() {
6355 6349
 
6356 6350
       // Load filament
6357 6351
       destination[E_AXIS] += load_length;
6358
-
6359 6352
       RUNPLAN(FILAMENT_CHANGE_LOAD_FEEDRATE);
6360 6353
       stepper.synchronize();
6361 6354
     }
@@ -6398,18 +6391,9 @@ inline void gcode_M17() {
6398 6391
     destination[E_AXIS] = current_position[E_AXIS] = resume_position[E_AXIS];
6399 6392
     planner.set_e_position_mm(current_position[E_AXIS]);
6400 6393
 
6401
-    #if IS_KINEMATIC
6402
-      // Move XYZ to starting position
6403
-      planner.buffer_line_kinematic(resume_position, PAUSE_PARK_XY_FEEDRATE, active_extruder);
6404
-    #else
6405
-      // Move XY to starting position, then Z
6406
-      destination[X_AXIS] = resume_position[X_AXIS];
6407
-      destination[Y_AXIS] = resume_position[Y_AXIS];
6408
-      RUNPLAN(PAUSE_PARK_XY_FEEDRATE);
6409
-      destination[Z_AXIS] = resume_position[Z_AXIS];
6410
-      RUNPLAN(PAUSE_PARK_Z_FEEDRATE);
6411
-    #endif
6412
-    stepper.synchronize();
6394
+    // Move XY to starting position, then Z
6395
+    do_blocking_move_to_xy(resume_position[X_AXIS], resume_position[Y_AXIS], PAUSE_PARK_XY_FEEDRATE);
6396
+    do_blocking_move_to_z(resume_position[Z_AXIS], PAUSE_PARK_Z_FEEDRATE);
6413 6397
 
6414 6398
     #if ENABLED(FILAMENT_RUNOUT_SENSOR)
6415 6399
       filament_ran_out = false;
@@ -8292,14 +8276,14 @@ inline void gcode_M121() { endstops.enable_globally(false); }
8292 8276
 
8293 8277
     // Initial retract before move to filament change position
8294 8278
     const float retract = parser.seen('L') ? parser.value_axis_units(E_AXIS) : 0
8295
-      #if defined(PAUSE_PARK_RETRACT_LENGTH) && PAUSE_PARK_RETRACT_LENGTH > 0
8279
+      #ifdef PAUSE_PARK_RETRACT_LENGTH
8296 8280
         - (PAUSE_PARK_RETRACT_LENGTH)
8297 8281
       #endif
8298 8282
     ;
8299 8283
 
8300 8284
     // Lift Z axis
8301 8285
     const float z_lift = parser.linearval('Z')
8302
-      #if PAUSE_PARK_Z_ADD > 0
8286
+      #ifdef PAUSE_PARK_Z_ADD
8303 8287
         + PAUSE_PARK_Z_ADD
8304 8288
       #endif
8305 8289
     ;
@@ -8322,7 +8306,9 @@ inline void gcode_M121() { endstops.enable_globally(false); }
8322 8306
       #endif
8323 8307
     ;
8324 8308
 
8325
-    const bool job_running = print_job_timer.isRunning();
8309
+    #if DISABLED(SDSUPPORT)
8310
+      const bool job_running = print_job_timer.isRunning();
8311
+    #endif
8326 8312
 
8327 8313
     if (pause_print(retract, z_lift, x_pos, y_pos)) {
8328 8314
       #if DISABLED(SDSUPPORT)
@@ -9642,14 +9628,14 @@ inline void gcode_M502() {
9642 9628
 
9643 9629
     // Initial retract before move to filament change position
9644 9630
     const float retract = parser.seen('E') ? parser.value_axis_units(E_AXIS) : 0
9645
-      #if defined(PAUSE_PARK_RETRACT_LENGTH) && PAUSE_PARK_RETRACT_LENGTH > 0
9631
+      #ifdef PAUSE_PARK_RETRACT_LENGTH
9646 9632
         - (PAUSE_PARK_RETRACT_LENGTH)
9647 9633
       #endif
9648 9634
     ;
9649 9635
 
9650 9636
     // Lift Z axis
9651 9637
     const float z_lift = parser.linearval('Z', 0
9652
-      #if defined(PAUSE_PARK_Z_ADD) && PAUSE_PARK_Z_ADD > 0
9638
+      #ifdef PAUSE_PARK_Z_ADD
9653 9639
         + PAUSE_PARK_Z_ADD
9654 9640
       #endif
9655 9641
     );

+ 2
- 0
Marlin/cardreader.h Bestand weergeven

@@ -167,6 +167,7 @@ private:
167 167
 extern CardReader card;
168 168
 
169 169
 #define IS_SD_PRINTING (card.sdprinting)
170
+#define IS_SD_FILE_OPEN (card.isFileOpen())
170 171
 
171 172
 #if PIN_EXISTS(SD_DETECT)
172 173
   #if ENABLED(SD_DETECT_INVERTED)
@@ -182,6 +183,7 @@ extern CardReader card;
182 183
 #else
183 184
 
184 185
 #define IS_SD_PRINTING (false)
186
+#define IS_SD_FILE_OPEN (false)
185 187
 
186 188
 #endif // SDSUPPORT
187 189
 

+ 1
- 1
Marlin/ultralcd.cpp Bestand weergeven

@@ -2425,7 +2425,7 @@ void kill_screen(const char* lcd_msg) {
2425 2425
     // Change filament
2426 2426
     //
2427 2427
     #if ENABLED(ADVANCED_PAUSE_FEATURE)
2428
-      if (!thermalManager.tooColdToExtrude(active_extruder) && !IS_SD_PRINTING)
2428
+      if (!thermalManager.tooColdToExtrude(active_extruder) && !IS_SD_FILE_OPEN)
2429 2429
         MENU_ITEM(function, MSG_FILAMENTCHANGE, lcd_enqueue_filament_change);
2430 2430
     #endif
2431 2431
 

Laden…
Annuleren
Opslaan