Browse Source

Tweaks to core motion code

Scott Lahteine 7 years ago
parent
commit
b0b4a20930
1 changed files with 24 additions and 22 deletions
  1. 24
    22
      Marlin/src/module/motion.cpp

+ 24
- 22
Marlin/src/module/motion.cpp View File

489
 
489
 
490
 #endif
490
 #endif
491
 
491
 
492
-#if IS_KINEMATIC && !UBL_DELTA
492
+#if !UBL_DELTA
493
+#if IS_KINEMATIC
493
 
494
 
494
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
495
   #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
495
     #if ENABLED(DELTA)
496
     #if ENABLED(DELTA)
512
    *
513
    *
513
    * This calls planner.buffer_line several times, adding
514
    * This calls planner.buffer_line several times, adding
514
    * small incremental moves for DELTA or SCARA.
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
   inline bool prepare_kinematic_move_to(float rtarget[XYZE]) {
520
   inline bool prepare_kinematic_move_to(float rtarget[XYZE]) {
517
 
521
 
630
     return false;
634
     return false;
631
   }
635
   }
632
 
636
 
633
-#else // !IS_KINEMATIC || UBL_DELTA
637
+#else // !IS_KINEMATIC
634
 
638
 
635
   /**
639
   /**
636
    * Prepare a linear move in a Cartesian setup.
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
    * Returns true if current_position[] was set to destination[]
645
    * Returns true if current_position[] was set to destination[]
640
    */
646
    */
641
-
642
   inline bool prepare_move_to_destination_cartesian() {
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
         #if ENABLED(AUTO_BED_LEVELING_UBL)
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
         #else
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
           if (current_position[X_AXIS] != destination[X_AXIS] || current_position[Y_AXIS] != destination[Y_AXIS]) {
658
           if (current_position[X_AXIS] != destination[X_AXIS] || current_position[Y_AXIS] != destination[Y_AXIS]) {
654
             #if ENABLED(MESH_BED_LEVELING)
659
             #if ENABLED(MESH_BED_LEVELING)
655
-              mesh_line_to_destination(fr_scaled);
660
+              mesh_line_to_destination(MMS_SCALED(feedrate_mm_s));
656
             #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
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
             #endif
663
             #endif
659
             return true;
664
             return true;
660
           }
665
           }
661
-          else {
662
-            line_to_destination();
663
-            return false;
664
-          }
665
         #endif
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
     return false;
671
     return false;
671
   }
672
   }
672
 
673
 
673
-#endif // !IS_KINEMATIC || UBL_DELTA
674
+#endif // !IS_KINEMATIC
675
+#endif // !UBL_DELTA
674
 
676
 
675
 #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
677
 #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
676
   bool extruder_duplication_enabled = false;                              // Used in Dual X mode 2
678
   bool extruder_duplication_enabled = false;                              // Used in Dual X mode 2

Loading…
Cancel
Save