浏览代码

Advanced pause fixes (#7518)

* Disallow filament change while paused

* Use kinematic movemements in pause_print and resume_print
Thomas Moore 7 年前
父节点
当前提交
257b693ab0
共有 3 个文件被更改,包括 20 次插入32 次删除
  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 查看文件

6192
         lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT);
6192
         lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT);
6193
       #endif
6193
       #endif
6194
     }
6194
     }
6195
-    stepper.synchronize();
6196
 
6195
 
6197
     // Save current position
6196
     // Save current position
6197
+    stepper.synchronize();
6198
     COPY(resume_position, current_position);
6198
     COPY(resume_position, current_position);
6199
-    set_destination_to_current();
6200
 
6199
 
6201
     if (retract) {
6200
     if (retract) {
6202
       // Initial retract before move to filament change position
6201
       // Initial retract before move to filament change position
6202
+      set_destination_to_current();
6203
       destination[E_AXIS] += retract;
6203
       destination[E_AXIS] += retract;
6204
       RUNPLAN(PAUSE_PARK_RETRACT_FEEDRATE);
6204
       RUNPLAN(PAUSE_PARK_RETRACT_FEEDRATE);
6205
+      stepper.synchronize();
6205
     }
6206
     }
6206
 
6207
 
6207
     // Lift Z axis
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
     // Move XY axes to filament exchange position
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
     if (unload_length != 0) {
6215
     if (unload_length != 0) {
6223
       if (show_lcd) {
6216
       if (show_lcd) {
6228
       }
6221
       }
6229
 
6222
 
6230
       // Unload filament
6223
       // Unload filament
6224
+      set_destination_to_current();
6231
       destination[E_AXIS] += unload_length;
6225
       destination[E_AXIS] += unload_length;
6232
       RUNPLAN(FILAMENT_CHANGE_UNLOAD_FEEDRATE);
6226
       RUNPLAN(FILAMENT_CHANGE_UNLOAD_FEEDRATE);
6233
       stepper.synchronize();
6227
       stepper.synchronize();
6355
 
6349
 
6356
       // Load filament
6350
       // Load filament
6357
       destination[E_AXIS] += load_length;
6351
       destination[E_AXIS] += load_length;
6358
-
6359
       RUNPLAN(FILAMENT_CHANGE_LOAD_FEEDRATE);
6352
       RUNPLAN(FILAMENT_CHANGE_LOAD_FEEDRATE);
6360
       stepper.synchronize();
6353
       stepper.synchronize();
6361
     }
6354
     }
6398
     destination[E_AXIS] = current_position[E_AXIS] = resume_position[E_AXIS];
6391
     destination[E_AXIS] = current_position[E_AXIS] = resume_position[E_AXIS];
6399
     planner.set_e_position_mm(current_position[E_AXIS]);
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
     #if ENABLED(FILAMENT_RUNOUT_SENSOR)
6398
     #if ENABLED(FILAMENT_RUNOUT_SENSOR)
6415
       filament_ran_out = false;
6399
       filament_ran_out = false;
8292
 
8276
 
8293
     // Initial retract before move to filament change position
8277
     // Initial retract before move to filament change position
8294
     const float retract = parser.seen('L') ? parser.value_axis_units(E_AXIS) : 0
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
         - (PAUSE_PARK_RETRACT_LENGTH)
8280
         - (PAUSE_PARK_RETRACT_LENGTH)
8297
       #endif
8281
       #endif
8298
     ;
8282
     ;
8299
 
8283
 
8300
     // Lift Z axis
8284
     // Lift Z axis
8301
     const float z_lift = parser.linearval('Z')
8285
     const float z_lift = parser.linearval('Z')
8302
-      #if PAUSE_PARK_Z_ADD > 0
8286
+      #ifdef PAUSE_PARK_Z_ADD
8303
         + PAUSE_PARK_Z_ADD
8287
         + PAUSE_PARK_Z_ADD
8304
       #endif
8288
       #endif
8305
     ;
8289
     ;
8322
       #endif
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
     if (pause_print(retract, z_lift, x_pos, y_pos)) {
8313
     if (pause_print(retract, z_lift, x_pos, y_pos)) {
8328
       #if DISABLED(SDSUPPORT)
8314
       #if DISABLED(SDSUPPORT)
9642
 
9628
 
9643
     // Initial retract before move to filament change position
9629
     // Initial retract before move to filament change position
9644
     const float retract = parser.seen('E') ? parser.value_axis_units(E_AXIS) : 0
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
         - (PAUSE_PARK_RETRACT_LENGTH)
9632
         - (PAUSE_PARK_RETRACT_LENGTH)
9647
       #endif
9633
       #endif
9648
     ;
9634
     ;
9649
 
9635
 
9650
     // Lift Z axis
9636
     // Lift Z axis
9651
     const float z_lift = parser.linearval('Z', 0
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
         + PAUSE_PARK_Z_ADD
9639
         + PAUSE_PARK_Z_ADD
9654
       #endif
9640
       #endif
9655
     );
9641
     );

+ 2
- 0
Marlin/cardreader.h 查看文件

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

+ 1
- 1
Marlin/ultralcd.cpp 查看文件

2425
     // Change filament
2425
     // Change filament
2426
     //
2426
     //
2427
     #if ENABLED(ADVANCED_PAUSE_FEATURE)
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
         MENU_ITEM(function, MSG_FILAMENTCHANGE, lcd_enqueue_filament_change);
2429
         MENU_ITEM(function, MSG_FILAMENTCHANGE, lcd_enqueue_filament_change);
2430
     #endif
2430
     #endif
2431
 
2431
 

正在加载...
取消
保存