Pārlūkot izejas kodu

Tweaks to core motion code

Scott Lahteine 7 gadus atpakaļ
vecāks
revīzija
b0b4a20930
1 mainītis faili ar 24 papildinājumiem un 22 dzēšanām
  1. 24
    22
      Marlin/src/module/motion.cpp

+ 24
- 22
Marlin/src/module/motion.cpp Parādīt failu

@@ -489,7 +489,8 @@ float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
489 489
 
490 490
 #endif
491 491
 
492
-#if IS_KINEMATIC && !UBL_DELTA
492
+#if !UBL_DELTA
493
+#if IS_KINEMATIC
493 494
 
494 495
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
495 496
     #if ENABLED(DELTA)
@@ -512,6 +513,9 @@ float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
512 513
    *
513 514
    * This calls planner.buffer_line several times, adding
514 515
    * small incremental moves for DELTA or SCARA.
516
+   *
517
+   * For Unified Bed Leveling (Delta or Segmented Cartesian)
518
+   * the ubl.prepare_segmented_line_to method replaces this.
515 519
    */
516 520
   inline bool prepare_kinematic_move_to(float rtarget[XYZE]) {
517 521
 
@@ -630,47 +634,45 @@ float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
630 634
     return false;
631 635
   }
632 636
 
633
-#else // !IS_KINEMATIC || UBL_DELTA
637
+#else // !IS_KINEMATIC
634 638
 
635 639
   /**
636 640
    * Prepare a linear move in a Cartesian setup.
637
-   * Bed Leveling will be applied to the move if enabled.
641
+   *
642
+   * When a mesh-based leveling system is active, moves are segmented
643
+   * according to the configuration of the leveling system.
638 644
    *
639 645
    * Returns true if current_position[] was set to destination[]
640 646
    */
641
-
642 647
   inline bool prepare_move_to_destination_cartesian() {
643
-    const float fr_scaled = MMS_SCALED(feedrate_mm_s);
644
-      #if HAS_MESH
645
-        if (!planner.leveling_active) {
646
-          line_to_destination(fr_scaled);
647
-          return false;
648
-        }
648
+    #if HAS_MESH
649
+      if (planner.leveling_active) {
649 650
         #if ENABLED(AUTO_BED_LEVELING_UBL)
650
-          ubl.line_to_destination_cartesian(fr_scaled, active_extruder);  // UBL's motion routine needs to know about all moves,
651
-          return true;                                                    // even purely Z-Axis moves
651
+          ubl.line_to_destination_cartesian(MMS_SCALED(feedrate_mm_s), active_extruder);  // UBL's motion routine needs to know about
652
+          return true;                                                                    // all moves, including Z-only moves.
652 653
         #else
654
+          /**
655
+           * For MBL and ABL-BILINEAR only segment moves when X or Y are involved.
656
+           * Otherwise fall through to do a direct single move.
657
+           */
653 658
           if (current_position[X_AXIS] != destination[X_AXIS] || current_position[Y_AXIS] != destination[Y_AXIS]) {
654 659
             #if ENABLED(MESH_BED_LEVELING)
655
-              mesh_line_to_destination(fr_scaled);
660
+              mesh_line_to_destination(MMS_SCALED(feedrate_mm_s));
656 661
             #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
657
-              bilinear_line_to_destination(fr_scaled);
662
+              bilinear_line_to_destination(MMS_SCALED(feedrate_mm_s));
658 663
             #endif
659 664
             return true;
660 665
           }
661
-          else {
662
-            line_to_destination();
663
-            return false;
664
-          }
665 666
         #endif
666
-      #else
667
-        line_to_destination();  
668
-      #endif // HAS_MESH
667
+      }
668
+    #endif // HAS_MESH
669 669
 
670
+    line_to_destination(MMS_SCALED(feedrate_mm_s));
670 671
     return false;
671 672
   }
672 673
 
673
-#endif // !IS_KINEMATIC || UBL_DELTA
674
+#endif // !IS_KINEMATIC
675
+#endif // !UBL_DELTA
674 676
 
675 677
 #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
676 678
   bool extruder_duplication_enabled = false;                              // Used in Dual X mode 2

Notiek ielāde…
Atcelt
Saglabāt