Browse Source

Scale feedrate (mm/s to deg/s) for SCARA

Scott Lahteine 7 years ago
parent
commit
e8e60263c8

+ 1
- 1
.travis.yml View File

@@ -315,7 +315,7 @@ script:
315 315
   # SCARA with TMC2130
316 316
   #
317 317
   - use_example_configs SCARA
318
-  - opt_enable AUTO_BED_LEVELING_BILINEAR FIX_MOUNTED_PROBE USE_ZMIN_PLUG EEPROM_SETTINGS EEPROM_CHITCHAT ULTIMAKERCONTROLLER
318
+  - opt_enable AUTO_BED_LEVELING_BILINEAR FIX_MOUNTED_PROBE USE_ZMIN_PLUG EEPROM_SETTINGS EEPROM_CHITCHAT ULTIMAKERCONTROLLER SCARA_FEEDRATE_SCALING
319 319
   - opt_enable_adv HAVE_TMC2130 X_IS_TMC2130 Y_IS_TMC2130 Z_IS_TMC2130
320 320
   - opt_enable_adv MONITOR_DRIVER_STATUS STEALTHCHOP HYBRID_THRESHOLD SENSORLESS_HOMING
321 321
   - build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM}

+ 2
- 0
Marlin/src/config/examples/SCARA/Configuration.h View File

@@ -72,7 +72,9 @@
72 72
 //#define MAKERARM_SCARA
73 73
 
74 74
 #if ENABLED(MORGAN_SCARA) || ENABLED(MAKERARM_SCARA)
75
+
75 76
   //#define DEBUG_SCARA_KINEMATICS
77
+  #define SCARA_FEEDRATE_SCALING // Convert XY feedrate from mm/s to degrees/s on the fly
76 78
 
77 79
   // If movement is choppy try lowering this value
78 80
   #define SCARA_SEGMENTS_PER_SECOND 200

+ 31
- 2
Marlin/src/gcode/motion/G2_G3.cpp View File

@@ -35,6 +35,10 @@
35 35
   #include "../../module/scara.h"
36 36
 #endif
37 37
 
38
+#if ENABLED(SCARA_FEEDRATE_SCALING) && ENABLED(AUTO_BED_LEVELING_BILINEAR)
39
+  #include "../../feature/bedlevel/abl/abl.h"
40
+#endif
41
+
38 42
 #if N_ARC_CORRECTION < 1
39 43
   #undef N_ARC_CORRECTION
40 44
   #define N_ARC_CORRECTION 1
@@ -137,6 +141,14 @@ void plan_arc(
137 141
 
138 142
   millis_t next_idle_ms = millis() + 200UL;
139 143
 
144
+  #if ENABLED(SCARA_FEEDRATE_SCALING)
145
+    // SCARA needs to scale the feed rate from mm/s to degrees/s
146
+    const float inv_segment_length = 1.0 / (MM_PER_ARC_SEGMENT),
147
+                inverse_secs = inv_segment_length * fr_mm_s;
148
+    float oldA = planner.position_float[A_AXIS],
149
+          oldB = planner.position_float[B_AXIS];
150
+  #endif
151
+
140 152
   #if N_ARC_CORRECTION > 1
141 153
     int8_t arc_recalc_count = N_ARC_CORRECTION;
142 154
   #endif
@@ -180,11 +192,28 @@ void plan_arc(
180 192
 
181 193
     clamp_to_software_endstops(raw);
182 194
 
183
-    planner.buffer_line_kinematic(raw, fr_mm_s, active_extruder);
195
+    #if ENABLED(SCARA_FEEDRATE_SCALING)
196
+      // For SCARA scale the feed rate from mm/s to degrees/s
197
+      // i.e., Complete the angular vector in the given time.
198
+      inverse_kinematics(raw);
199
+      ADJUST_DELTA(raw);
200
+      planner.buffer_segment(delta[A_AXIS], delta[B_AXIS], raw[Z_AXIS], raw[E_AXIS], HYPOT(delta[A_AXIS] - oldA, delta[B_AXIS] - oldB) * inverse_secs, active_extruder);
201
+      oldA = delta[A_AXIS]; oldB = delta[B_AXIS];
202
+    #else
203
+      planner.buffer_line_kinematic(raw, fr_mm_s, active_extruder);
204
+    #endif
184 205
   }
185 206
 
186 207
   // Ensure last segment arrives at target location.
187
-  planner.buffer_line_kinematic(cart, fr_mm_s, active_extruder);
208
+  #if ENABLED(SCARA_FEEDRATE_SCALING)
209
+    inverse_kinematics(cart);
210
+    ADJUST_DELTA(cart);
211
+    const float diff2 = HYPOT2(delta[A_AXIS] - oldA, delta[B_AXIS] - oldB);
212
+    if (diff2)
213
+      planner.buffer_segment(delta[A_AXIS], delta[B_AXIS], cart[Z_AXIS], cart[E_AXIS], SQRT(diff2) * inverse_secs, active_extruder);
214
+  #else
215
+    planner.buffer_line_kinematic(cart, fr_mm_s, active_extruder);
216
+  #endif
188 217
 
189 218
   // As far as the parser is concerned, the position is now == target. In reality the
190 219
   // motion control system might still be processing the action and the real tool position

+ 83
- 25
Marlin/src/module/motion.cpp View File

@@ -498,20 +498,18 @@ float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
498 498
 #if !UBL_SEGMENTED
499 499
 #if IS_KINEMATIC
500 500
 
501
-  #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
502
-    #if ENABLED(DELTA)
503
-      #define ADJUST_DELTA(V) \
504
-        if (planner.leveling_active) { \
505
-          const float zadj = bilinear_z_offset(V); \
506
-          delta[A_AXIS] += zadj; \
507
-          delta[B_AXIS] += zadj; \
508
-          delta[C_AXIS] += zadj; \
509
-        }
510
-    #else
511
-      #define ADJUST_DELTA(V) if (planner.leveling_active) { delta[Z_AXIS] += bilinear_z_offset(V); }
512
-    #endif
513
-  #else
514
-    #define ADJUST_DELTA(V) NOOP
501
+  #if IS_SCARA
502
+    /**
503
+     * Before raising this value, use M665 S[seg_per_sec] to decrease
504
+     * the number of segments-per-second. Default is 200. Some deltas
505
+     * do better with 160 or lower. It would be good to know how many
506
+     * segments-per-second are actually possible for SCARA on AVR.
507
+     *
508
+     * Longer segments result in less kinematic overhead
509
+     * but may produce jagged lines. Try 0.5mm, 1.0mm, and 2.0mm
510
+     * and compare the difference.
511
+     */
512
+    #define SCARA_MIN_SEGMENT_LENGTH 0.5
515 513
   #endif
516 514
 
517 515
   /**
@@ -566,9 +564,9 @@ float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
566 564
     // gives the number of segments
567 565
     uint16_t segments = delta_segments_per_second * seconds;
568 566
 
569
-    // For SCARA minimum segment size is 0.25mm
567
+    // For SCARA enforce a minimum segment size
570 568
     #if IS_SCARA
571
-      NOMORE(segments, cartesian_mm * 4);
569
+      NOMORE(segments, cartesian_mm * (1.0 / SCARA_MIN_SEGMENT_LENGTH));
572 570
     #endif
573 571
 
574 572
     // At least one segment is required
@@ -576,7 +574,6 @@ float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
576 574
 
577 575
     // The approximate length of each segment
578 576
     const float inv_segments = 1.0 / float(segments),
579
-                cartesian_segment_mm = cartesian_mm * inv_segments,
580 577
                 segment_distance[XYZE] = {
581 578
                   xdiff * inv_segments,
582 579
                   ydiff * inv_segments,
@@ -584,16 +581,47 @@ float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
584 581
                   ediff * inv_segments
585 582
                 };
586 583
 
587
-    // SERIAL_ECHOPAIR("mm=", cartesian_mm);
588
-    // SERIAL_ECHOPAIR(" seconds=", seconds);
589
-    // SERIAL_ECHOLNPAIR(" segments=", segments);
590
-    // SERIAL_ECHOLNPAIR(" segment_mm=", cartesian_segment_mm);
584
+    #if DISABLED(SCARA_FEEDRATE_SCALING)
585
+      const float cartesian_segment_mm = cartesian_mm * inv_segments;
586
+    #endif
591 587
 
592
-    // Get the current position as starting point
588
+    /*
589
+    SERIAL_ECHOPAIR("mm=", cartesian_mm);
590
+    SERIAL_ECHOPAIR(" seconds=", seconds);
591
+    SERIAL_ECHOPAIR(" segments=", segments);
592
+    #if DISABLED(SCARA_FEEDRATE_SCALING)
593
+      SERIAL_ECHOLNPAIR(" segment_mm=", cartesian_segment_mm);
594
+    #else
595
+      SERIAL_EOL();
596
+    #endif
597
+    //*/
598
+
599
+    #if ENABLED(SCARA_FEEDRATE_SCALING)
600
+      // SCARA needs to scale the feed rate from mm/s to degrees/s
601
+      // i.e., Complete the angular vector in the given time.
602
+      const float segment_length = cartesian_mm * inv_segments,
603
+                  inv_segment_length = 1.0 / segment_length, // 1/mm/segs
604
+                  inverse_secs = inv_segment_length * _feedrate_mm_s;
605
+
606
+      float oldA = planner.position_float[A_AXIS],
607
+            oldB = planner.position_float[B_AXIS];
608
+
609
+      /*
610
+      SERIAL_ECHOPGM("Scaled kinematic move: ");
611
+      SERIAL_ECHOPAIR(" segment_length (inv)=", segment_length);
612
+      SERIAL_ECHOPAIR(" (", inv_segment_length);
613
+      SERIAL_ECHOPAIR(") _feedrate_mm_s=", _feedrate_mm_s);
614
+      SERIAL_ECHOPAIR(" inverse_secs=", inverse_secs);
615
+      SERIAL_ECHOPAIR(" oldA=", oldA);
616
+      SERIAL_ECHOLNPAIR(" oldB=", oldB);
617
+      safe_delay(5);
618
+      //*/
619
+    #endif
620
+ 
621
+     // Get the current position as starting point
593 622
     float raw[XYZE];
594 623
     COPY(raw, current_position);
595 624
 
596
-
597 625
     // Calculate and execute the segments
598 626
     while (--segments) {
599 627
 
@@ -613,11 +641,41 @@ float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
613 641
       #endif
614 642
       ADJUST_DELTA(raw); // Adjust Z if bed leveling is enabled
615 643
 
616
-      planner.buffer_line(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], raw[E_AXIS], _feedrate_mm_s, active_extruder, cartesian_segment_mm);
644
+      #if ENABLED(SCARA_FEEDRATE_SCALING)
645
+        // For SCARA scale the feed rate from mm/s to degrees/s
646
+        // i.e., Complete the angular vector in the given time.
647
+        planner.buffer_segment(delta[A_AXIS], delta[B_AXIS], raw[Z_AXIS], raw[E_AXIS], HYPOT(delta[A_AXIS] - oldA, delta[B_AXIS] - oldB) * inverse_secs, active_extruder);
648
+        /*
649
+        SERIAL_ECHO(segments);
650
+        SERIAL_ECHOPAIR(": X=", raw[X_AXIS]); SERIAL_ECHOPAIR(" Y=", raw[Y_AXIS]);
651
+        SERIAL_ECHOPAIR(" A=", delta[A_AXIS]); SERIAL_ECHOPAIR(" B=", delta[B_AXIS]);
652
+        SERIAL_ECHOLNPAIR(" F", HYPOT(delta[A_AXIS] - oldA, delta[B_AXIS] - oldB) * inverse_secs * 60);
653
+        safe_delay(5);
654
+        //*/
655
+        oldA = delta[A_AXIS]; oldB = delta[B_AXIS];
656
+      #else
657
+        planner.buffer_line(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], raw[E_AXIS], _feedrate_mm_s, active_extruder, cartesian_segment_mm);
658
+      #endif
617 659
     }
618 660
 
619 661
     // Ensure last segment arrives at target location.
620
-    planner.buffer_line_kinematic(rtarget, _feedrate_mm_s, active_extruder, cartesian_segment_mm);
662
+    #if ENABLED(SCARA_FEEDRATE_SCALING)
663
+      inverse_kinematics(rtarget);
664
+      ADJUST_DELTA(rtarget);
665
+      const float diff2 = HYPOT2(delta[A_AXIS] - oldA, delta[B_AXIS] - oldB);
666
+      if (diff2) {
667
+        planner.buffer_segment(delta[A_AXIS], delta[B_AXIS], rtarget[Z_AXIS], rtarget[E_AXIS], SQRT(diff2) * inverse_secs, active_extruder);
668
+        /*
669
+        SERIAL_ECHOPAIR("final: A=", delta[A_AXIS]); SERIAL_ECHOPAIR(" B=", delta[B_AXIS]);
670
+        SERIAL_ECHOPAIR(" adiff=", delta[A_AXIS] - oldA); SERIAL_ECHOPAIR(" bdiff=", delta[B_AXIS] - oldB);
671
+        SERIAL_ECHOLNPAIR(" F", (SQRT(diff2) * inverse_secs) * 60);
672
+        SERIAL_EOL();
673
+        safe_delay(5);
674
+        //*/
675
+      }
676
+    #else
677
+      planner.buffer_line_kinematic(rtarget, _feedrate_mm_s, active_extruder, cartesian_segment_mm);
678
+    #endif
621 679
 
622 680
     return false; // caller will update current_position
623 681
   }

+ 16
- 0
Marlin/src/module/motion.h View File

@@ -340,4 +340,20 @@ void homeaxis(const AxisEnum axis);
340 340
   void set_home_offset(const AxisEnum axis, const float v);
341 341
 #endif
342 342
 
343
+#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
344
+  #if ENABLED(DELTA)
345
+    #define ADJUST_DELTA(V) \
346
+      if (planner.leveling_active) { \
347
+        const float zadj = bilinear_z_offset(V); \
348
+        delta[A_AXIS] += zadj; \
349
+        delta[B_AXIS] += zadj; \
350
+        delta[C_AXIS] += zadj; \
351
+      }
352
+  #else
353
+    #define ADJUST_DELTA(V) if (planner.leveling_active) { delta[Z_AXIS] += bilinear_z_offset(V); }
354
+  #endif
355
+#else
356
+  #define ADJUST_DELTA(V) NOOP
357
+#endif
358
+
343 359
 #endif // MOTION_H

+ 24
- 17
Marlin/src/module/planner.cpp View File

@@ -185,8 +185,11 @@ float Planner::previous_speed[NUM_AXIS],
185 185
 #endif
186 186
 
187 187
 #if ENABLED(LIN_ADVANCE)
188
-  float Planner::extruder_advance_K, // Initialized by settings.load()
189
-        Planner::position_float[XYZE]; // Needed for accurate maths. Steps cannot be used!
188
+  float Planner::extruder_advance_K; // Initialized by settings.load()
189
+#endif
190
+
191
+#if HAS_POSITION_FLOAT
192
+  float Planner::position_float[XYZE]; // Needed for accurate maths. Steps cannot be used!
190 193
 #endif
191 194
 
192 195
 #if ENABLED(ULTRA_LCD)
@@ -202,7 +205,7 @@ Planner::Planner() { init(); }
202 205
 void Planner::init() {
203 206
   block_buffer_head = block_buffer_tail = 0;
204 207
   ZERO(position);
205
-  #if ENABLED(LIN_ADVANCE)
208
+  #if HAS_POSITION_FLOAT
206 209
     ZERO(position_float);
207 210
   #endif
208 211
   ZERO(previous_speed);
@@ -745,7 +748,7 @@ void Planner::check_axes_activity() {
745 748
  *  extruder    - target extruder
746 749
  */
747 750
 void Planner::_buffer_steps(const int32_t (&target)[XYZE]
748
-  #if ENABLED(LIN_ADVANCE)
751
+  #if HAS_POSITION_FLOAT
749 752
     , const float (&target_float)[XYZE]
750 753
   #endif
751 754
   , float fr_mm_s, const uint8_t extruder, const float &millimeters/*=0.0*/
@@ -775,7 +778,7 @@ void Planner::_buffer_steps(const int32_t (&target)[XYZE]
775 778
       #if ENABLED(PREVENT_COLD_EXTRUSION)
776 779
         if (thermalManager.tooColdToExtrude(extruder)) {
777 780
           position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
778
-          #if ENABLED(LIN_ADVANCE)
781
+          #if HAS_POSITION_FLOAT
779 782
             position_float[E_AXIS] = target_float[E_AXIS];
780 783
           #endif
781 784
           de = 0; // no difference
@@ -786,7 +789,7 @@ void Planner::_buffer_steps(const int32_t (&target)[XYZE]
786 789
       #if ENABLED(PREVENT_LENGTHY_EXTRUDE)
787 790
         if (labs(de * e_factor[extruder]) > (int32_t)axis_steps_per_mm[E_AXIS_N] * (EXTRUDE_MAXLENGTH)) { // It's not important to get max. extrusion length in a precision < 1mm, so save some cycles and cast to int
788 791
           position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
789
-          #if ENABLED(LIN_ADVANCE)
792
+          #if HAS_POSITION_FLOAT
790 793
             position_float[E_AXIS] = target_float[E_AXIS];
791 794
           #endif
792 795
           de = 0; // no difference
@@ -857,6 +860,10 @@ void Planner::_buffer_steps(const int32_t (&target)[XYZE]
857 860
     block->steps[X_AXIS] = labs(da);
858 861
     block->steps[B_AXIS] = labs(db + dc);
859 862
     block->steps[C_AXIS] = labs(db - dc);
863
+  #elif IS_SCARA
864
+    block->steps[A_AXIS] = labs(da);
865
+    block->steps[B_AXIS] = labs(db);
866
+    block->steps[Z_AXIS] = labs(dc);
860 867
   #else
861 868
     // default non-h-bot planning
862 869
     block->steps[A_AXIS] = labs(da);
@@ -892,7 +899,7 @@ void Planner::_buffer_steps(const int32_t (&target)[XYZE]
892 899
       powerManager.power_on();
893 900
   #endif
894 901
 
895
-  //enable active axes
902
+  // Enable active axes
896 903
   #if CORE_IS_XY
897 904
     if (block->steps[A_AXIS] || block->steps[B_AXIS]) {
898 905
       enable_X();
@@ -1463,7 +1470,7 @@ void Planner::_buffer_steps(const int32_t (&target)[XYZE]
1463 1470
   // Update the position (only when a move was queued)
1464 1471
   static_assert(COUNT(target) > 1, "Parameter to _buffer_steps must be (&target)[XYZE]!");
1465 1472
   COPY(position, target);
1466
-  #if ENABLED(LIN_ADVANCE)
1473
+  #if HAS_POSITION_FLOAT
1467 1474
     COPY(position_float, target_float);
1468 1475
   #endif
1469 1476
 
@@ -1501,14 +1508,14 @@ void Planner::buffer_segment(const float &a, const float &b, const float &c, con
1501 1508
     LROUND(e * axis_steps_per_mm[E_AXIS_N])
1502 1509
   };
1503 1510
 
1504
-  #if ENABLED(LIN_ADVANCE)
1511
+  #if HAS_POSITION_FLOAT
1505 1512
     const float target_float[XYZE] = { a, b, c, e };
1506 1513
   #endif
1507 1514
 
1508 1515
   // DRYRUN prevents E moves from taking place
1509 1516
   if (DEBUGGING(DRYRUN)) {
1510 1517
     position[E_AXIS] = target[E_AXIS];
1511
-    #if ENABLED(LIN_ADVANCE)
1518
+    #if HAS_POSITION_FLOAT
1512 1519
       position_float[E_AXIS] = e;
1513 1520
     #endif
1514 1521
   }
@@ -1547,7 +1554,7 @@ void Planner::buffer_segment(const float &a, const float &b, const float &c, con
1547 1554
     #define _BETWEEN(A) (position[A##_AXIS] + target[A##_AXIS]) >> 1
1548 1555
     const int32_t between[ABCE] = { _BETWEEN(A), _BETWEEN(B), _BETWEEN(C), _BETWEEN(E) };
1549 1556
 
1550
-    #if ENABLED(LIN_ADVANCE)
1557
+    #if HAS_POSITION_FLOAT
1551 1558
       #define _BETWEEN_F(A) (position_float[A##_AXIS] + target_float[A##_AXIS]) * 0.5
1552 1559
       const float between_float[ABCE] = { _BETWEEN_F(A), _BETWEEN_F(B), _BETWEEN_F(C), _BETWEEN_F(E) };
1553 1560
     #endif
@@ -1555,7 +1562,7 @@ void Planner::buffer_segment(const float &a, const float &b, const float &c, con
1555 1562
     DISABLE_STEPPER_DRIVER_INTERRUPT();
1556 1563
 
1557 1564
     _buffer_steps(between
1558
-      #if ENABLED(LIN_ADVANCE)
1565
+      #if HAS_POSITION_FLOAT
1559 1566
         , between_float
1560 1567
       #endif
1561 1568
       , fr_mm_s, extruder, millimeters * 0.5
@@ -1564,7 +1571,7 @@ void Planner::buffer_segment(const float &a, const float &b, const float &c, con
1564 1571
     const uint8_t next = block_buffer_head;
1565 1572
 
1566 1573
     _buffer_steps(target
1567
-      #if ENABLED(LIN_ADVANCE)
1574
+      #if HAS_POSITION_FLOAT
1568 1575
         , target_float
1569 1576
       #endif
1570 1577
       , fr_mm_s, extruder, millimeters * 0.5
@@ -1575,7 +1582,7 @@ void Planner::buffer_segment(const float &a, const float &b, const float &c, con
1575 1582
   }
1576 1583
   else
1577 1584
     _buffer_steps(target
1578
-      #if ENABLED(LIN_ADVANCE)
1585
+      #if HAS_POSITION_FLOAT
1579 1586
         , target_float
1580 1587
       #endif
1581 1588
       , fr_mm_s, extruder, millimeters
@@ -1603,7 +1610,7 @@ void Planner::_set_position_mm(const float &a, const float &b, const float &c, c
1603 1610
                 nb = position[B_AXIS] = LROUND(b * axis_steps_per_mm[B_AXIS]),
1604 1611
                 nc = position[C_AXIS] = LROUND(c * axis_steps_per_mm[C_AXIS]),
1605 1612
                 ne = position[E_AXIS] = LROUND(e * axis_steps_per_mm[_EINDEX]);
1606
-  #if ENABLED(LIN_ADVANCE)
1613
+  #if HAS_POSITION_FLOAT
1607 1614
     position_float[X_AXIS] = a;
1608 1615
     position_float[Y_AXIS] = b;
1609 1616
     position_float[Z_AXIS] = c;
@@ -1635,7 +1642,7 @@ void Planner::set_position_mm_kinematic(const float (&cart)[XYZE]) {
1635 1642
 void Planner::sync_from_steppers() {
1636 1643
   LOOP_XYZE(i) {
1637 1644
     position[i] = stepper.position((AxisEnum)i);
1638
-    #if ENABLED(LIN_ADVANCE)
1645
+    #if HAS_POSITION_FLOAT
1639 1646
       position_float[i] = position[i] * steps_to_mm[i
1640 1647
         #if ENABLED(DISTINCT_E_FACTORS)
1641 1648
           + (i == E_AXIS ? active_extruder : 0)
@@ -1656,7 +1663,7 @@ void Planner::set_position_mm(const AxisEnum axis, const float &v) {
1656 1663
     const uint8_t axis_index = axis;
1657 1664
   #endif
1658 1665
   position[axis] = LROUND(v * axis_steps_per_mm[axis_index]);
1659
-  #if ENABLED(LIN_ADVANCE)
1666
+  #if HAS_POSITION_FLOAT
1660 1667
     position_float[axis] = v;
1661 1668
   #endif
1662 1669
   stepper.set_position(axis, v);

+ 8
- 3
Marlin/src/module/planner.h View File

@@ -130,6 +130,8 @@ typedef struct {
130 130
 
131 131
 } block_t;
132 132
 
133
+#define HAS_POSITION_FLOAT (ENABLED(LIN_ADVANCE) || ENABLED(SCARA_FEEDRATE_SCALING))
134
+
133 135
 #define BLOCK_MOD(n) ((n)&(BLOCK_BUFFER_SIZE-1))
134 136
 
135 137
 class Planner {
@@ -194,8 +196,11 @@ class Planner {
194 196
     #endif
195 197
 
196 198
     #if ENABLED(LIN_ADVANCE)
197
-      static float extruder_advance_K,
198
-                   position_float[XYZE];
199
+      static float extruder_advance_K;
200
+    #endif
201
+
202
+    #if HAS_POSITION_FLOAT
203
+      static float position_float[XYZE];
199 204
     #endif
200 205
 
201 206
     #if ENABLED(SKEW_CORRECTION)
@@ -417,7 +422,7 @@ class Planner {
417 422
      *  millimeters - the length of the movement, if known
418 423
      */
419 424
     static void _buffer_steps(const int32_t (&target)[XYZE]
420
-      #if ENABLED(LIN_ADVANCE)
425
+      #if HAS_POSITION_FLOAT
421 426
         , const float (&target_float)[XYZE]
422 427
       #endif
423 428
       , float fr_mm_s, const uint8_t extruder, const float &millimeters=0.0

Loading…
Cancel
Save