Browse Source

Use "dist" instead of "delta" for clarity

Scott Lahteine 5 years ago
parent
commit
adb6334ba0

+ 1
- 1
Marlin/src/feature/backlash.cpp View File

@@ -113,7 +113,7 @@ void Backlash::add_correction_steps(const int32_t &da, const int32_t &db, const
113 113
             error_correction = 0; // Don't take up any backlash in this segment, as it would subtract steps
114 114
         }
115 115
       #endif
116
-      // Making a correction reduces the residual error and modifies delta_mm
116
+      // Making a correction reduces the residual error and adds block steps
117 117
       if (error_correction) {
118 118
         block->steps[axis] += ABS(error_correction);
119 119
         residual_error[axis] -= error_correction;

+ 5
- 4
Marlin/src/module/motion.cpp View File

@@ -1292,12 +1292,14 @@ feedRate_t get_homing_bump_feedrate(const AxisEnum axis) {
1292 1292
  */
1293 1293
 void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t fr_mm_s=0.0) {
1294 1294
 
1295
+  const feedRate_t real_fr_mm_s = fr_mm_s ?: homing_feedrate(axis);
1296
+
1295 1297
   if (DEBUGGING(LEVELING)) {
1296 1298
     DEBUG_ECHOPAIR(">>> do_homing_move(", axis_codes[axis], ", ", distance, ", ");
1297 1299
     if (fr_mm_s)
1298 1300
       DEBUG_ECHO(fr_mm_s);
1299 1301
     else
1300
-      DEBUG_ECHOPAIR("[", homing_feedrate(axis), "]");
1302
+      DEBUG_ECHOPAIR("[", real_fr_mm_s, "]");
1301 1303
     DEBUG_ECHOLNPGM(")");
1302 1304
   }
1303 1305
 
@@ -1331,7 +1333,6 @@ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t
1331 1333
     #endif
1332 1334
   }
1333 1335
 
1334
-  const feedRate_t real_fr_mm_s = fr_mm_s ?: homing_feedrate(axis);
1335 1336
   #if IS_SCARA
1336 1337
     // Tell the planner the axis is at 0
1337 1338
     current_position[axis] = 0;
@@ -1345,13 +1346,13 @@ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t
1345 1346
     target[axis] = distance;
1346 1347
 
1347 1348
     #if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
1348
-      const xyze_float_t delta_mm_cart{0};
1349
+      const xyze_float_t cart_dist_mm{0};
1349 1350
     #endif
1350 1351
 
1351 1352
     // Set delta/cartesian axes directly
1352 1353
     planner.buffer_segment(target
1353 1354
       #if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
1354
-        , delta_mm_cart
1355
+        , cart_dist_mm
1355 1356
       #endif
1356 1357
       , real_fr_mm_s, active_extruder
1357 1358
     );

+ 48
- 48
Marlin/src/module/planner.cpp View File

@@ -1648,8 +1648,8 @@ bool Planner::_buffer_steps(const xyze_long_t &target
1648 1648
   #if HAS_POSITION_FLOAT
1649 1649
     , const xyze_pos_t &target_float
1650 1650
   #endif
1651
-  #if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
1652
-    , const xyze_float_t &delta_mm_cart
1651
+  #if HAS_DIST_MM_ARG
1652
+    , const xyze_float_t &cart_dist_mm
1653 1653
   #endif
1654 1654
   , feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters
1655 1655
 ) {
@@ -1666,8 +1666,8 @@ bool Planner::_buffer_steps(const xyze_long_t &target
1666 1666
     #if HAS_POSITION_FLOAT
1667 1667
       , target_float
1668 1668
     #endif
1669
-    #if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
1670
-      , delta_mm_cart
1669
+    #if HAS_DIST_MM_ARG
1670
+      , cart_dist_mm
1671 1671
     #endif
1672 1672
     , fr_mm_s, extruder, millimeters
1673 1673
   )) {
@@ -1712,8 +1712,8 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
1712 1712
   #if HAS_POSITION_FLOAT
1713 1713
     , const xyze_pos_t &target_float
1714 1714
   #endif
1715
-  #if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
1716
-    , const xyze_float_t &delta_mm_cart
1715
+  #if HAS_DIST_MM_ARG
1716
+    , const xyze_float_t &cart_dist_mm
1717 1717
   #endif
1718 1718
   , feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters/*=0.0*/
1719 1719
 ) {
@@ -1840,51 +1840,51 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
1840 1840
    * So we need to create other 2 "AXIS", named X_HEAD and Y_HEAD, meaning the real displacement of the Head.
1841 1841
    * Having the real displacement of the head, we can calculate the total movement length and apply the desired speed.
1842 1842
    */
1843
-  struct DeltaMM : abce_float_t {
1843
+  struct DistanceMM : abce_float_t {
1844 1844
     #if IS_CORE
1845 1845
       xyz_pos_t head;
1846 1846
     #endif
1847
-  } delta_mm;
1847
+  } steps_dist_mm;
1848 1848
   #if IS_CORE
1849 1849
     #if CORE_IS_XY
1850
-      delta_mm.head.x = da * steps_to_mm[A_AXIS];
1851
-      delta_mm.head.y = db * steps_to_mm[B_AXIS];
1852
-      delta_mm.z      = dc * steps_to_mm[Z_AXIS];
1853
-      delta_mm.a      = (da + db) * steps_to_mm[A_AXIS];
1854
-      delta_mm.b      = CORESIGN(da - db) * steps_to_mm[B_AXIS];
1850
+      steps_dist_mm.head.x = da * steps_to_mm[A_AXIS];
1851
+      steps_dist_mm.head.y = db * steps_to_mm[B_AXIS];
1852
+      steps_dist_mm.z      = dc * steps_to_mm[Z_AXIS];
1853
+      steps_dist_mm.a      = (da + db) * steps_to_mm[A_AXIS];
1854
+      steps_dist_mm.b      = CORESIGN(da - db) * steps_to_mm[B_AXIS];
1855 1855
     #elif CORE_IS_XZ
1856
-      delta_mm.head.x = da * steps_to_mm[A_AXIS];
1857
-      delta_mm.y      = db * steps_to_mm[Y_AXIS];
1858
-      delta_mm.head.z = dc * steps_to_mm[C_AXIS];
1859
-      delta_mm.a      = (da + dc) * steps_to_mm[A_AXIS];
1860
-      delta_mm.c      = CORESIGN(da - dc) * steps_to_mm[C_AXIS];
1856
+      steps_dist_mm.head.x = da * steps_to_mm[A_AXIS];
1857
+      steps_dist_mm.y      = db * steps_to_mm[Y_AXIS];
1858
+      steps_dist_mm.head.z = dc * steps_to_mm[C_AXIS];
1859
+      steps_dist_mm.a      = (da + dc) * steps_to_mm[A_AXIS];
1860
+      steps_dist_mm.c      = CORESIGN(da - dc) * steps_to_mm[C_AXIS];
1861 1861
     #elif CORE_IS_YZ
1862
-      delta_mm.x      = da * steps_to_mm[X_AXIS];
1863
-      delta_mm.head.y = db * steps_to_mm[B_AXIS];
1864
-      delta_mm.head.z = dc * steps_to_mm[C_AXIS];
1865
-      delta_mm.b      = (db + dc) * steps_to_mm[B_AXIS];
1866
-      delta_mm.c      = CORESIGN(db - dc) * steps_to_mm[C_AXIS];
1862
+      steps_dist_mm.x      = da * steps_to_mm[X_AXIS];
1863
+      steps_dist_mm.head.y = db * steps_to_mm[B_AXIS];
1864
+      steps_dist_mm.head.z = dc * steps_to_mm[C_AXIS];
1865
+      steps_dist_mm.b      = (db + dc) * steps_to_mm[B_AXIS];
1866
+      steps_dist_mm.c      = CORESIGN(db - dc) * steps_to_mm[C_AXIS];
1867 1867
     #endif
1868 1868
   #else
1869
-    delta_mm.a = da * steps_to_mm[A_AXIS];
1870
-    delta_mm.b = db * steps_to_mm[B_AXIS];
1871
-    delta_mm.c = dc * steps_to_mm[C_AXIS];
1869
+    steps_dist_mm.a = da * steps_to_mm[A_AXIS];
1870
+    steps_dist_mm.b = db * steps_to_mm[B_AXIS];
1871
+    steps_dist_mm.c = dc * steps_to_mm[C_AXIS];
1872 1872
   #endif
1873 1873
 
1874 1874
   #if EXTRUDERS
1875
-    delta_mm.e = esteps_float * steps_to_mm[E_AXIS_N(extruder)];
1875
+    steps_dist_mm.e = esteps_float * steps_to_mm[E_AXIS_N(extruder)];
1876 1876
   #else
1877
-    delta_mm.e = 0.0f;
1877
+    steps_dist_mm.e = 0.0f;
1878 1878
   #endif
1879 1879
 
1880 1880
   #if ENABLED(LCD_SHOW_E_TOTAL)
1881
-    e_move_accumulator += delta_mm.e;
1881
+    e_move_accumulator += steps_dist_mm.e;
1882 1882
   #endif
1883 1883
 
1884 1884
   if (block->steps.a < MIN_STEPS_PER_SEGMENT && block->steps.b < MIN_STEPS_PER_SEGMENT && block->steps.c < MIN_STEPS_PER_SEGMENT) {
1885 1885
     block->millimeters = (0
1886 1886
       #if EXTRUDERS
1887
-        + ABS(delta_mm.e)
1887
+        + ABS(steps_dist_mm.e)
1888 1888
       #endif
1889 1889
     );
1890 1890
   }
@@ -1894,13 +1894,13 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
1894 1894
     else
1895 1895
       block->millimeters = SQRT(
1896 1896
         #if CORE_IS_XY
1897
-          sq(delta_mm.head.x) + sq(delta_mm.head.y) + sq(delta_mm.z)
1897
+          sq(steps_dist_mm.head.x) + sq(steps_dist_mm.head.y) + sq(steps_dist_mm.z)
1898 1898
         #elif CORE_IS_XZ
1899
-          sq(delta_mm.head.x) + sq(delta_mm.y) + sq(delta_mm.head.z)
1899
+          sq(steps_dist_mm.head.x) + sq(steps_dist_mm.y) + sq(steps_dist_mm.head.z)
1900 1900
         #elif CORE_IS_YZ
1901
-          sq(delta_mm.x) + sq(delta_mm.head.y) + sq(delta_mm.head.z)
1901
+          sq(steps_dist_mm.x) + sq(steps_dist_mm.head.y) + sq(steps_dist_mm.head.z)
1902 1902
         #else
1903
-          sq(delta_mm.x) + sq(delta_mm.y) + sq(delta_mm.z)
1903
+          sq(steps_dist_mm.x) + sq(steps_dist_mm.y) + sq(steps_dist_mm.z)
1904 1904
         #endif
1905 1905
       );
1906 1906
 
@@ -2071,7 +2071,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
2071 2071
 
2072 2072
   #if ENABLED(FILAMENT_WIDTH_SENSOR)
2073 2073
     if (extruder == FILAMENT_SENSOR_EXTRUDER_NUM)   // Only for extruder with filament sensor
2074
-      filwidth.advance_e(delta_mm.e);
2074
+      filwidth.advance_e(steps_dist_mm.e);
2075 2075
   #endif
2076 2076
 
2077 2077
   // Calculate and limit speed in mm/sec
@@ -2081,7 +2081,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
2081 2081
 
2082 2082
   // Linear axes first with less logic
2083 2083
   LOOP_XYZ(i) {
2084
-    current_speed[i] = delta_mm[i] * inverse_secs;
2084
+    current_speed[i] = steps_dist_mm[i] * inverse_secs;
2085 2085
     const feedRate_t cs = ABS(current_speed[i]),
2086 2086
                  max_fr = settings.max_feedrate_mm_s[i];
2087 2087
     if (cs > max_fr) NOMORE(speed_factor, max_fr / cs);
@@ -2090,7 +2090,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
2090 2090
   // Limit speed on extruders, if any
2091 2091
   #if EXTRUDERS
2092 2092
     {
2093
-      current_speed.e = delta_mm.e * inverse_secs;
2093
+      current_speed.e = steps_dist_mm.e * inverse_secs;
2094 2094
       #if BOTH(MIXING_EXTRUDER, RETRACT_SYNC_MIXING)
2095 2095
         // Move all mixing extruders at the specified rate
2096 2096
         if (mixer.get_current_vtool() == MIXER_AUTORETRACT_TOOL)
@@ -2308,10 +2308,10 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
2308 2308
     static xyze_float_t prev_unit_vec;
2309 2309
 
2310 2310
     xyze_float_t unit_vec =
2311
-      #if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
2312
-        delta_mm_cart
2311
+      #if HAS_DIST_MM_ARG
2312
+        cart_dist_mm
2313 2313
       #else
2314
-        { delta_mm.x, delta_mm.y, delta_mm.z, delta_mm.e }
2314
+        { steps_dist_mm.x, steps_dist_mm.y, steps_dist_mm.z, steps_dist_mm.e }
2315 2315
       #endif
2316 2316
     ;
2317 2317
     unit_vec *= inverse_millimeters;
@@ -2572,8 +2572,8 @@ void Planner::buffer_sync_block() {
2572 2572
  *  millimeters - the length of the movement, if known
2573 2573
  */
2574 2574
 bool Planner::buffer_segment(const float &a, const float &b, const float &c, const float &e
2575
-  #if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
2576
-    , const xyze_float_t &delta_mm_cart
2575
+  #if HAS_DIST_MM_ARG
2576
+    , const xyze_float_t &cart_dist_mm
2577 2577
   #endif
2578 2578
   , const feedRate_t &fr_mm_s, const uint8_t extruder, const float &millimeters/*=0.0*/
2579 2579
 ) {
@@ -2651,8 +2651,8 @@ bool Planner::buffer_segment(const float &a, const float &b, const float &c, con
2651 2651
       #if HAS_POSITION_FLOAT
2652 2652
         , target_float
2653 2653
       #endif
2654
-      #if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
2655
-        , delta_mm_cart
2654
+      #if HAS_DIST_MM_ARG
2655
+        , cart_dist_mm
2656 2656
       #endif
2657 2657
       , fr_mm_s, extruder, millimeters
2658 2658
     )
@@ -2686,17 +2686,17 @@ bool Planner::buffer_line(const float &rx, const float &ry, const float &rz, con
2686 2686
   #if IS_KINEMATIC
2687 2687
 
2688 2688
     #if DISABLED(CLASSIC_JERK)
2689
-      const xyze_pos_t delta_mm_cart = {
2689
+      const xyze_pos_t cart_dist_mm = {
2690 2690
         rx - position_cart.x, ry - position_cart.y,
2691 2691
         rz - position_cart.z, e  - position_cart.e
2692 2692
       };
2693 2693
     #else
2694
-      const xyz_pos_t delta_mm_cart = { rx - position_cart.x, ry - position_cart.y, rz - position_cart.z };
2694
+      const xyz_pos_t cart_dist_mm = { rx - position_cart.x, ry - position_cart.y, rz - position_cart.z };
2695 2695
     #endif
2696 2696
 
2697 2697
     float mm = millimeters;
2698 2698
     if (mm == 0.0)
2699
-      mm = (delta_mm_cart.x != 0.0 || delta_mm_cart.y != 0.0) ? delta_mm_cart.magnitude() : ABS(delta_mm_cart.z);
2699
+      mm = (cart_dist_mm.x != 0.0 || cart_dist_mm.y != 0.0) ? cart_dist_mm.magnitude() : ABS(cart_dist_mm.z);
2700 2700
 
2701 2701
     // Cartesian XYZ to kinematic ABC, stored in global 'delta'
2702 2702
     inverse_kinematics(machine);
@@ -2712,7 +2712,7 @@ bool Planner::buffer_line(const float &rx, const float &ry, const float &rz, con
2712 2712
     #endif
2713 2713
     if (buffer_segment(delta.a, delta.b, delta.c, machine.e
2714 2714
       #if DISABLED(CLASSIC_JERK)
2715
-        , delta_mm_cart
2715
+        , cart_dist_mm
2716 2716
       #endif
2717 2717
       , feedrate, extruder, mm
2718 2718
     )) {

+ 14
- 10
Marlin/src/module/planner.h View File

@@ -61,6 +61,10 @@
61 61
                             manual_feedrate_mm_s { _mf.x / 60.0f, _mf.y / 60.0f, _mf.z / 60.0f, _mf.e / 60.0f };
62 62
 #endif
63 63
 
64
+#if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
65
+  #define HAS_DIST_MM_ARG 1
66
+#endif
67
+
64 68
 enum BlockFlagBit : char {
65 69
   // Recalculate trapezoids on entry junction. For optimization.
66 70
   BLOCK_BIT_RECALCULATE,
@@ -588,8 +592,8 @@ class Planner {
588 592
       #if HAS_POSITION_FLOAT
589 593
         , const xyze_pos_t &target_float
590 594
       #endif
591
-      #if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
592
-        , const xyze_float_t &delta_mm_cart
595
+      #if HAS_DIST_MM_ARG
596
+        , const xyze_float_t &cart_dist_mm
593 597
       #endif
594 598
       , feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters=0.0
595 599
     );
@@ -611,8 +615,8 @@ class Planner {
611 615
       #if HAS_POSITION_FLOAT
612 616
         , const xyze_pos_t &target_float
613 617
       #endif
614
-      #if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
615
-        , const xyze_float_t &delta_mm_cart
618
+      #if HAS_DIST_MM_ARG
619
+        , const xyze_float_t &cart_dist_mm
616 620
       #endif
617 621
       , feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters=0.0
618 622
     );
@@ -643,21 +647,21 @@ class Planner {
643 647
      *  millimeters - the length of the movement, if known
644 648
      */
645 649
     static bool buffer_segment(const float &a, const float &b, const float &c, const float &e
646
-      #if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
647
-        , const xyze_float_t &delta_mm_cart
650
+      #if HAS_DIST_MM_ARG
651
+        , const xyze_float_t &cart_dist_mm
648 652
       #endif
649 653
       , const feedRate_t &fr_mm_s, const uint8_t extruder, const float &millimeters=0.0
650 654
     );
651 655
 
652 656
     FORCE_INLINE static bool buffer_segment(abce_pos_t &abce
653
-      #if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
654
-        , const xyze_float_t &delta_mm_cart
657
+      #if HAS_DIST_MM_ARG
658
+        , const xyze_float_t &cart_dist_mm
655 659
       #endif
656 660
       , const feedRate_t &fr_mm_s, const uint8_t extruder, const float &millimeters=0.0
657 661
     ) {
658 662
       return buffer_segment(abce.a, abce.b, abce.c, abce.e
659
-        #if IS_KINEMATIC && DISABLED(CLASSIC_JERK)
660
-          , delta_mm_cart
663
+        #if HAS_DIST_MM_ARG
664
+          , cart_dist_mm
661 665
         #endif
662 666
         , fr_mm_s, extruder, millimeters);
663 667
     }

Loading…
Cancel
Save