Browse Source

Add 'blocking move' comments

Scott Lahteine 4 years ago
parent
commit
4044ed8783
1 changed files with 19 additions and 16 deletions
  1. 19
    16
      Marlin/src/module/motion.cpp

+ 19
- 16
Marlin/src/module/motion.cpp View File

367
     planner.e_factor[active_extruder] = 1.0f;
367
     planner.e_factor[active_extruder] = 1.0f;
368
   #endif
368
   #endif
369
 
369
 
370
-  #if IS_KINEMATIC
371
-    if (is_fast)
372
-      prepare_fast_move_to_destination();
373
-    else
370
+  #if !IS_KINEMATIC
371
+    constexpr bool is_fast = false;
374
   #endif
372
   #endif
375
-      prepare_line_to_destination();
373
+  if (is_fast)
374
+    prepare_fast_move_to_destination();
375
+  else
376
+    prepare_line_to_destination();
376
 
377
 
377
   feedrate_mm_s = old_feedrate;
378
   feedrate_mm_s = old_feedrate;
378
   feedrate_percentage = old_pct;
379
   feedrate_percentage = old_pct;
382
 }
383
 }
383
 
384
 
384
 /**
385
 /**
385
- * Plan a move to (X, Y, Z) and set the current_position
386
+ * Plan a move to (X, Y, Z) with separation of the XY and Z components.
387
+ *
388
+ * - If Z is moving up, the Z move is done before XY.
389
+ * - If Z is moving down, the Z move is done after XY.
390
+ * - Delta may lower Z first to get into the free motion zone.
391
+ * - Before returning, wait for the planner buffer to empty.
386
  */
392
  */
387
 void do_blocking_move_to(const float rx, const float ry, const float rz, const_feedRate_t fr_mm_s/*=0.0*/) {
393
 void do_blocking_move_to(const float rx, const float ry, const float rz, const_feedRate_t fr_mm_s/*=0.0*/) {
388
   DEBUG_SECTION(log_move, "do_blocking_move_to", DEBUGGING(LEVELING));
394
   DEBUG_SECTION(log_move, "do_blocking_move_to", DEBUGGING(LEVELING));
391
   const feedRate_t z_feedrate = fr_mm_s ?: homing_feedrate(Z_AXIS),
397
   const feedRate_t z_feedrate = fr_mm_s ?: homing_feedrate(Z_AXIS),
392
                   xy_feedrate = fr_mm_s ?: feedRate_t(XY_PROBE_FEEDRATE_MM_S);
398
                   xy_feedrate = fr_mm_s ?: feedRate_t(XY_PROBE_FEEDRATE_MM_S);
393
 
399
 
394
-  #if ENABLED(DELTA)
395
-
400
+  #if EITHER(DELTA, IS_SCARA)
396
     if (!position_is_reachable(rx, ry)) return;
401
     if (!position_is_reachable(rx, ry)) return;
402
+    destination = current_position;          // sync destination at the start
403
+  #endif
397
 
404
 
398
-    REMEMBER(fr, feedrate_mm_s, xy_feedrate);
405
+  #if ENABLED(DELTA)
399
 
406
 
400
-    destination = current_position;          // sync destination at the start
407
+    REMEMBER(fr, feedrate_mm_s, xy_feedrate);
401
 
408
 
402
     if (DEBUGGING(LEVELING)) DEBUG_POS("destination = current_position", destination);
409
     if (DEBUGGING(LEVELING)) DEBUG_POS("destination = current_position", destination);
403
 
410
 
404
     // when in the danger zone
411
     // when in the danger zone
405
     if (current_position.z > delta_clip_start_height) {
412
     if (current_position.z > delta_clip_start_height) {
406
-      if (rz > delta_clip_start_height) {   // staying in the danger zone
407
-        destination.set(rx, ry, rz);        // move directly (uninterpolated)
413
+      if (rz > delta_clip_start_height) {                     // staying in the danger zone
414
+        destination.set(rx, ry, rz);                          // move directly (uninterpolated)
408
         prepare_internal_fast_move_to_destination();          // set current_position from destination
415
         prepare_internal_fast_move_to_destination();          // set current_position from destination
409
         if (DEBUGGING(LEVELING)) DEBUG_POS("danger zone move", current_position);
416
         if (DEBUGGING(LEVELING)) DEBUG_POS("danger zone move", current_position);
410
         return;
417
         return;
432
 
439
 
433
   #elif IS_SCARA
440
   #elif IS_SCARA
434
 
441
 
435
-    if (!position_is_reachable(rx, ry)) return;
436
-
437
-    destination = current_position;
438
-
439
     // If Z needs to raise, do it before moving XY
442
     // If Z needs to raise, do it before moving XY
440
     if (destination.z < rz) {
443
     if (destination.z < rz) {
441
       destination.z = rz;
444
       destination.z = rz;

Loading…
Cancel
Save