Przeglądaj źródła

Add 'blocking move' comments

Scott Lahteine 4 lat temu
rodzic
commit
4044ed8783
1 zmienionych plików z 19 dodań i 16 usunięć
  1. 19
    16
      Marlin/src/module/motion.cpp

+ 19
- 16
Marlin/src/module/motion.cpp Wyświetl plik

@@ -367,12 +367,13 @@ void _internal_move_to_destination(const_feedRate_t fr_mm_s/*=0.0f*/
367 367
     planner.e_factor[active_extruder] = 1.0f;
368 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 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 378
   feedrate_mm_s = old_feedrate;
378 379
   feedrate_percentage = old_pct;
@@ -382,7 +383,12 @@ void _internal_move_to_destination(const_feedRate_t fr_mm_s/*=0.0f*/
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 393
 void do_blocking_move_to(const float rx, const float ry, const float rz, const_feedRate_t fr_mm_s/*=0.0*/) {
388 394
   DEBUG_SECTION(log_move, "do_blocking_move_to", DEBUGGING(LEVELING));
@@ -391,20 +397,21 @@ void do_blocking_move_to(const float rx, const float ry, const float rz, const_f
391 397
   const feedRate_t z_feedrate = fr_mm_s ?: homing_feedrate(Z_AXIS),
392 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 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 409
     if (DEBUGGING(LEVELING)) DEBUG_POS("destination = current_position", destination);
403 410
 
404 411
     // when in the danger zone
405 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 415
         prepare_internal_fast_move_to_destination();          // set current_position from destination
409 416
         if (DEBUGGING(LEVELING)) DEBUG_POS("danger zone move", current_position);
410 417
         return;
@@ -432,10 +439,6 @@ void do_blocking_move_to(const float rx, const float ry, const float rz, const_f
432 439
 
433 440
   #elif IS_SCARA
434 441
 
435
-    if (!position_is_reachable(rx, ry)) return;
436
-
437
-    destination = current_position;
438
-
439 442
     // If Z needs to raise, do it before moving XY
440 443
     if (destination.z < rz) {
441 444
       destination.z = rz;

Ładowanie…
Anuluj
Zapisz