ソースを参照

Add a feedRate_t data type (#15349)

Scott Lahteine 5年前
コミット
455dabb183
コミッターのメールアドレスに関連付けられたアカウントが存在しません
42個のファイルの変更382行の追加375行の削除
  1. 3
    0
      Marlin/src/core/macros.h
  2. 7
    9
      Marlin/src/feature/I2CPositionEncoder.cpp
  3. 5
    5
      Marlin/src/feature/bedlevel/abl/abl.cpp
  4. 1
    1
      Marlin/src/feature/bedlevel/abl/abl.h
  5. 5
    5
      Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp
  6. 1
    1
      Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h
  7. 2
    2
      Marlin/src/feature/bedlevel/ubl/ubl.h
  8. 25
    28
      Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp
  9. 18
    21
      Marlin/src/feature/fwretract.cpp
  10. 8
    8
      Marlin/src/feature/fwretract.h
  11. 5
    5
      Marlin/src/feature/pause.cpp
  12. 1
    1
      Marlin/src/feature/pause.h
  13. 8
    9
      Marlin/src/feature/prusa_MMU2/mmu2.cpp
  14. 12
    19
      Marlin/src/gcode/bedlevel/G26.cpp
  15. 6
    4
      Marlin/src/gcode/bedlevel/G42.cpp
  16. 1
    2
      Marlin/src/gcode/bedlevel/mbl/G29.cpp
  17. 4
    5
      Marlin/src/gcode/calibrate/G425.cpp
  18. 18
    20
      Marlin/src/gcode/feature/L6470/M916-918.cpp
  19. 6
    6
      Marlin/src/gcode/feature/camera/M240.cpp
  20. 4
    4
      Marlin/src/gcode/feature/pause/M701_M702.cpp
  21. 1
    1
      Marlin/src/gcode/gcode.cpp
  22. 1
    1
      Marlin/src/gcode/gcode.h
  23. 10
    10
      Marlin/src/gcode/motion/G0_G1.cpp
  24. 4
    4
      Marlin/src/gcode/motion/G2_G3.cpp
  25. 1
    1
      Marlin/src/gcode/parser.h
  26. 2
    2
      Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/bio_status_screen.cpp
  27. 16
    22
      Marlin/src/lcd/extensible_ui/ui_api.cpp
  28. 9
    9
      Marlin/src/lcd/extensible_ui/ui_api.h
  29. 4
    4
      Marlin/src/lcd/menu/menu_ubl.cpp
  30. 3
    6
      Marlin/src/lcd/ultralcd.cpp
  31. 1
    1
      Marlin/src/lcd/ultralcd.h
  32. 1
    1
      Marlin/src/libs/nozzle.cpp
  33. 18
    17
      Marlin/src/module/configuration_store.cpp
  34. 3
    3
      Marlin/src/module/delta.cpp
  35. 89
    69
      Marlin/src/module/motion.cpp
  36. 29
    22
      Marlin/src/module/motion.h
  37. 10
    11
      Marlin/src/module/planner.cpp
  38. 18
    19
      Marlin/src/module/planner.h
  39. 9
    4
      Marlin/src/module/planner_bezier.cpp
  40. 6
    6
      Marlin/src/module/planner_bezier.h
  41. 1
    1
      Marlin/src/module/probe.cpp
  42. 6
    6
      Marlin/src/module/tool_change.h

+ 3
- 0
Marlin/src/core/macros.h ファイルの表示

@@ -244,8 +244,11 @@
244 244
 #define DECREMENT_(n) DEC_##n
245 245
 #define DECREMENT(n) DECREMENT_(n)
246 246
 
247
+// Feedrate
248
+typedef float feedRate_t;
247 249
 #define MMM_TO_MMS(MM_M) ((MM_M)/60.0f)
248 250
 #define MMS_TO_MMM(MM_S) ((MM_S)*60.0f)
251
+#define MMS_SCALED(V)    ((V) * 0.01f * feedrate_percentage)
249 252
 
250 253
 #define NOOP (void(0))
251 254
 

+ 7
- 9
Marlin/src/feature/I2CPositionEncoder.cpp ファイルの表示

@@ -329,8 +329,8 @@ bool I2CPositionEncoder::test_axis() {
329 329
   float startCoord[NUM_AXIS] = { 0 }, endCoord[NUM_AXIS] = { 0 };
330 330
 
331 331
   const float startPosition = soft_endstop[encoderAxis].min + 10,
332
-              endPosition = soft_endstop[encoderAxis].max - 10,
333
-              feedrate = FLOOR(MMM_TO_MMS((encoderAxis == Z_AXIS) ? HOMING_FEEDRATE_Z : HOMING_FEEDRATE_XY));
332
+              endPosition = soft_endstop[encoderAxis].max - 10;
333
+  const feedRate_t fr_mm_s = FLOOR(MMM_TO_MMS((encoderAxis == Z_AXIS) ? HOMING_FEEDRATE_Z : HOMING_FEEDRATE_XY));
334 334
 
335 335
   ec = false;
336 336
 
@@ -344,7 +344,7 @@ bool I2CPositionEncoder::test_axis() {
344 344
   planner.synchronize();
345 345
 
346 346
   planner.buffer_line(startCoord[X_AXIS], startCoord[Y_AXIS], startCoord[Z_AXIS],
347
-                      planner.get_axis_position_mm(E_AXIS), feedrate, 0);
347
+                      planner.get_axis_position_mm(E_AXIS), fr_mm_s, 0);
348 348
   planner.synchronize();
349 349
 
350 350
   // if the module isn't currently trusted, wait until it is (or until it should be if things are working)
@@ -356,7 +356,7 @@ bool I2CPositionEncoder::test_axis() {
356 356
 
357 357
   if (trusted) { // if trusted, commence test
358 358
     planner.buffer_line(endCoord[X_AXIS], endCoord[Y_AXIS], endCoord[Z_AXIS],
359
-                        planner.get_axis_position_mm(E_AXIS), feedrate, 0);
359
+                        planner.get_axis_position_mm(E_AXIS), fr_mm_s, 0);
360 360
     planner.synchronize();
361 361
   }
362 362
 
@@ -379,11 +379,9 @@ void I2CPositionEncoder::calibrate_steps_mm(const uint8_t iter) {
379 379
         travelDistance, travelledDistance, total = 0,
380 380
         startCoord[NUM_AXIS] = { 0 }, endCoord[NUM_AXIS] = { 0 };
381 381
 
382
-  float feedrate;
383
-
384 382
   int32_t startCount, stopCount;
385 383
 
386
-  feedrate = MMM_TO_MMS((encoderAxis == Z_AXIS) ? HOMING_FEEDRATE_Z : HOMING_FEEDRATE_XY);
384
+  const feedRate_t fr_mm_s = MMM_TO_MMS((encoderAxis == Z_AXIS) ? HOMING_FEEDRATE_Z : HOMING_FEEDRATE_XY);
387 385
 
388 386
   bool oldec = ec;
389 387
   ec = false;
@@ -404,7 +402,7 @@ void I2CPositionEncoder::calibrate_steps_mm(const uint8_t iter) {
404 402
 
405 403
   LOOP_L_N(i, iter) {
406 404
     planner.buffer_line(startCoord[X_AXIS], startCoord[Y_AXIS], startCoord[Z_AXIS],
407
-                        planner.get_axis_position_mm(E_AXIS), feedrate, 0);
405
+                        planner.get_axis_position_mm(E_AXIS), fr_mm_s, 0);
408 406
     planner.synchronize();
409 407
 
410 408
     delay(250);
@@ -413,7 +411,7 @@ void I2CPositionEncoder::calibrate_steps_mm(const uint8_t iter) {
413 411
     //do_blocking_move_to(endCoord[X_AXIS],endCoord[Y_AXIS],endCoord[Z_AXIS]);
414 412
 
415 413
     planner.buffer_line(endCoord[X_AXIS], endCoord[Y_AXIS], endCoord[Z_AXIS],
416
-                        planner.get_axis_position_mm(E_AXIS), feedrate, 0);
414
+                        planner.get_axis_position_mm(E_AXIS), fr_mm_s, 0);
417 415
     planner.synchronize();
418 416
 
419 417
     //Read encoder distance

+ 5
- 5
Marlin/src/feature/bedlevel/abl/abl.cpp ファイルの表示

@@ -360,7 +360,7 @@ float bilinear_z_offset(const float raw[XYZ]) {
360 360
    * Prepare a bilinear-leveled linear move on Cartesian,
361 361
    * splitting the move where it crosses grid borders.
362 362
    */
363
-  void bilinear_line_to_destination(const float fr_mm_s, uint16_t x_splits, uint16_t y_splits) {
363
+  void bilinear_line_to_destination(const feedRate_t scaled_fr_mm_s, uint16_t x_splits, uint16_t y_splits) {
364 364
     // Get current and destination cells for this line
365 365
     int cx1 = CELL_INDEX(X, current_position[X_AXIS]),
366 366
         cy1 = CELL_INDEX(Y, current_position[Y_AXIS]),
@@ -373,8 +373,8 @@ float bilinear_z_offset(const float raw[XYZ]) {
373 373
 
374 374
     // Start and end in the same cell? No split needed.
375 375
     if (cx1 == cx2 && cy1 == cy2) {
376
-      buffer_line_to_destination(fr_mm_s);
377 376
       set_current_from_destination();
377
+      line_to_current_position(scaled_fr_mm_s);
378 378
       return;
379 379
     }
380 380
 
@@ -405,8 +405,8 @@ float bilinear_z_offset(const float raw[XYZ]) {
405 405
     else {
406 406
       // Must already have been split on these border(s)
407 407
       // This should be a rare case.
408
-      buffer_line_to_destination(fr_mm_s);
409 408
       set_current_from_destination();
409
+      line_to_current_position(scaled_fr_mm_s);
410 410
       return;
411 411
     }
412 412
 
@@ -414,11 +414,11 @@ float bilinear_z_offset(const float raw[XYZ]) {
414 414
     destination[E_AXIS] = LINE_SEGMENT_END(E);
415 415
 
416 416
     // Do the split and look for more borders
417
-    bilinear_line_to_destination(fr_mm_s, x_splits, y_splits);
417
+    bilinear_line_to_destination(scaled_fr_mm_s, x_splits, y_splits);
418 418
 
419 419
     // Restore destination from stack
420 420
     COPY(destination, end);
421
-    bilinear_line_to_destination(fr_mm_s, x_splits, y_splits);
421
+    bilinear_line_to_destination(scaled_fr_mm_s, x_splits, y_splits);
422 422
   }
423 423
 
424 424
 #endif // IS_CARTESIAN && !SEGMENT_LEVELED_MOVES

+ 1
- 1
Marlin/src/feature/bedlevel/abl/abl.h ファイルの表示

@@ -37,7 +37,7 @@ void refresh_bed_level();
37 37
 #endif
38 38
 
39 39
 #if IS_CARTESIAN && DISABLED(SEGMENT_LEVELED_MOVES)
40
-  void bilinear_line_to_destination(const float fr_mm_s, uint16_t x_splits=0xFFFF, uint16_t y_splits=0xFFFF);
40
+  void bilinear_line_to_destination(const feedRate_t &scaled_fr_mm_s, uint16_t x_splits=0xFFFF, uint16_t y_splits=0xFFFF);
41 41
 #endif
42 42
 
43 43
 #define _GET_MESH_X(I) (bilinear_start[X_AXIS] + (I) * bilinear_grid_spacing[X_AXIS])

+ 5
- 5
Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp ファイルの表示

@@ -64,7 +64,7 @@
64 64
      * Prepare a mesh-leveled linear move in a Cartesian setup,
65 65
      * splitting the move where it crosses mesh borders.
66 66
      */
67
-    void mesh_bed_leveling::line_to_destination(const float fr_mm_s, uint8_t x_splits, uint8_t y_splits) {
67
+    void mesh_bed_leveling::line_to_destination(const feedRate_t &scaled_fr_mm_s, uint8_t x_splits, uint8_t y_splits) {
68 68
       // Get current and destination cells for this line
69 69
       int cx1 = cell_index_x(current_position[X_AXIS]),
70 70
           cy1 = cell_index_y(current_position[Y_AXIS]),
@@ -77,7 +77,7 @@
77 77
 
78 78
       // Start and end in the same cell? No split needed.
79 79
       if (cx1 == cx2 && cy1 == cy2) {
80
-        line_to_destination(fr_mm_s);
80
+        line_to_destination(scaled_fr_mm_s);
81 81
         set_current_from_destination();
82 82
         return;
83 83
       }
@@ -109,7 +109,7 @@
109 109
       else {
110 110
         // Must already have been split on these border(s)
111 111
         // This should be a rare case.
112
-        line_to_destination(fr_mm_s);
112
+        line_to_destination(scaled_fr_mm_s);
113 113
         set_current_from_destination();
114 114
         return;
115 115
       }
@@ -118,11 +118,11 @@
118 118
       destination[E_AXIS] = MBL_SEGMENT_END(E);
119 119
 
120 120
       // Do the split and look for more borders
121
-      line_to_destination(fr_mm_s, x_splits, y_splits);
121
+      line_to_destination(scaled_fr_mm_s, x_splits, y_splits);
122 122
 
123 123
       // Restore destination from stack
124 124
       COPY(destination, end);
125
-      line_to_destination(fr_mm_s, x_splits, y_splits);
125
+      line_to_destination(scaled_fr_mm_s, x_splits, y_splits);
126 126
     }
127 127
 
128 128
   #endif // IS_CARTESIAN && !SEGMENT_LEVELED_MOVES

+ 1
- 1
Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h ファイルの表示

@@ -116,7 +116,7 @@ public:
116 116
   }
117 117
 
118 118
   #if IS_CARTESIAN && DISABLED(SEGMENT_LEVELED_MOVES)
119
-    static void line_to_destination(const float fr_mm_s, uint8_t x_splits=0xFF, uint8_t y_splits=0xFF);
119
+    static void line_to_destination(const feedRate_t &scaled_fr_mm_s, uint8_t x_splits=0xFF, uint8_t y_splits=0xFF);
120 120
   #endif
121 121
 };
122 122
 

+ 2
- 2
Marlin/src/feature/bedlevel/ubl/ubl.h ファイルの表示

@@ -285,9 +285,9 @@ class unified_bed_leveling {
285 285
     }
286 286
 
287 287
     #if UBL_SEGMENTED
288
-      static bool prepare_segmented_line_to(const float (&rtarget)[XYZE], const float &feedrate);
288
+      static bool line_to_destination_segmented(const feedRate_t &scaled_fr_mm_s);
289 289
     #else
290
-      static void line_to_destination_cartesian(const float &fr, const uint8_t e);
290
+      static void line_to_destination_cartesian(const feedRate_t &scaled_fr_mm_s, const uint8_t e);
291 291
     #endif
292 292
 
293 293
     static inline bool mesh_is_valid() {

+ 25
- 28
Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp ファイルの表示

@@ -43,7 +43,7 @@
43 43
 
44 44
 #if !UBL_SEGMENTED
45 45
 
46
-  void unified_bed_leveling::line_to_destination_cartesian(const float &feed_rate, const uint8_t extruder) {
46
+  void unified_bed_leveling::line_to_destination_cartesian(const feedRate_t &scaled_fr_mm_s, const uint8_t extruder) {
47 47
     /**
48 48
      * Much of the nozzle movement will be within the same cell. So we will do as little computation
49 49
      * as possible to determine if this is the case. If this move is within the same cell, we will
@@ -79,9 +79,8 @@
79 79
             + UBL_Z_RAISE_WHEN_OFF_MESH
80 80
           #endif
81 81
         ;
82
-        planner.buffer_segment(end[X_AXIS], end[Y_AXIS], end[Z_AXIS] + z_raise, end[E_AXIS], feed_rate, extruder);
82
+        planner.buffer_segment(end[X_AXIS], end[Y_AXIS], end[Z_AXIS] + z_raise, end[E_AXIS], scaled_fr_mm_s, extruder);
83 83
         set_current_from_destination();
84
-
85 84
         return;
86 85
       }
87 86
 
@@ -103,8 +102,7 @@
103 102
 
104 103
       // Undefined parts of the Mesh in z_values[][] are NAN.
105 104
       // Replace NAN corrections with 0.0 to prevent NAN propagation.
106
-      planner.buffer_segment(end[X_AXIS], end[Y_AXIS], end[Z_AXIS] + (isnan(z0) ? 0.0 : z0), end[E_AXIS], feed_rate, extruder);
107
-
105
+      planner.buffer_segment(end[X_AXIS], end[Y_AXIS], end[Z_AXIS] + (isnan(z0) ? 0.0 : z0), end[E_AXIS], scaled_fr_mm_s, extruder);
108 106
       set_current_from_destination();
109 107
       return;
110 108
     }
@@ -194,7 +192,7 @@
194 192
             z_position = end[Z_AXIS];
195 193
           }
196 194
 
197
-          planner.buffer_segment(rx, ry, z_position + z0, e_position, feed_rate, extruder);
195
+          planner.buffer_segment(rx, ry, z_position + z0, e_position, scaled_fr_mm_s, extruder);
198 196
         } //else printf("FIRST MOVE PRUNED  ");
199 197
       }
200 198
 
@@ -242,7 +240,7 @@
242 240
             z_position = end[Z_AXIS];
243 241
           }
244 242
 
245
-          if (!planner.buffer_segment(rx, ry, z_position + z0, e_position, feed_rate, extruder))
243
+          if (!planner.buffer_segment(rx, ry, z_position + z0, e_position, scaled_fr_mm_s, extruder))
246 244
             break;
247 245
         } //else printf("FIRST MOVE PRUNED  ");
248 246
       }
@@ -297,7 +295,7 @@
297 295
           e_position = end[E_AXIS];
298 296
           z_position = end[Z_AXIS];
299 297
         }
300
-        if (!planner.buffer_segment(rx, next_mesh_line_y, z_position + z0, e_position, feed_rate, extruder))
298
+        if (!planner.buffer_segment(rx, next_mesh_line_y, z_position + z0, e_position, scaled_fr_mm_s, extruder))
301 299
           break;
302 300
         current_yi += dyi;
303 301
         yi_cnt--;
@@ -321,7 +319,7 @@
321 319
           z_position = end[Z_AXIS];
322 320
         }
323 321
 
324
-        if (!planner.buffer_segment(next_mesh_line_x, ry, z_position + z0, e_position, feed_rate, extruder))
322
+        if (!planner.buffer_segment(next_mesh_line_x, ry, z_position + z0, e_position, scaled_fr_mm_s, extruder))
325 323
           break;
326 324
         current_xi += dxi;
327 325
         xi_cnt--;
@@ -356,25 +354,25 @@
356 354
    * Returns true if did NOT move, false if moved (requires current_position update).
357 355
    */
358 356
 
359
-  bool _O2 unified_bed_leveling::prepare_segmented_line_to(const float (&rtarget)[XYZE], const float &feedrate) {
357
+  bool _O2 unified_bed_leveling::line_to_destination_segmented(const feedRate_t &scaled_fr_mm_s) {
360 358
 
361
-    if (!position_is_reachable(rtarget[X_AXIS], rtarget[Y_AXIS]))  // fail if moving outside reachable boundary
359
+    if (!position_is_reachable(destination[X_AXIS], destination[Y_AXIS]))  // fail if moving outside reachable boundary
362 360
       return true; // did not move, so current_position still accurate
363 361
 
364 362
     const float total[XYZE] = {
365
-      rtarget[X_AXIS] - current_position[X_AXIS],
366
-      rtarget[Y_AXIS] - current_position[Y_AXIS],
367
-      rtarget[Z_AXIS] - current_position[Z_AXIS],
368
-      rtarget[E_AXIS] - current_position[E_AXIS]
363
+      destination[X_AXIS] - current_position[X_AXIS],
364
+      destination[Y_AXIS] - current_position[Y_AXIS],
365
+      destination[Z_AXIS] - current_position[Z_AXIS],
366
+      destination[E_AXIS] - current_position[E_AXIS]
369 367
     };
370 368
 
371 369
     const float cartesian_xy_mm = HYPOT(total[X_AXIS], total[Y_AXIS]);  // total horizontal xy distance
372 370
 
373 371
     #if IS_KINEMATIC
374
-      const float seconds = cartesian_xy_mm / feedrate;                                  // seconds to move xy distance at requested rate
375
-      uint16_t segments = LROUND(delta_segments_per_second * seconds),                  // preferred number of segments for distance @ feedrate
376
-               seglimit = LROUND(cartesian_xy_mm * RECIPROCAL(DELTA_SEGMENT_MIN_LENGTH)); // number of segments at minimum segment length
377
-      NOMORE(segments, seglimit);                                                        // limit to minimum segment length (fewer segments)
372
+      const float seconds = cartesian_xy_mm / scaled_fr_mm_s;                             // Duration of XY move at requested rate
373
+      uint16_t segments = LROUND(delta_segments_per_second * seconds),                    // Preferred number of segments for distance @ feedrate
374
+               seglimit = LROUND(cartesian_xy_mm * RECIPROCAL(DELTA_SEGMENT_MIN_LENGTH)); // Number of segments at minimum segment length
375
+      NOMORE(segments, seglimit);                                                         // Limit to minimum segment length (fewer segments)
378 376
     #else
379 377
       uint16_t segments = LROUND(cartesian_xy_mm * RECIPROCAL(DELTA_SEGMENT_MIN_LENGTH)); // cartesian fixed segment length
380 378
     #endif
@@ -384,7 +382,7 @@
384 382
 
385 383
     const float segment_xyz_mm = HYPOT(cartesian_xy_mm, total[Z_AXIS]) * inv_segments;   // length of each segment
386 384
     #if ENABLED(SCARA_FEEDRATE_SCALING)
387
-      const float inv_duration = feedrate / segment_xyz_mm;
385
+      const float inv_duration = scaled_fr_mm_s / segment_xyz_mm;
388 386
     #endif
389 387
 
390 388
     const float diff[XYZE] = {
@@ -404,17 +402,17 @@
404 402
       current_position[E_AXIS]
405 403
     };
406 404
 
407
-    // Only compute leveling per segment if ubl active and target below z_fade_height.
408
-    if (!planner.leveling_active || !planner.leveling_active_at_z(rtarget[Z_AXIS])) {   // no mesh leveling
405
+    // Just do plain segmentation if UBL is inactive or the target is above the fade height
406
+    if (!planner.leveling_active || !planner.leveling_active_at_z(destination[Z_AXIS])) {
409 407
       while (--segments) {
410 408
         LOOP_XYZE(i) raw[i] += diff[i];
411
-        planner.buffer_line(raw, feedrate, active_extruder, segment_xyz_mm
409
+        planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, segment_xyz_mm
412 410
           #if ENABLED(SCARA_FEEDRATE_SCALING)
413 411
             , inv_duration
414 412
           #endif
415 413
         );
416 414
       }
417
-      planner.buffer_line(rtarget, feedrate, active_extruder, segment_xyz_mm
415
+      planner.buffer_line(destination, scaled_fr_mm_s, active_extruder, segment_xyz_mm
418 416
         #if ENABLED(SCARA_FEEDRATE_SCALING)
419 417
           , inv_duration
420 418
         #endif
@@ -425,7 +423,7 @@
425 423
     // Otherwise perform per-segment leveling
426 424
 
427 425
     #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
428
-      const float fade_scaling_factor = planner.fade_scaling_factor_for_z(rtarget[Z_AXIS]);
426
+      const float fade_scaling_factor = planner.fade_scaling_factor_for_z(destination[Z_AXIS]);
429 427
     #endif
430 428
 
431 429
     // increment to first segment destination
@@ -483,8 +481,7 @@
483 481
 
484 482
       for (;;) {  // for all segments within this mesh cell
485 483
 
486
-        if (--segments == 0)                      // if this is last segment, use rtarget for exact
487
-          COPY(raw, rtarget);
484
+        if (--segments == 0) COPY(raw, destination); // if this is last segment, use destination for exact
488 485
 
489 486
         const float z_cxcy = (z_cxy0 + z_cxym * cy) // interpolated mesh z height along cx at cy
490 487
           #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
@@ -494,7 +491,7 @@
494 491
 
495 492
         const float z = raw[Z_AXIS];
496 493
         raw[Z_AXIS] += z_cxcy;
497
-        planner.buffer_line(raw, feedrate, active_extruder, segment_xyz_mm
494
+        planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, segment_xyz_mm
498 495
           #if ENABLED(SCARA_FEEDRATE_SCALING)
499 496
             , inv_duration
500 497
           #endif

+ 18
- 21
Marlin/src/feature/fwretract.cpp ファイルの表示

@@ -128,10 +128,7 @@ void FWRetract::retract(const bool retracting
128 128
     SERIAL_ECHOLNPAIR("current_hop ", current_hop);
129 129
   //*/
130 130
 
131
-  const float old_feedrate_mm_s = feedrate_mm_s,
132
-              unscale_e = RECIPROCAL(planner.e_factor[active_extruder]),
133
-              unscale_fr = 100.0 / feedrate_percentage, // Disable feedrate scaling for retract moves
134
-              base_retract = (
131
+  const float base_retract = (
135 132
                 (swapping ? settings.swap_retract_length : settings.retract_length)
136 133
                 #if ENABLED(RETRACT_SYNC_MIXING)
137 134
                   * (MIXING_STEPPERS)
@@ -146,53 +143,53 @@ void FWRetract::retract(const bool retracting
146 143
     mixer.T(MIXER_AUTORETRACT_TOOL);
147 144
   #endif
148 145
 
146
+  const feedRate_t fr_max_z = planner.settings.max_feedrate_mm_s[Z_AXIS];
149 147
   if (retracting) {
150 148
     // Retract by moving from a faux E position back to the current E position
151
-    feedrate_mm_s = (
152
-      settings.retract_feedrate_mm_s * unscale_fr
149
+    current_retract[active_extruder] = base_retract;
150
+    prepare_internal_move_to_destination(  // set_current_to_destination
151
+      settings.retract_feedrate_mm_s
153 152
       #if ENABLED(RETRACT_SYNC_MIXING)
154 153
         * (MIXING_STEPPERS)
155 154
       #endif
156 155
     );
157
-    current_retract[active_extruder] = base_retract * unscale_e;
158
-    prepare_move_to_destination();                        // set_current_to_destination
159 156
 
160 157
     // Is a Z hop set, and has the hop not yet been done?
161
-    if (settings.retract_zraise > 0.01 && !current_hop) {           // Apply hop only once
162
-      current_hop += settings.retract_zraise;                       // Add to the hop total (again, only once)
163
-      feedrate_mm_s = planner.settings.max_feedrate_mm_s[Z_AXIS] * unscale_fr;  // Maximum Z feedrate
164
-      prepare_move_to_destination();                      // Raise up, set_current_to_destination
158
+    if (!current_hop && settings.retract_zraise > 0.01f) {  // Apply hop only once
159
+      current_hop += settings.retract_zraise;               // Add to the hop total (again, only once)
160
+      // Raise up, set_current_to_destination. Maximum Z feedrate
161
+      prepare_internal_move_to_destination(fr_max_z);
165 162
     }
166 163
   }
167 164
   else {
168 165
     // If a hop was done and Z hasn't changed, undo the Z hop
169 166
     if (current_hop) {
170
-      current_hop = 0.0;
171
-      feedrate_mm_s = planner.settings.max_feedrate_mm_s[Z_AXIS] * unscale_fr;  // Z feedrate to max
172
-      prepare_move_to_destination();                      // Lower Z, set_current_to_destination
167
+      current_hop = 0;
168
+      // Lower Z, set_current_to_destination. Maximum Z feedrate
169
+      prepare_internal_move_to_destination(fr_max_z);
173 170
     }
174 171
 
175 172
     const float extra_recover = swapping ? settings.swap_retract_recover_extra : settings.retract_recover_extra;
176
-    if (extra_recover != 0.0) {
173
+    if (extra_recover) {
177 174
       current_position[E_AXIS] -= extra_recover;          // Adjust the current E position by the extra amount to recover
178 175
       sync_plan_position_e();                             // Sync the planner position so the extra amount is recovered
179 176
     }
180 177
 
181
-    current_retract[active_extruder] = 0.0;
182
-    feedrate_mm_s = (
183
-      (swapping ? settings.swap_retract_recover_feedrate_mm_s : settings.retract_recover_feedrate_mm_s) * unscale_fr
178
+    current_retract[active_extruder] = 0;
179
+
180
+    const feedRate_t fr_mm_s = (
181
+      (swapping ? settings.swap_retract_recover_feedrate_mm_s : settings.retract_recover_feedrate_mm_s)
184 182
       #if ENABLED(RETRACT_SYNC_MIXING)
185 183
         * (MIXING_STEPPERS)
186 184
       #endif
187 185
     );
188
-    prepare_move_to_destination();                        // Recover E, set_current_to_destination
186
+    prepare_internal_move_to_destination(fr_mm_s);        // Recover E, set_current_to_destination
189 187
   }
190 188
 
191 189
   #if ENABLED(RETRACT_SYNC_MIXING)
192 190
     mixer.T(old_mixing_tool);                             // Restore original mixing tool
193 191
   #endif
194 192
 
195
-  feedrate_mm_s = old_feedrate_mm_s;                      // Restore original feedrate
196 193
   retracted[active_extruder] = retracting;                // Active extruder now retracted / recovered
197 194
 
198 195
   // If swap retract/recover update the retracted_swap flag too

+ 8
- 8
Marlin/src/feature/fwretract.h ファイルの表示

@@ -28,14 +28,14 @@
28 28
 #include "../inc/MarlinConfigPre.h"
29 29
 
30 30
 typedef struct {
31
-  float retract_length,                     // M207 S - G10 Retract length
32
-        retract_feedrate_mm_s,              // M207 F - G10 Retract feedrate
33
-        retract_zraise,                     // M207 Z - G10 Retract hop size
34
-        retract_recover_extra,              // M208 S - G11 Recover length
35
-        retract_recover_feedrate_mm_s,      // M208 F - G11 Recover feedrate
36
-        swap_retract_length,                // M207 W - G10 Swap Retract length
37
-        swap_retract_recover_extra,         // M208 W - G11 Swap Recover length
38
-        swap_retract_recover_feedrate_mm_s; // M208 R - G11 Swap Recover feedrate
31
+       float retract_length;                      // M207 S - G10 Retract length
32
+  feedRate_t retract_feedrate_mm_s;               // M207 F - G10 Retract feedrate
33
+       float retract_zraise,                      // M207 Z - G10 Retract hop size
34
+             retract_recover_extra;               // M208 S - G11 Recover length
35
+  feedRate_t retract_recover_feedrate_mm_s;       // M208 F - G11 Recover feedrate
36
+       float swap_retract_length,                 // M207 W - G10 Swap Retract length
37
+             swap_retract_recover_extra;          // M208 W - G11 Swap Recover length
38
+  feedRate_t swap_retract_recover_feedrate_mm_s;  // M208 R - G11 Swap Recover feedrate
39 39
 } fwretract_settings_t;
40 40
 
41 41
 #if ENABLED(FWRETRACT)

+ 5
- 5
Marlin/src/feature/pause.cpp ファイルの表示

@@ -122,7 +122,7 @@ static bool ensure_safe_temperature(const PauseMode mode=PAUSE_MODE_SAME) {
122 122
   return thermalManager.wait_for_hotend(active_extruder);
123 123
 }
124 124
 
125
-void do_pause_e_move(const float &length, const float &fr_mm_s) {
125
+void do_pause_e_move(const float &length, const feedRate_t &fr_mm_s) {
126 126
   #if HAS_FILAMENT_SENSOR
127 127
     runout.reset();
128 128
   #endif
@@ -648,16 +648,16 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
648 648
   #endif
649 649
 
650 650
   // If resume_position is negative
651
-  if (resume_position[E_AXIS] < 0) do_pause_e_move(resume_position[E_AXIS], PAUSE_PARK_RETRACT_FEEDRATE);
651
+  if (resume_position[E_AXIS] < 0) do_pause_e_move(resume_position[E_AXIS], feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));
652 652
 
653 653
   // Move XY to starting position, then Z
654
-  do_blocking_move_to_xy(resume_position[X_AXIS], resume_position[Y_AXIS], NOZZLE_PARK_XY_FEEDRATE);
654
+  do_blocking_move_to_xy(resume_position[X_AXIS], resume_position[Y_AXIS], feedRate_t(NOZZLE_PARK_XY_FEEDRATE));
655 655
 
656 656
   // Move Z_AXIS to saved position
657
-  do_blocking_move_to_z(resume_position[Z_AXIS], NOZZLE_PARK_Z_FEEDRATE);
657
+  do_blocking_move_to_z(resume_position[Z_AXIS], feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
658 658
 
659 659
   #if ADVANCED_PAUSE_RESUME_PRIME != 0
660
-    do_pause_e_move(ADVANCED_PAUSE_RESUME_PRIME, ADVANCED_PAUSE_PURGE_FEEDRATE);
660
+    do_pause_e_move(ADVANCED_PAUSE_RESUME_PRIME, feedRate_t(ADVANCED_PAUSE_PURGE_FEEDRATE));
661 661
   #endif
662 662
 
663 663
   // Now all extrusion positions are resumed and ready to be confirmed

+ 1
- 1
Marlin/src/feature/pause.h ファイルの表示

@@ -81,7 +81,7 @@ extern uint8_t did_pause_print;
81 81
   #define DXC_PASS
82 82
 #endif
83 83
 
84
-void do_pause_e_move(const float &length, const float &fr_mm_s);
84
+void do_pause_e_move(const float &length, const feedRate_t &fr_mm_s);
85 85
 
86 86
 bool pause_print(const float &retract, const point_t &park_point, const float &unload_length=0, const bool show_lcd=false DXC_PARAMS);
87 87
 

+ 8
- 9
Marlin/src/feature/prusa_MMU2/mmu2.cpp ファイルの表示

@@ -102,8 +102,8 @@ char MMU2::rx_buffer[16], MMU2::tx_buffer[16];
102 102
 #if HAS_LCD_MENU && ENABLED(MMU2_MENUS)
103 103
 
104 104
   struct E_Step {
105
-    float extrude;    //!< extrude distance in mm
106
-    float feedRate;   //!< feed rate in mm/s
105
+    float extrude;        //!< extrude distance in mm
106
+    feedRate_t feedRate;  //!< feed rate in mm/s
107 107
   };
108 108
 
109 109
   static constexpr E_Step ramming_sequence[] PROGMEM = { MMU2_RAMMING_SEQUENCE };
@@ -606,10 +606,10 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
606 606
         BUZZ(200, 404);
607 607
 
608 608
         // Move XY to starting position, then Z
609
-        do_blocking_move_to_xy(resume_position[X_AXIS], resume_position[Y_AXIS], NOZZLE_PARK_XY_FEEDRATE);
609
+        do_blocking_move_to_xy(resume_position[X_AXIS], resume_position[Y_AXIS], feedRate_t(NOZZLE_PARK_XY_FEEDRATE));
610 610
 
611 611
         // Move Z_AXIS to saved position
612
-        do_blocking_move_to_z(resume_position[Z_AXIS], NOZZLE_PARK_Z_FEEDRATE);
612
+        do_blocking_move_to_z(resume_position[Z_AXIS], feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
613 613
       }
614 614
       else {
615 615
         BUZZ(200, 404);
@@ -783,15 +783,14 @@ void MMU2::filament_runout() {
783 783
     const E_Step* step = sequence;
784 784
 
785 785
     for (uint8_t i = 0; i < steps; i++) {
786
-      const float es = pgm_read_float(&(step->extrude)),
787
-                  fr = pgm_read_float(&(step->feedRate));
786
+      const float es = pgm_read_float(&(step->extrude));
787
+      const feedRate_t fr_mm_m = pgm_read_float(&(step->feedRate));
788 788
 
789 789
       DEBUG_ECHO_START();
790
-      DEBUG_ECHOLNPAIR("E step ", es, "/", fr);
790
+      DEBUG_ECHOLNPAIR("E step ", es, "/", fr_mm_m);
791 791
 
792 792
       current_position[E_AXIS] += es;
793
-      planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS],
794
-                          current_position[E_AXIS], MMM_TO_MMS(fr), active_extruder);
793
+      line_to_current_position(MMM_TO_MMS(fr_mm_m));
795 794
       planner.synchronize();
796 795
 
797 796
       step++;

+ 12
- 19
Marlin/src/gcode/bedlevel/G26.cpp ファイルの表示

@@ -216,41 +216,32 @@ mesh_index_pair find_closest_circle_to_print(const float &X, const float &Y) {
216 216
   return return_val;
217 217
 }
218 218
 
219
-void G26_line_to_destination(const float &feed_rate) {
220
-  const float save_feedrate = feedrate_mm_s;
221
-  feedrate_mm_s = feed_rate;
222
-  prepare_move_to_destination();  // will ultimately call ubl.line_to_destination_cartesian or ubl.prepare_linear_move_to for UBL_SEGMENTED
223
-  feedrate_mm_s = save_feedrate;
224
-}
225
-
226 219
 void move_to(const float &rx, const float &ry, const float &z, const float &e_delta) {
227
-  float feed_value;
228 220
   static float last_z = -999.99;
229 221
 
230 222
   bool has_xy_component = (rx != current_position[X_AXIS] || ry != current_position[Y_AXIS]); // Check if X or Y is involved in the movement.
231 223
 
232 224
   if (z != last_z) {
233 225
     last_z = z;
234
-    feed_value = planner.settings.max_feedrate_mm_s[Z_AXIS]/(2.0);  // Base the feed rate off of the configured Z_AXIS feed rate
226
+    const feedRate_t feed_value = planner.settings.max_feedrate_mm_s[Z_AXIS] * 0.5f; // Use half of the Z_AXIS max feed rate
235 227
 
236 228
     destination[X_AXIS] = current_position[X_AXIS];
237 229
     destination[Y_AXIS] = current_position[Y_AXIS];
238 230
     destination[Z_AXIS] = z;                          // We know the last_z!=z or we wouldn't be in this block of code.
239 231
     destination[E_AXIS] = current_position[E_AXIS];
240 232
 
241
-    G26_line_to_destination(feed_value);
233
+    prepare_internal_move_to_destination(feed_value);
242 234
     set_destination_from_current();
243 235
   }
244 236
 
245
-  // Check if X or Y is involved in the movement.
246
-  // Yes: a 'normal' movement. No: a retract() or recover()
247
-  feed_value = has_xy_component ? G26_XY_FEEDRATE : planner.settings.max_feedrate_mm_s[E_AXIS] / 1.5;
237
+  // If X or Y is involved do a 'normal' move. Otherwise retract/recover/hop.
238
+  const feedRate_t feed_value = has_xy_component ? feedRate_t(G26_XY_FEEDRATE) : planner.settings.max_feedrate_mm_s[E_AXIS] * 0.666f;
248 239
 
249 240
   destination[X_AXIS] = rx;
250 241
   destination[Y_AXIS] = ry;
251 242
   destination[E_AXIS] += e_delta;
252 243
 
253
-  G26_line_to_destination(feed_value);
244
+  prepare_internal_move_to_destination(feed_value);
254 245
   set_destination_from_current();
255 246
 }
256 247
 
@@ -433,6 +424,7 @@ inline bool turn_on_heaters() {
433 424
  */
434 425
 inline bool prime_nozzle() {
435 426
 
427
+  const feedRate_t fr_slow_e = planner.settings.max_feedrate_mm_s[E_AXIS] / 15.0f;
436 428
   #if HAS_LCD_MENU
437 429
     #if ENABLED(PREVENT_LENGTHY_EXTRUDE)
438 430
       float Total_Prime = 0.0;
@@ -455,7 +447,7 @@ inline bool prime_nozzle() {
455 447
           Total_Prime += 0.25;
456 448
           if (Total_Prime >= EXTRUDE_MAXLENGTH) return G26_ERR;
457 449
         #endif
458
-        G26_line_to_destination(planner.settings.max_feedrate_mm_s[E_AXIS] / 15.0);
450
+        prepare_internal_move_to_destination(fr_slow_e);
459 451
         set_destination_from_current();
460 452
         planner.synchronize();    // Without this synchronize, the purge is more consistent,
461 453
                                   // but because the planner has a buffer, we won't be able
@@ -478,7 +470,7 @@ inline bool prime_nozzle() {
478 470
     #endif
479 471
     set_destination_from_current();
480 472
     destination[E_AXIS] += g26_prime_length;
481
-    G26_line_to_destination(planner.settings.max_feedrate_mm_s[E_AXIS] / 15.0);
473
+    prepare_internal_move_to_destination(fr_slow_e);
482 474
     set_destination_from_current();
483 475
     retract_filament(destination);
484 476
   }
@@ -781,12 +773,13 @@ void GcodeSuite::G26() {
781 773
         move_to(sx, sy, g26_layer_height, 0.0); // Get to the starting point with no extrusion / un-Z bump
782 774
 
783 775
         recover_filament(destination);
784
-        const float save_feedrate = feedrate_mm_s;
785
-        feedrate_mm_s = PLANNER_XY_FEEDRATE() / 10.0;
786 776
 
777
+        const feedRate_t old_feedrate = feedrate_mm_s;
778
+        feedrate_mm_s = PLANNER_XY_FEEDRATE() * 0.1f;
787 779
         plan_arc(endpoint, arc_offset, false);  // Draw a counter-clockwise arc
788
-        feedrate_mm_s = save_feedrate;
780
+        feedrate_mm_s = old_feedrate;
789 781
         set_destination_from_current();
782
+
790 783
         #if HAS_LCD_MENU
791 784
           if (user_canceled()) goto LEAVE; // Check if the user wants to stop the Mesh Validation
792 785
         #endif

+ 6
- 4
Marlin/src/gcode/bedlevel/G42.cpp ファイルの表示

@@ -45,8 +45,10 @@ void GcodeSuite::G42() {
45 45
     }
46 46
 
47 47
     set_destination_from_current();
48
+
48 49
     if (hasI) destination[X_AXIS] = _GET_MESH_X(ix);
49 50
     if (hasJ) destination[Y_AXIS] = _GET_MESH_Y(iy);
51
+
50 52
     #if HAS_BED_PROBE
51 53
       if (parser.boolval('P')) {
52 54
         if (hasI) destination[X_AXIS] -= probe_offset[X_AXIS];
@@ -54,14 +56,14 @@ void GcodeSuite::G42() {
54 56
       }
55 57
     #endif
56 58
 
57
-    const float fval = parser.linearval('F');
58
-    if (fval > 0.0) feedrate_mm_s = MMM_TO_MMS(fval);
59
+    const feedRate_t fval = parser.linearval('F'),
60
+                     fr_mm_s = fval > 0 ? MMM_TO_MMS(fval) : 0.0f;
59 61
 
60 62
     // SCARA kinematic has "safe" XY raw moves
61 63
     #if IS_SCARA
62
-      prepare_uninterpolated_move_to_destination();
64
+      prepare_internal_fast_move_to_destination(fr_mm_s);
63 65
     #else
64
-      prepare_move_to_destination();
66
+      prepare_internal_move_to_destination(fr_mm_s);
65 67
     #endif
66 68
   }
67 69
 }

+ 1
- 2
Marlin/src/gcode/bedlevel/mbl/G29.cpp ファイルの表示

@@ -143,8 +143,7 @@ void GcodeSuite::G29() {
143 143
 
144 144
         #if ENABLED(MESH_G28_REST_ORIGIN)
145 145
           current_position[Z_AXIS] = 0;
146
-          set_destination_from_current();
147
-          buffer_line_to_destination(homing_feedrate(Z_AXIS));
146
+          line_to_current_position(homing_feedrate(Z_AXIS));
148 147
           planner.synchronize();
149 148
         #endif
150 149
 

+ 4
- 5
Marlin/src/gcode/calibrate/G425.cpp ファイルの表示

@@ -171,17 +171,16 @@ inline bool read_calibration_pin() {
171 171
  *   fast         in - Fast vs. precise measurement
172 172
  */
173 173
 float measuring_movement(const AxisEnum axis, const int dir, const bool stop_state, const bool fast) {
174
-  const float step  =            fast ? 0.25                      : CALIBRATION_MEASUREMENT_RESOLUTION;
175
-  const float mms   = MMM_TO_MMS(fast ? CALIBRATION_FEEDRATE_FAST : CALIBRATION_FEEDRATE_SLOW);
176
-  const float limit =            fast ? 50                        : 5;
174
+  const float step     = fast ? 0.25 : CALIBRATION_MEASUREMENT_RESOLUTION;
175
+  const feedRate_t mms = fast ? MMM_TO_MMS(CALIBRATION_FEEDRATE_FAST) : MMM_TO_MMS(CALIBRATION_FEEDRATE_SLOW);
176
+  const float limit    = fast ? 50 : 5;
177 177
 
178 178
   set_destination_from_current();
179 179
   for (float travel = 0; travel < limit; travel += step) {
180 180
     destination[axis] += dir * step;
181 181
     do_blocking_move_to(destination, mms);
182 182
     planner.synchronize();
183
-    if (read_calibration_pin() == stop_state)
184
-      break;
183
+    if (read_calibration_pin() == stop_state) break;
185 184
   }
186 185
   return destination[axis];
187 186
 }

+ 18
- 20
Marlin/src/gcode/feature/L6470/M916-918.cpp ファイルの表示

@@ -32,7 +32,7 @@
32 32
 #define DEBUG_OUT ENABLED(L6470_CHITCHAT)
33 33
 #include "../../../core/debug_out.h"
34 34
 
35
-static void jiggle_axis(const char axis_char, const float &min, const float &max, const float &rate) {
35
+static void jiggle_axis(const char axis_char, const float &min, const float &max, const feedRate_t &fr_mm_m) {
36 36
   char gcode_string[30], str1[11], str2[11];
37 37
 
38 38
   // Turn the motor(s) both directions
@@ -84,7 +84,7 @@ void GcodeSuite::M916() {
84 84
   uint8_t driver_count = 1;
85 85
   float position_max;
86 86
   float position_min;
87
-  float final_feedrate;
87
+  feedRate_t final_fr_mm_m;
88 88
   uint8_t kval_hold;
89 89
   uint8_t ocd_th_val = 0;
90 90
   uint8_t stall_th_val = 0;
@@ -93,10 +93,10 @@ void GcodeSuite::M916() {
93 93
 
94 94
   uint8_t j;   // general purpose counter
95 95
 
96
-  if (L6470.get_user_input(driver_count, axis_index, axis_mon, position_max, position_min, final_feedrate, kval_hold, over_current_flag, ocd_th_val, stall_th_val, over_current_threshold))
96
+  if (L6470.get_user_input(driver_count, axis_index, axis_mon, position_max, position_min, final_fr_mm_m, kval_hold, over_current_flag, ocd_th_val, stall_th_val, over_current_threshold))
97 97
     return;  // quit if invalid user input
98 98
 
99
-  DEBUG_ECHOLNPAIR("feedrate = ", final_feedrate);
99
+  DEBUG_ECHOLNPAIR("feedrate = ", final_fr_mm_m);
100 100
 
101 101
   planner.synchronize();                  // Wait for moves to finish
102 102
 
@@ -115,7 +115,7 @@ void GcodeSuite::M916() {
115 115
       L6470.set_param(axis_index[j], L6470_KVAL_HOLD, kval_hold);
116 116
 
117 117
     // Turn the motor(s) both directions
118
-    jiggle_axis(axis_mon[0][0], position_min, position_max, final_feedrate);
118
+    jiggle_axis(axis_mon[0][0], position_min, position_max, final_fr_mm_m);
119 119
 
120 120
     status_composite = 0;    // clear out the old bits
121 121
 
@@ -190,7 +190,7 @@ void GcodeSuite::M917() {
190 190
   uint8_t driver_count = 1;
191 191
   float position_max;
192 192
   float position_min;
193
-  float final_feedrate;
193
+  feedRate_t final_fr_mm_m;
194 194
   uint8_t kval_hold;
195 195
   uint8_t ocd_th_val = 0;
196 196
   uint8_t stall_th_val = 0;
@@ -199,10 +199,10 @@ void GcodeSuite::M917() {
199 199
 
200 200
   uint8_t j;   // general purpose counter
201 201
 
202
-  if (L6470.get_user_input(driver_count, axis_index, axis_mon, position_max, position_min, final_feedrate, kval_hold, over_current_flag, ocd_th_val, stall_th_val, over_current_threshold))
202
+  if (L6470.get_user_input(driver_count, axis_index, axis_mon, position_max, position_min, final_fr_mm_m, kval_hold, over_current_flag, ocd_th_val, stall_th_val, over_current_threshold))
203 203
     return;  // quit if invalid user input
204 204
 
205
-  DEBUG_ECHOLNPAIR("feedrate = ", final_feedrate);
205
+  DEBUG_ECHOLNPAIR("feedrate = ", final_fr_mm_m);
206 206
 
207 207
   planner.synchronize();                // Wait for moves to finish
208 208
   for (j = 0; j < driver_count; j++)
@@ -225,7 +225,7 @@ void GcodeSuite::M917() {
225 225
     DEBUG_ECHOPAIR("STALL threshold : ", (stall_th_val + 1) * 31.25);
226 226
     DEBUG_ECHOLNPAIR("   OCD threshold : ", (ocd_th_val + 1) * 375);
227 227
 
228
-    jiggle_axis(axis_mon[0][0], position_min, position_max, final_feedrate);
228
+    jiggle_axis(axis_mon[0][0], position_min, position_max, final_fr_mm_m);
229 229
 
230 230
     status_composite = 0;    // clear out the old bits
231 231
 
@@ -452,7 +452,7 @@ void GcodeSuite::M918() {
452 452
   uint16_t axis_status[3];
453 453
   uint8_t driver_count = 1;
454 454
   float position_max, position_min;
455
-  float final_feedrate;
455
+  feedRate_t final_fr_mm_m;
456 456
   uint8_t kval_hold;
457 457
   uint8_t ocd_th_val = 0;
458 458
   uint8_t stall_th_val = 0;
@@ -461,7 +461,7 @@ void GcodeSuite::M918() {
461 461
 
462 462
   uint8_t j;   // general purpose counter
463 463
 
464
-  if (L6470.get_user_input(driver_count, axis_index, axis_mon, position_max, position_min, final_feedrate, kval_hold, over_current_flag, ocd_th_val, stall_th_val, over_current_threshold))
464
+  if (L6470.get_user_input(driver_count, axis_index, axis_mon, position_max, position_min, final_fr_mm_m, kval_hold, over_current_flag, ocd_th_val, stall_th_val, over_current_threshold))
465 465
     return;  // quit if invalid user input
466 466
 
467 467
   uint8_t m_steps = parser.byteval('M');
@@ -489,10 +489,7 @@ void GcodeSuite::M918() {
489 489
   for (j = 0; j < driver_count; j++)
490 490
     L6470.set_param(axis_index[j], L6470_STEP_MODE, m_bits);   // set microsteps
491 491
 
492
-  DEBUG_ECHOLNPAIR("target (maximum) feedrate = ",final_feedrate);
493
-
494
-  float feedrate_inc = final_feedrate / 10, // start at 1/10 of max & go up by 1/10 per step)
495
-        current_feedrate = 0;
492
+  DEBUG_ECHOLNPAIR("target (maximum) feedrate = ", final_fr_mm_m);
496 493
 
497 494
   planner.synchronize();                  // Wait for moves to finish
498 495
 
@@ -502,18 +499,19 @@ void GcodeSuite::M918() {
502 499
   uint16_t status_composite = 0;
503 500
   DEBUG_ECHOLNPGM(".\n.\n.");             // Make the feedrate prints easier to see
504 501
 
505
-  do {
506
-    current_feedrate += feedrate_inc;
507
-    DEBUG_ECHOLNPAIR("...feedrate = ", current_feedrate);
502
+  constexpr uint8_t iterations = 10;
503
+  for (uint8_t i = 1; i <= iterations; i++) {
504
+    const feedRate_t fr_mm_m = i * final_fr_mm_m / iterations;
505
+    DEBUG_ECHOLNPAIR("...feedrate = ", fr_mm_m);
508 506
 
509
-    jiggle_axis(axis_mon[0][0], position_min, position_max, current_feedrate);
507
+    jiggle_axis(axis_mon[0][0], position_min, position_max, fr_mm_m);
510 508
 
511 509
     for (j = 0; j < driver_count; j++) {
512 510
       axis_status[j] = (~L6470.get_status(axis_index[j])) & 0x0800;    // bits of interest are all active low
513 511
       status_composite |= axis_status[j];
514 512
     }
515 513
     if (status_composite) break;       // quit if any errors flags are raised
516
-  } while (current_feedrate < final_feedrate * 0.99);
514
+  }
517 515
 
518 516
   DEBUG_ECHOPGM("Completed with errors");
519 517
   if (status_composite) {

+ 6
- 6
Marlin/src/gcode/feature/camera/M240.cpp ファイルの表示

@@ -43,7 +43,7 @@
43 43
   #endif
44 44
 
45 45
   #ifdef PHOTO_RETRACT_MM
46
-    inline void e_move_m240(const float length, const float fr_mm_s) {
46
+    inline void e_move_m240(const float length, const feedRate_t &fr_mm_s) {
47 47
       if (length && thermalManager.hotEnoughToExtrude(active_extruder)) {
48 48
         #if ENABLED(ADVANCED_PAUSE_FEATURE)
49 49
           do_pause_e_move(length, fr_mm_s);
@@ -104,7 +104,8 @@ void GcodeSuite::M240() {
104 104
     };
105 105
 
106 106
     #ifdef PHOTO_RETRACT_MM
107
-      constexpr float rfr = (MMS_TO_MMM(
107
+      const float rval = parser.seenval('R') ? parser.value_linear_units() : _PHOTO_RETRACT_MM;
108
+      feedRate_t sval = (
108 109
         #if ENABLED(ADVANCED_PAUSE_FEATURE)
109 110
           PAUSE_PARK_RETRACT_FEEDRATE
110 111
         #elif ENABLED(FWRETRACT)
@@ -112,13 +113,12 @@ void GcodeSuite::M240() {
112 113
         #else
113 114
           45
114 115
         #endif
115
-      ));
116
-      const float rval = parser.seenval('R') ? parser.value_linear_units() : _PHOTO_RETRACT_MM,
117
-                  sval = parser.seenval('S') ? MMM_TO_MMS(parser.value_feedrate()) : rfr;
116
+      );
117
+      if (parser.seenval('S')) sval = parser.value_feedrate();
118 118
       e_move_m240(-rval, sval);
119 119
     #endif
120 120
 
121
-    float fr_mm_s = MMM_TO_MMS(parser.linearval('F'));
121
+    feedRate_t fr_mm_s = MMM_TO_MMS(parser.linearval('F'));
122 122
     if (fr_mm_s) NOLESS(fr_mm_s, 10.0f);
123 123
 
124 124
     constexpr float photo_position[XYZ] = PHOTO_POSITION;

+ 4
- 4
Marlin/src/gcode/feature/pause/M701_M702.cpp ファイルの表示

@@ -97,7 +97,7 @@ void GcodeSuite::M701() {
97 97
 
98 98
   // Lift Z axis
99 99
   if (park_point.z > 0)
100
-    do_blocking_move_to_z(_MIN(current_position[Z_AXIS] + park_point.z, Z_MAX_POS), NOZZLE_PARK_Z_FEEDRATE);
100
+    do_blocking_move_to_z(_MIN(current_position[Z_AXIS] + park_point.z, Z_MAX_POS), feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
101 101
 
102 102
   // Load filament
103 103
   #if ENABLED(PRUSA_MMU2)
@@ -116,7 +116,7 @@ void GcodeSuite::M701() {
116 116
 
117 117
   // Restore Z axis
118 118
   if (park_point.z > 0)
119
-    do_blocking_move_to_z(_MAX(current_position[Z_AXIS] - park_point.z, 0), NOZZLE_PARK_Z_FEEDRATE);
119
+    do_blocking_move_to_z(_MAX(current_position[Z_AXIS] - park_point.z, 0), feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
120 120
 
121 121
   #if EXTRUDERS > 1 && DISABLED(PRUSA_MMU2)
122 122
     // Restore toolhead if it was changed
@@ -196,7 +196,7 @@ void GcodeSuite::M702() {
196 196
 
197 197
   // Lift Z axis
198 198
   if (park_point.z > 0)
199
-    do_blocking_move_to_z(_MIN(current_position[Z_AXIS] + park_point.z, Z_MAX_POS), NOZZLE_PARK_Z_FEEDRATE);
199
+    do_blocking_move_to_z(_MIN(current_position[Z_AXIS] + park_point.z, Z_MAX_POS), feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
200 200
 
201 201
   // Unload filament
202 202
   #if ENABLED(PRUSA_MMU2)
@@ -226,7 +226,7 @@ void GcodeSuite::M702() {
226 226
 
227 227
   // Restore Z axis
228 228
   if (park_point.z > 0)
229
-    do_blocking_move_to_z(_MAX(current_position[Z_AXIS] - park_point.z, 0), NOZZLE_PARK_Z_FEEDRATE);
229
+    do_blocking_move_to_z(_MAX(current_position[Z_AXIS] - park_point.z, 0), feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
230 230
 
231 231
   #if EXTRUDERS > 1 && DISABLED(PRUSA_MMU2)
232 232
     // Restore toolhead if it was changed

+ 1
- 1
Marlin/src/gcode/gcode.cpp ファイルの表示

@@ -129,7 +129,7 @@ void GcodeSuite::get_destination_from_command() {
129 129
   #endif
130 130
 
131 131
   if (parser.linearval('F') > 0)
132
-    feedrate_mm_s = MMM_TO_MMS(parser.value_feedrate());
132
+    feedrate_mm_s = parser.value_feedrate();
133 133
 
134 134
   #if ENABLED(PRINTCOUNTER)
135 135
     if (!DEBUGGING(DRYRUN))

+ 1
- 1
Marlin/src/gcode/gcode.h ファイルの表示

@@ -370,7 +370,7 @@ private:
370 370
 
371 371
   static void G0_G1(
372 372
     #if IS_SCARA || defined(G0_FEEDRATE)
373
-      bool fast_move=false
373
+      const bool fast_move=false
374 374
     #endif
375 375
   );
376 376
 

+ 10
- 10
Marlin/src/gcode/motion/G0_G1.cpp ファイルの表示

@@ -38,7 +38,7 @@
38 38
 extern float destination[XYZE];
39 39
 
40 40
 #if ENABLED(VARIABLE_G0_FEEDRATE)
41
-  float saved_g0_feedrate_mm_s = MMM_TO_MMS(G0_FEEDRATE);
41
+  feedRate_t fast_move_feedrate = MMM_TO_MMS(G0_FEEDRATE);
42 42
 #endif
43 43
 
44 44
 /**
@@ -46,7 +46,7 @@ extern float destination[XYZE];
46 46
  */
47 47
 void GcodeSuite::G0_G1(
48 48
   #if IS_SCARA || defined(G0_FEEDRATE)
49
-    bool fast_move/*=false*/
49
+    const bool fast_move/*=false*/
50 50
   #endif
51 51
 ) {
52 52
 
@@ -60,23 +60,23 @@ void GcodeSuite::G0_G1(
60 60
   ) {
61 61
 
62 62
     #ifdef G0_FEEDRATE
63
-      float saved_feedrate_mm_s;
63
+      feedRate_t old_feedrate;
64 64
       #if ENABLED(VARIABLE_G0_FEEDRATE)
65 65
         if (fast_move) {
66
-          saved_feedrate_mm_s = feedrate_mm_s;      // Back up the (old) motion mode feedrate
67
-          feedrate_mm_s = saved_g0_feedrate_mm_s;   // Get G0 feedrate from last usage
66
+          old_feedrate = feedrate_mm_s;             // Back up the (old) motion mode feedrate
67
+          feedrate_mm_s = fast_move_feedrate;       // Get G0 feedrate from last usage
68 68
         }
69 69
       #endif
70 70
     #endif
71 71
 
72
-    get_destination_from_command(); // For X Y Z E F
72
+    get_destination_from_command();                 // Process X Y Z E F parameters
73 73
 
74 74
     #ifdef G0_FEEDRATE
75 75
       if (fast_move) {
76 76
         #if ENABLED(VARIABLE_G0_FEEDRATE)
77
-          saved_g0_feedrate_mm_s = feedrate_mm_s;   // Save feedrate for the next G0
77
+          fast_move_feedrate = feedrate_mm_s;       // Save feedrate for the next G0
78 78
         #else
79
-          saved_feedrate_mm_s = feedrate_mm_s;      // Back up the (new) motion mode feedrate
79
+          old_feedrate = feedrate_mm_s;             // Back up the (new) motion mode feedrate
80 80
           feedrate_mm_s = MMM_TO_MMS(G0_FEEDRATE);  // Get the fixed G0 feedrate
81 81
         #endif
82 82
       }
@@ -100,14 +100,14 @@ void GcodeSuite::G0_G1(
100 100
     #endif // FWRETRACT
101 101
 
102 102
     #if IS_SCARA
103
-      fast_move ? prepare_uninterpolated_move_to_destination() : prepare_move_to_destination();
103
+      fast_move ? prepare_fast_move_to_destination() : prepare_move_to_destination();
104 104
     #else
105 105
       prepare_move_to_destination();
106 106
     #endif
107 107
 
108 108
     #ifdef G0_FEEDRATE
109 109
       // Restore the motion mode feedrate
110
-      if (fast_move) feedrate_mm_s = saved_feedrate_mm_s;
110
+      if (fast_move) feedrate_mm_s = old_feedrate;
111 111
     #endif
112 112
 
113 113
     #if ENABLED(NANODLP_Z_SYNC)

+ 4
- 4
Marlin/src/gcode/motion/G2_G3.cpp ファイルの表示

@@ -146,10 +146,10 @@ void plan_arc(
146 146
   // Initialize the extruder axis
147 147
   raw[E_AXIS] = current_position[E_AXIS];
148 148
 
149
-  const float fr_mm_s = MMS_SCALED(feedrate_mm_s);
149
+  const feedRate_t scaled_fr_mm_s = MMS_SCALED(feedrate_mm_s);
150 150
 
151 151
   #if ENABLED(SCARA_FEEDRATE_SCALING)
152
-    const float inv_duration = fr_mm_s / MM_PER_ARC_SEGMENT;
152
+    const float inv_duration = scaled_fr_mm_s / MM_PER_ARC_SEGMENT;
153 153
   #endif
154 154
 
155 155
   millis_t next_idle_ms = millis() + 200UL;
@@ -206,7 +206,7 @@ void plan_arc(
206 206
       planner.apply_leveling(raw);
207 207
     #endif
208 208
 
209
-    if (!planner.buffer_line(raw, fr_mm_s, active_extruder, MM_PER_ARC_SEGMENT
209
+    if (!planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, MM_PER_ARC_SEGMENT
210 210
       #if ENABLED(SCARA_FEEDRATE_SCALING)
211 211
         , inv_duration
212 212
       #endif
@@ -226,7 +226,7 @@ void plan_arc(
226 226
     planner.apply_leveling(raw);
227 227
   #endif
228 228
 
229
-  planner.buffer_line(raw, fr_mm_s, active_extruder, MM_PER_ARC_SEGMENT
229
+  planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, MM_PER_ARC_SEGMENT
230 230
     #if ENABLED(SCARA_FEEDRATE_SCALING)
231 231
       , inv_duration
232 232
     #endif

+ 1
- 1
Marlin/src/gcode/parser.h ファイルの表示

@@ -364,7 +364,7 @@ public:
364 364
 
365 365
   #endif // !TEMPERATURE_UNITS_SUPPORT
366 366
 
367
-  static inline float value_feedrate() { return value_linear_units(); }
367
+  static inline feedRate_t value_feedrate() { return MMM_TO_MMS(value_linear_units()); }
368 368
 
369 369
   void unknown_command_error();
370 370
 

+ 2
- 2
Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/bio_status_screen.cpp ファイルの表示

@@ -289,7 +289,7 @@ bool StatusScreen::onTouchEnd(uint8_t tag) {
289 289
 
290 290
 bool StatusScreen::onTouchHeld(uint8_t tag) {
291 291
   if (tag >= 1 && tag <= 4 && !jog_xy) return false;
292
-  const float s  = min_speed  + (fine_motion ? 0 : (max_speed  - min_speed)  * sq(increment));
292
+  const float s = min_speed + (fine_motion ? 0 : (max_speed - min_speed) * sq(increment));
293 293
   switch (tag) {
294 294
     case 1: jog(-s,  0,  0); break;
295 295
     case 2: jog( s,  0,  0); break;
@@ -301,7 +301,7 @@ bool StatusScreen::onTouchHeld(uint8_t tag) {
301 301
     case 8:
302 302
     {
303 303
       if (ExtUI::isMoving()) return false;
304
-      const float feedrate  =  emin_speed + (fine_motion ? 0 : (emax_speed - emin_speed) * sq(increment));
304
+      const feedRate_t feedrate = emin_speed + (fine_motion ? 0 : (emax_speed - emin_speed) * sq(increment));
305 305
       const float increment = 0.25 * feedrate * (tag == 7 ? -1 : 1);
306 306
       MoveAxisScreen::setManualFeedrate(E0, feedrate);
307 307
       UI_INCREMENT(AxisPosition_mm, E0);

+ 16
- 22
Marlin/src/lcd/extensible_ui/ui_api.cpp ファイルの表示

@@ -338,6 +338,8 @@ namespace ExtUI {
338 338
     return pos;
339 339
   }
340 340
 
341
+  constexpr feedRate_t manual_feedrate_mm_m[XYZE] = MANUAL_FEEDRATE;
342
+
341 343
   void setAxisPosition_mm(const float position, const axis_t axis) {
342 344
     // Start with no limits to movement
343 345
     float min = current_position[axis] - 1000,
@@ -382,23 +384,15 @@ namespace ExtUI {
382 384
       }
383 385
     #endif
384 386
 
385
-    constexpr float manual_feedrate[XYZE] = MANUAL_FEEDRATE;
386
-    setFeedrate_mm_s(MMM_TO_MMS(manual_feedrate[axis]));
387
-
388
-    set_destination_from_current();
389
-    destination[axis] = constrain(position, min, max);
390
-    prepare_move_to_destination();
387
+    current_position[axis] = constrain(position, min, max);
388
+    line_to_current_position(MMM_TO_MMS(manual_feedrate_mm_m[axis]));
391 389
   }
392 390
 
393 391
   void setAxisPosition_mm(const float position, const extruder_t extruder) {
394 392
     setActiveTool(extruder, true);
395 393
 
396
-    constexpr float manual_feedrate[XYZE] = MANUAL_FEEDRATE;
397
-    setFeedrate_mm_s(MMM_TO_MMS(manual_feedrate[E_AXIS]));
398
-
399
-    set_destination_from_current();
400
-    destination[E_AXIS] = position;
401
-    prepare_move_to_destination();
394
+    current_position[E_AXIS] = position;
395
+    line_to_current_position(MMM_TO_MMS(manual_feedrate_mm_m[E_AXIS]));
402 396
   }
403 397
 
404 398
   void setActiveTool(const extruder_t extruder, bool no_move) {
@@ -581,20 +575,20 @@ namespace ExtUI {
581 575
     planner.settings.axis_steps_per_mm[E_AXIS_N(axis - E0)] = value;
582 576
   }
583 577
 
584
-  float getAxisMaxFeedrate_mm_s(const axis_t axis) {
578
+  feedRate_t getAxisMaxFeedrate_mm_s(const axis_t axis) {
585 579
     return planner.settings.max_feedrate_mm_s[axis];
586 580
   }
587 581
 
588
-  float getAxisMaxFeedrate_mm_s(const extruder_t extruder) {
582
+  feedRate_t getAxisMaxFeedrate_mm_s(const extruder_t extruder) {
589 583
     UNUSED_E(extruder);
590 584
     return planner.settings.max_feedrate_mm_s[E_AXIS_N(axis - E0)];
591 585
   }
592 586
 
593
-  void setAxisMaxFeedrate_mm_s(const float value, const axis_t axis) {
587
+  void setAxisMaxFeedrate_mm_s(const feedRate_t value, const axis_t axis) {
594 588
     planner.settings.max_feedrate_mm_s[axis] = value;
595 589
   }
596 590
 
597
-  void setAxisMaxFeedrate_mm_s(const float value, const extruder_t extruder) {
591
+  void setAxisMaxFeedrate_mm_s(const feedRate_t value, const extruder_t extruder) {
598 592
     UNUSED_E(extruder);
599 593
     planner.settings.max_feedrate_mm_s[E_AXIS_N(axis - E0)] = value;
600 594
   }
@@ -670,15 +664,15 @@ namespace ExtUI {
670 664
     }
671 665
   #endif
672 666
 
673
-  float getFeedrate_mm_s()                            { return feedrate_mm_s; }
674
-  float getMinFeedrate_mm_s()                         { return planner.settings.min_feedrate_mm_s; }
675
-  float getMinTravelFeedrate_mm_s()                   { return planner.settings.min_travel_feedrate_mm_s; }
667
+  feedRate_t getFeedrate_mm_s()                       { return feedrate_mm_s; }
668
+  feedRate_t getMinFeedrate_mm_s()                    { return planner.settings.min_feedrate_mm_s; }
669
+  feedRate_t getMinTravelFeedrate_mm_s()              { return planner.settings.min_travel_feedrate_mm_s; }
676 670
   float getPrintingAcceleration_mm_s2()               { return planner.settings.acceleration; }
677 671
   float getRetractAcceleration_mm_s2()                { return planner.settings.retract_acceleration; }
678 672
   float getTravelAcceleration_mm_s2()                 { return planner.settings.travel_acceleration; }
679
-  void setFeedrate_mm_s(const float fr)               { feedrate_mm_s = fr; }
680
-  void setMinFeedrate_mm_s(const float fr)            { planner.settings.min_feedrate_mm_s = fr; }
681
-  void setMinTravelFeedrate_mm_s(const float fr)      { planner.settings.min_travel_feedrate_mm_s = fr; }
673
+  void setFeedrate_mm_s(const feedRate_t fr)          { feedrate_mm_s = fr; }
674
+  void setMinFeedrate_mm_s(const feedRate_t fr)       { planner.settings.min_feedrate_mm_s = fr; }
675
+  void setMinTravelFeedrate_mm_s(const feedRate_t fr) { planner.settings.min_travel_feedrate_mm_s = fr; }
682 676
   void setPrintingAcceleration_mm_s2(const float acc) { planner.settings.acceleration = acc; }
683 677
   void setRetractAcceleration_mm_s2(const float acc)  { planner.settings.retract_acceleration = acc; }
684 678
   void setTravelAcceleration_mm_s2(const float acc)   { planner.settings.travel_acceleration = acc; }

+ 9
- 9
Marlin/src/lcd/extensible_ui/ui_api.h ファイルの表示

@@ -116,12 +116,12 @@ namespace ExtUI {
116 116
   float getAxisPosition_mm(const extruder_t);
117 117
   float getAxisSteps_per_mm(const axis_t);
118 118
   float getAxisSteps_per_mm(const extruder_t);
119
-  float getAxisMaxFeedrate_mm_s(const axis_t);
120
-  float getAxisMaxFeedrate_mm_s(const extruder_t);
119
+  feedRate_t getAxisMaxFeedrate_mm_s(const axis_t);
120
+  feedRate_t getAxisMaxFeedrate_mm_s(const extruder_t);
121 121
   float getAxisMaxAcceleration_mm_s2(const axis_t);
122 122
   float getAxisMaxAcceleration_mm_s2(const extruder_t);
123
-  float getMinFeedrate_mm_s();
124
-  float getMinTravelFeedrate_mm_s();
123
+  feedRate_t getMinFeedrate_mm_s();
124
+  feedRate_t getMinTravelFeedrate_mm_s();
125 125
   float getPrintingAcceleration_mm_s2();
126 126
   float getRetractAcceleration_mm_s2();
127 127
   float getTravelAcceleration_mm_s2();
@@ -160,13 +160,13 @@ namespace ExtUI {
160 160
   void setAxisPosition_mm(const float, const extruder_t);
161 161
   void setAxisSteps_per_mm(const float, const axis_t);
162 162
   void setAxisSteps_per_mm(const float, const extruder_t);
163
-  void setAxisMaxFeedrate_mm_s(const float, const axis_t);
164
-  void setAxisMaxFeedrate_mm_s(const float, const extruder_t);
163
+  void setAxisMaxFeedrate_mm_s(const feedRate_t, const axis_t);
164
+  void setAxisMaxFeedrate_mm_s(const feedRate_t, const extruder_t);
165 165
   void setAxisMaxAcceleration_mm_s2(const float, const axis_t);
166 166
   void setAxisMaxAcceleration_mm_s2(const float, const extruder_t);
167
-  void setFeedrate_mm_s(const float);
168
-  void setMinFeedrate_mm_s(const float);
169
-  void setMinTravelFeedrate_mm_s(const float);
167
+  void setFeedrate_mm_s(const feedRate_t);
168
+  void setMinFeedrate_mm_s(const feedRate_t);
169
+  void setMinTravelFeedrate_mm_s(const feedRate_t);
170 170
   void setPrintingAcceleration_mm_s2(const float);
171 171
   void setRetractAcceleration_mm_s2(const float);
172 172
   void setTravelAcceleration_mm_s2(const float);

+ 4
- 4
Marlin/src/lcd/menu/menu_ubl.cpp ファイルの表示

@@ -430,21 +430,21 @@ void _lcd_ubl_map_lcd_edit_cmd() {
430 430
  * UBL LCD Map Movement
431 431
  */
432 432
 void ubl_map_move_to_xy() {
433
-  REMEMBER(fr, feedrate_mm_s, MMM_TO_MMS(XY_PROBE_SPEED));
433
+  const feedRate_t fr_mm_s = MMM_TO_MMS(XY_PROBE_SPEED);
434 434
 
435
-  set_destination_from_current();          // sync destination at the start
435
+  set_destination_from_current(); // sync destination at the start
436 436
 
437 437
   #if ENABLED(DELTA)
438 438
     if (current_position[Z_AXIS] > delta_clip_start_height) {
439 439
       destination[Z_AXIS] = delta_clip_start_height;
440
-      prepare_move_to_destination();
440
+      prepare_internal_move_to_destination(fr_mm_s);
441 441
     }
442 442
   #endif
443 443
 
444 444
   destination[X_AXIS] = pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]);
445 445
   destination[Y_AXIS] = pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]);
446 446
 
447
-  prepare_move_to_destination();
447
+  prepare_internal_move_to_destination(fr_mm_s);
448 448
 }
449 449
 
450 450
 /**

+ 3
- 6
Marlin/src/lcd/ultralcd.cpp ファイルの表示

@@ -662,11 +662,9 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
662 662
 
663 663
     if (manual_move_axis != (int8_t)NO_AXIS && ELAPSED(millis(), manual_move_start_time) && !planner.is_full()) {
664 664
 
665
+      const feedRate_t fr_mm_s = MMM_TO_MMS(manual_feedrate_mm_m[manual_move_axis]);
665 666
       #if IS_KINEMATIC
666 667
 
667
-        const float old_feedrate = feedrate_mm_s;
668
-        feedrate_mm_s = MMM_TO_MMS(manual_feedrate_mm_m[manual_move_axis]);
669
-
670 668
         #if EXTRUDERS > 1
671 669
           const int8_t old_extruder = active_extruder;
672 670
           if (manual_move_axis == E_AXIS) active_extruder = manual_move_e_index;
@@ -685,17 +683,16 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
685 683
         // previous invocation is being blocked. Modifications to manual_move_offset shouldn't be made while
686 684
         // processing_manual_move is true or the planner will get out of sync.
687 685
         processing_manual_move = true;
688
-        prepare_move_to_destination(); // will set current_position from destination
686
+        prepare_internal_move_to_destination(fr_mm_s);  // will set current_position from destination
689 687
         processing_manual_move = false;
690 688
 
691
-        feedrate_mm_s = old_feedrate;
692 689
         #if EXTRUDERS > 1
693 690
           active_extruder = old_extruder;
694 691
         #endif
695 692
 
696 693
       #else
697 694
 
698
-        planner.buffer_line(current_position, MMM_TO_MMS(manual_feedrate_mm_m[manual_move_axis]), manual_move_axis == E_AXIS ? manual_move_e_index : active_extruder);
695
+        planner.buffer_line(current_position, fr_mm_s, manual_move_axis == E_AXIS ? manual_move_e_index : active_extruder);
699 696
         manual_move_axis = (int8_t)NO_AXIS;
700 697
 
701 698
       #endif

+ 1
- 1
Marlin/src/lcd/ultralcd.h ファイルの表示

@@ -90,7 +90,7 @@
90 90
     typedef void (*menuAction_t)();
91 91
 
92 92
     // Manual Movement
93
-    constexpr float manual_feedrate_mm_m[XYZE] = MANUAL_FEEDRATE;
93
+    constexpr feedRate_t manual_feedrate_mm_m[XYZE] = MANUAL_FEEDRATE;
94 94
     extern float move_menu_scale;
95 95
 
96 96
     #if ENABLED(ADVANCED_PAUSE_FEATURE)

+ 1
- 1
Marlin/src/libs/nozzle.cpp ファイルの表示

@@ -186,7 +186,7 @@ Nozzle nozzle;
186 186
 #if ENABLED(NOZZLE_PARK_FEATURE)
187 187
 
188 188
   void Nozzle::park(const uint8_t z_action, const point_t &park/*=NOZZLE_PARK_POINT*/) {
189
-    constexpr float fr_xy = NOZZLE_PARK_XY_FEEDRATE, fr_z = NOZZLE_PARK_Z_FEEDRATE;
189
+    constexpr feedRate_t fr_xy = NOZZLE_PARK_XY_FEEDRATE, fr_z = NOZZLE_PARK_Z_FEEDRATE;
190 190
 
191 191
     switch (z_action) {
192 192
       case 1: // Go to Z-park height

+ 18
- 17
Marlin/src/module/configuration_store.cpp ファイルの表示

@@ -124,6 +124,11 @@ typedef struct {     bool X, Y, Z, X2, Y2, Z2, Z3, E0, E1, E2, E3, E4, E5; } tmc
124 124
 // Limit an index to an array size
125 125
 #define ALIM(I,ARR) _MIN(I, COUNT(ARR) - 1)
126 126
 
127
+// Defaults for reset / fill in on load
128
+static const uint32_t   _DMA[] PROGMEM = DEFAULT_MAX_ACCELERATION;
129
+static const float     _DASU[] PROGMEM = DEFAULT_AXIS_STEPS_PER_UNIT;
130
+static const feedRate_t _DMF[] PROGMEM = DEFAULT_MAX_FEEDRATE;
131
+
127 132
 /**
128 133
  * Current EEPROM Layout
129 134
  *
@@ -1289,21 +1294,19 @@ void MarlinSettings::postprocess() {
1289 1294
       {
1290 1295
         // Get only the number of E stepper parameters previously stored
1291 1296
         // Any steppers added later are set to their defaults
1292
-        const uint32_t def1[] = DEFAULT_MAX_ACCELERATION;
1293
-        const float def2[] = DEFAULT_AXIS_STEPS_PER_UNIT, def3[] = DEFAULT_MAX_FEEDRATE;
1294
-
1295 1297
         uint32_t tmp1[XYZ + esteppers];
1298
+        float tmp2[XYZ + esteppers];
1299
+        feedRate_t tmp3[XYZ + esteppers];
1296 1300
         EEPROM_READ(tmp1);                         // max_acceleration_mm_per_s2
1297 1301
         EEPROM_READ(planner.settings.min_segment_time_us);
1298
-
1299
-        float tmp2[XYZ + esteppers], tmp3[XYZ + esteppers];
1300 1302
         EEPROM_READ(tmp2);                         // axis_steps_per_mm
1301 1303
         EEPROM_READ(tmp3);                         // max_feedrate_mm_s
1304
+
1302 1305
         if (!validating) LOOP_XYZE_N(i) {
1303 1306
           const bool in = (i < esteppers + XYZ);
1304
-          planner.settings.max_acceleration_mm_per_s2[i] = in ? tmp1[i] : def1[ALIM(i, def1)];
1305
-          planner.settings.axis_steps_per_mm[i]          = in ? tmp2[i] : def2[ALIM(i, def2)];
1306
-          planner.settings.max_feedrate_mm_s[i]          = in ? tmp3[i] : def3[ALIM(i, def3)];
1307
+          planner.settings.max_acceleration_mm_per_s2[i] = in ? tmp1[i] : pgm_read_dword(&_DMA[ALIM(i, _DMA)]);
1308
+          planner.settings.axis_steps_per_mm[i]          = in ? tmp2[i] : pgm_read_float(&_DASU[ALIM(i, _DASU)]);
1309
+          planner.settings.max_feedrate_mm_s[i]          = in ? tmp3[i] : pgm_read_float(&_DMF[ALIM(i, _DMF)]);
1307 1310
         }
1308 1311
 
1309 1312
         EEPROM_READ(planner.settings.acceleration);
@@ -2205,20 +2208,18 @@ void MarlinSettings::postprocess() {
2205 2208
  * M502 - Reset Configuration
2206 2209
  */
2207 2210
 void MarlinSettings::reset() {
2208
-  static const float tmp1[] PROGMEM = DEFAULT_AXIS_STEPS_PER_UNIT, tmp2[] PROGMEM = DEFAULT_MAX_FEEDRATE;
2209
-  static const uint32_t tmp3[] PROGMEM = DEFAULT_MAX_ACCELERATION;
2210 2211
   LOOP_XYZE_N(i) {
2211
-    planner.settings.axis_steps_per_mm[i]          = pgm_read_float(&tmp1[ALIM(i, tmp1)]);
2212
-    planner.settings.max_feedrate_mm_s[i]          = pgm_read_float(&tmp2[ALIM(i, tmp2)]);
2213
-    planner.settings.max_acceleration_mm_per_s2[i] = pgm_read_dword(&tmp3[ALIM(i, tmp3)]);
2212
+    planner.settings.max_acceleration_mm_per_s2[i] = pgm_read_dword(&_DMA[ALIM(i, _DMA)]);
2213
+    planner.settings.axis_steps_per_mm[i]          = pgm_read_float(&_DASU[ALIM(i, _DASU)]);
2214
+    planner.settings.max_feedrate_mm_s[i]          = pgm_read_float(&_DMF[ALIM(i, _DMF)]);
2214 2215
   }
2215 2216
 
2216 2217
   planner.settings.min_segment_time_us = DEFAULT_MINSEGMENTTIME;
2217 2218
   planner.settings.acceleration = DEFAULT_ACCELERATION;
2218 2219
   planner.settings.retract_acceleration = DEFAULT_RETRACT_ACCELERATION;
2219 2220
   planner.settings.travel_acceleration = DEFAULT_TRAVEL_ACCELERATION;
2220
-  planner.settings.min_feedrate_mm_s = DEFAULT_MINIMUMFEEDRATE;
2221
-  planner.settings.min_travel_feedrate_mm_s = DEFAULT_MINTRAVELFEEDRATE;
2221
+  planner.settings.min_feedrate_mm_s = feedRate_t(DEFAULT_MINIMUMFEEDRATE);
2222
+  planner.settings.min_travel_feedrate_mm_s = feedRate_t(DEFAULT_MINTRAVELFEEDRATE);
2222 2223
 
2223 2224
   #if HAS_CLASSIC_JERK
2224 2225
     #ifndef DEFAULT_XJERK
@@ -3039,7 +3040,7 @@ void MarlinSettings::reset() {
3039 3040
       SERIAL_ECHOLNPAIR(
3040 3041
           "  M207 S", LINEAR_UNIT(fwretract.settings.retract_length)
3041 3042
         , " W", LINEAR_UNIT(fwretract.settings.swap_retract_length)
3042
-        , " F", MMS_TO_MMM(LINEAR_UNIT(fwretract.settings.retract_feedrate_mm_s))
3043
+        , " F", LINEAR_UNIT(MMS_TO_MMM(fwretract.settings.retract_feedrate_mm_s))
3043 3044
         , " Z", LINEAR_UNIT(fwretract.settings.retract_zraise)
3044 3045
       );
3045 3046
 
@@ -3048,7 +3049,7 @@ void MarlinSettings::reset() {
3048 3049
       SERIAL_ECHOLNPAIR(
3049 3050
           "  M208 S", LINEAR_UNIT(fwretract.settings.retract_recover_extra)
3050 3051
         , " W", LINEAR_UNIT(fwretract.settings.swap_retract_recover_extra)
3051
-        , " F", MMS_TO_MMM(LINEAR_UNIT(fwretract.settings.retract_recover_feedrate_mm_s))
3052
+        , " F", LINEAR_UNIT(MMS_TO_MMM(fwretract.settings.retract_recover_feedrate_mm_s))
3052 3053
       );
3053 3054
 
3054 3055
       #if ENABLED(FWRETRACT_AUTORETRACT)

+ 3
- 3
Marlin/src/module/delta.cpp ファイルの表示

@@ -231,12 +231,12 @@ void home_delta() {
231 231
   #endif
232 232
 
233 233
   // Move all carriages together linearly until an endstop is hit.
234
-  destination[Z_AXIS] = (delta_height
234
+  current_position[Z_AXIS] = (delta_height + 10
235 235
     #if HAS_BED_PROBE
236 236
       - probe_offset[Z_AXIS]
237 237
     #endif
238
-    + 10);
239
-  buffer_line_to_destination(homing_feedrate(X_AXIS));
238
+  );
239
+  line_to_current_position(homing_feedrate(X_AXIS));
240 240
   planner.synchronize();
241 241
 
242 242
   // Re-enable stealthChop if used. Disable diag1 pin on driver.

+ 89
- 69
Marlin/src/module/motion.cpp ファイルの表示

@@ -134,12 +134,11 @@ float destination[XYZE]; // = { 0 }
134 134
 // no other feedrate is specified. Overridden for special moves.
135 135
 // Set by the last G0 through G5 command's "F" parameter.
136 136
 // Functions that override this for custom moves *must always* restore it!
137
-float feedrate_mm_s = MMM_TO_MMS(1500.0f);
138
-
137
+feedRate_t feedrate_mm_s = MMM_TO_MMS(1500);
139 138
 int16_t feedrate_percentage = 100;
140 139
 
141 140
 // Homing feedrate is const progmem - compare to constexpr in the header
142
-const float homing_feedrate_mm_s[XYZ] PROGMEM = {
141
+const feedRate_t homing_feedrate_mm_s[XYZ] PROGMEM = {
143 142
   #if ENABLED(DELTA)
144 143
     MMM_TO_MMS(HOMING_FEEDRATE_Z), MMM_TO_MMS(HOMING_FEEDRATE_Z),
145 144
   #else
@@ -285,29 +284,21 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
285 284
  * Move the planner to the current position from wherever it last moved
286 285
  * (or from wherever it has been told it is located).
287 286
  */
288
-void line_to_current_position(const float &fr_mm_s/*=feedrate_mm_s*/) {
289
-  planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], fr_mm_s, active_extruder);
290
-}
291
-
292
-/**
293
- * Move the planner to the position stored in the destination array, which is
294
- * used by G0/G1/G2/G3/G5 and many other functions to set a destination.
295
- */
296
-void buffer_line_to_destination(const float fr_mm_s) {
297
-  planner.buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], fr_mm_s, active_extruder);
287
+void line_to_current_position(const feedRate_t &fr_mm_s/*=feedrate_mm_s*/) {
288
+  planner.buffer_line(current_position, fr_mm_s, active_extruder);
298 289
 }
299 290
 
300 291
 #if IS_KINEMATIC
301 292
 
302 293
   /**
303
-   * Calculate delta, start a line, and set current_position to destination
294
+   * Buffer a fast move without interpolation. Set current_position to destination
304 295
    */
305
-  void prepare_uninterpolated_move_to_destination(const float &fr_mm_s/*=0.0*/) {
306
-    if (DEBUGGING(LEVELING)) DEBUG_POS("prepare_uninterpolated_move_to_destination", destination);
296
+  void prepare_fast_move_to_destination(const feedRate_t &scaled_fr_mm_s/*=MMS_SCALED(feedrate_mm_s)*/) {
297
+    if (DEBUGGING(LEVELING)) DEBUG_POS("prepare_fast_move_to_destination", destination);
307 298
 
308 299
     #if UBL_SEGMENTED
309
-      // ubl segmented line will do z-only moves in single segment
310
-      ubl.prepare_segmented_line_to(destination, MMS_SCALED(fr_mm_s ? fr_mm_s : feedrate_mm_s));
300
+      // UBL segmented line will do Z-only moves in single segment
301
+      ubl.line_to_destination_segmented(scaled_fr_mm_s);
311 302
     #else
312 303
       if ( current_position[X_AXIS] == destination[X_AXIS]
313 304
         && current_position[Y_AXIS] == destination[Y_AXIS]
@@ -315,7 +306,7 @@ void buffer_line_to_destination(const float fr_mm_s) {
315 306
         && current_position[E_AXIS] == destination[E_AXIS]
316 307
       ) return;
317 308
 
318
-      planner.buffer_line(destination, MMS_SCALED(fr_mm_s ? fr_mm_s : feedrate_mm_s), active_extruder);
309
+      planner.buffer_line(destination, scaled_fr_mm_s, active_extruder);
319 310
     #endif
320 311
 
321 312
     set_current_from_destination();
@@ -323,14 +314,40 @@ void buffer_line_to_destination(const float fr_mm_s) {
323 314
 
324 315
 #endif // IS_KINEMATIC
325 316
 
317
+void _internal_move_to_destination(const feedRate_t &fr_mm_s/*=0.0f*/
318
+  #if IS_KINEMATIC
319
+    , const bool is_fast/*=false*/
320
+  #endif
321
+) {
322
+  const feedRate_t old_feedrate = feedrate_mm_s;
323
+  if (fr_mm_s) feedrate_mm_s = fr_mm_s;
324
+
325
+  const uint16_t old_pct = feedrate_percentage;
326
+  feedrate_percentage = 100;
327
+
328
+  const float old_fac = planner.e_factor[active_extruder];
329
+  planner.e_factor[active_extruder] = 1.0f;
330
+
331
+  #if IS_KINEMATIC
332
+    if (is_fast)
333
+      prepare_fast_move_to_destination();
334
+    else
335
+  #endif
336
+      prepare_move_to_destination();
337
+
338
+  feedrate_mm_s = old_feedrate;
339
+  feedrate_percentage = old_pct;
340
+  planner.e_factor[active_extruder] = old_fac;
341
+}
342
+
326 343
 /**
327 344
  * Plan a move to (X, Y, Z) and set the current_position
328 345
  */
329
-void do_blocking_move_to(const float rx, const float ry, const float rz, const float &fr_mm_s/*=0.0*/) {
346
+void do_blocking_move_to(const float rx, const float ry, const float rz, const feedRate_t &fr_mm_s/*=0.0*/) {
330 347
   if (DEBUGGING(LEVELING)) DEBUG_XYZ(">>> do_blocking_move_to", rx, ry, rz);
331 348
 
332
-  const float z_feedrate  = fr_mm_s ? fr_mm_s : homing_feedrate(Z_AXIS),
333
-              xy_feedrate = fr_mm_s ? fr_mm_s : XY_PROBE_FEEDRATE_MM_S;
349
+  const feedRate_t z_feedrate = fr_mm_s ? fr_mm_s : homing_feedrate(Z_AXIS),
350
+                  xy_feedrate = fr_mm_s ? fr_mm_s : feedRate_t(XY_PROBE_FEEDRATE_MM_S);
334 351
 
335 352
   #if ENABLED(DELTA)
336 353
 
@@ -344,33 +361,33 @@ void do_blocking_move_to(const float rx, const float ry, const float rz, const f
344 361
 
345 362
     // when in the danger zone
346 363
     if (current_position[Z_AXIS] > delta_clip_start_height) {
347
-      if (rz > delta_clip_start_height) {   // staying in the danger zone
348
-        destination[X_AXIS] = rx;           // move directly (uninterpolated)
364
+      if (rz > delta_clip_start_height) {                     // staying in the danger zone
365
+        destination[X_AXIS] = rx;                             // move directly (uninterpolated)
349 366
         destination[Y_AXIS] = ry;
350 367
         destination[Z_AXIS] = rz;
351
-        prepare_uninterpolated_move_to_destination(); // set_current_from_destination()
368
+        prepare_internal_fast_move_to_destination();          // set_current_from_destination()
352 369
         if (DEBUGGING(LEVELING)) DEBUG_POS("danger zone move", current_position);
353 370
         return;
354 371
       }
355 372
       destination[Z_AXIS] = delta_clip_start_height;
356
-      prepare_uninterpolated_move_to_destination(); // set_current_from_destination()
373
+      prepare_internal_fast_move_to_destination();            // set_current_from_destination()
357 374
       if (DEBUGGING(LEVELING)) DEBUG_POS("zone border move", current_position);
358 375
     }
359 376
 
360
-    if (rz > current_position[Z_AXIS]) {    // raising?
377
+    if (rz > current_position[Z_AXIS]) {                      // raising?
361 378
       destination[Z_AXIS] = rz;
362
-      prepare_uninterpolated_move_to_destination(z_feedrate);   // set_current_from_destination()
379
+      prepare_internal_fast_move_to_destination(z_feedrate);  // set_current_from_destination()
363 380
       if (DEBUGGING(LEVELING)) DEBUG_POS("z raise move", current_position);
364 381
     }
365 382
 
366 383
     destination[X_AXIS] = rx;
367 384
     destination[Y_AXIS] = ry;
368
-    prepare_move_to_destination();         // set_current_from_destination()
385
+    prepare_internal_move_to_destination();                   // set_current_from_destination()
369 386
     if (DEBUGGING(LEVELING)) DEBUG_POS("xy move", current_position);
370 387
 
371
-    if (rz < current_position[Z_AXIS]) {    // lowering?
388
+    if (rz < current_position[Z_AXIS]) {                      // lowering?
372 389
       destination[Z_AXIS] = rz;
373
-      prepare_uninterpolated_move_to_destination(z_feedrate);   // set_current_from_destination()
390
+      prepare_fast_move_to_destination(z_feedrate);           // set_current_from_destination()
374 391
       if (DEBUGGING(LEVELING)) DEBUG_POS("z lower move", current_position);
375 392
     }
376 393
 
@@ -383,17 +400,17 @@ void do_blocking_move_to(const float rx, const float ry, const float rz, const f
383 400
     // If Z needs to raise, do it before moving XY
384 401
     if (destination[Z_AXIS] < rz) {
385 402
       destination[Z_AXIS] = rz;
386
-      prepare_uninterpolated_move_to_destination(z_feedrate);
403
+      prepare_internal_fast_move_to_destination(z_feedrate);
387 404
     }
388 405
 
389 406
     destination[X_AXIS] = rx;
390 407
     destination[Y_AXIS] = ry;
391
-    prepare_uninterpolated_move_to_destination(xy_feedrate);
408
+    prepare_internal_fast_move_to_destination(xy_feedrate);
392 409
 
393 410
     // If Z needs to lower, do it after moving XY
394 411
     if (destination[Z_AXIS] > rz) {
395 412
       destination[Z_AXIS] = rz;
396
-      prepare_uninterpolated_move_to_destination(z_feedrate);
413
+      prepare_internal_fast_move_to_destination(z_feedrate);
397 414
     }
398 415
 
399 416
   #else
@@ -420,16 +437,16 @@ void do_blocking_move_to(const float rx, const float ry, const float rz, const f
420 437
 
421 438
   planner.synchronize();
422 439
 }
423
-void do_blocking_move_to_x(const float &rx, const float &fr_mm_s/*=0.0*/) {
440
+void do_blocking_move_to_x(const float &rx, const feedRate_t &fr_mm_s/*=0.0*/) {
424 441
   do_blocking_move_to(rx, current_position[Y_AXIS], current_position[Z_AXIS], fr_mm_s);
425 442
 }
426
-void do_blocking_move_to_y(const float &ry, const float &fr_mm_s/*=0.0*/) {
443
+void do_blocking_move_to_y(const float &ry, const feedRate_t &fr_mm_s/*=0.0*/) {
427 444
   do_blocking_move_to(current_position[X_AXIS], ry, current_position[Z_AXIS], fr_mm_s);
428 445
 }
429
-void do_blocking_move_to_z(const float &rz, const float &fr_mm_s/*=0.0*/) {
446
+void do_blocking_move_to_z(const float &rz, const feedRate_t &fr_mm_s/*=0.0*/) {
430 447
   do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], rz, fr_mm_s);
431 448
 }
432
-void do_blocking_move_to_xy(const float &rx, const float &ry, const float &fr_mm_s/*=0.0*/) {
449
+void do_blocking_move_to_xy(const float &rx, const float &ry, const feedRate_t &fr_mm_s/*=0.0*/) {
433 450
   do_blocking_move_to(rx, ry, current_position[Z_AXIS], fr_mm_s);
434 451
 }
435 452
 
@@ -629,31 +646,31 @@ void restore_feedrate_and_scaling() {
629 646
    * small incremental moves for DELTA or SCARA.
630 647
    *
631 648
    * For Unified Bed Leveling (Delta or Segmented Cartesian)
632
-   * the ubl.prepare_segmented_line_to method replaces this.
649
+   * the ubl.line_to_destination_segmented method replaces this.
633 650
    *
634 651
    * For Auto Bed Leveling (Bilinear) with SEGMENT_LEVELED_MOVES
635 652
    * this is replaced by segmented_line_to_destination below.
636 653
    */
637
-  inline bool prepare_kinematic_move_to(const float (&rtarget)[XYZE]) {
654
+  inline bool line_to_destination_kinematic() {
638 655
 
639 656
     // Get the top feedrate of the move in the XY plane
640
-    const float _feedrate_mm_s = MMS_SCALED(feedrate_mm_s);
657
+    const float scaled_fr_mm_s = MMS_SCALED(feedrate_mm_s);
641 658
 
642
-    const float xdiff = rtarget[X_AXIS] - current_position[X_AXIS],
643
-                ydiff = rtarget[Y_AXIS] - current_position[Y_AXIS];
659
+    const float xdiff = destination[X_AXIS] - current_position[X_AXIS],
660
+                ydiff = destination[Y_AXIS] - current_position[Y_AXIS];
644 661
 
645 662
     // If the move is only in Z/E don't split up the move
646 663
     if (!xdiff && !ydiff) {
647
-      planner.buffer_line(rtarget, _feedrate_mm_s, active_extruder);
664
+      planner.buffer_line(destination, scaled_fr_mm_s, active_extruder);
648 665
       return false; // caller will update current_position
649 666
     }
650 667
 
651 668
     // Fail if attempting move outside printable radius
652
-    if (!position_is_reachable(rtarget[X_AXIS], rtarget[Y_AXIS])) return true;
669
+    if (!position_is_reachable(destination[X_AXIS], destination[Y_AXIS])) return true;
653 670
 
654 671
     // Remaining cartesian distances
655
-    const float zdiff = rtarget[Z_AXIS] - current_position[Z_AXIS],
656
-                ediff = rtarget[E_AXIS] - current_position[E_AXIS];
672
+    const float zdiff = destination[Z_AXIS] - current_position[Z_AXIS],
673
+                ediff = destination[E_AXIS] - current_position[E_AXIS];
657 674
 
658 675
     // Get the linear distance in XYZ
659 676
     float cartesian_mm = SQRT(sq(xdiff) + sq(ydiff) + sq(zdiff));
@@ -665,7 +682,7 @@ void restore_feedrate_and_scaling() {
665 682
     if (UNEAR_ZERO(cartesian_mm)) return true;
666 683
 
667 684
     // Minimum number of seconds to move the given distance
668
-    const float seconds = cartesian_mm / _feedrate_mm_s;
685
+    const float seconds = cartesian_mm / scaled_fr_mm_s;
669 686
 
670 687
     // The number of segments-per-second times the duration
671 688
     // gives the number of segments
@@ -690,7 +707,7 @@ void restore_feedrate_and_scaling() {
690 707
                 cartesian_segment_mm = cartesian_mm * inv_segments;
691 708
 
692 709
     #if ENABLED(SCARA_FEEDRATE_SCALING)
693
-      const float inv_duration = _feedrate_mm_s / cartesian_segment_mm;
710
+      const float inv_duration = scaled_fr_mm_s / cartesian_segment_mm;
694 711
     #endif
695 712
 
696 713
     /*
@@ -717,7 +734,7 @@ void restore_feedrate_and_scaling() {
717 734
 
718 735
       LOOP_XYZE(i) raw[i] += segment_distance[i];
719 736
 
720
-      if (!planner.buffer_line(raw, _feedrate_mm_s, active_extruder, cartesian_segment_mm
737
+      if (!planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, cartesian_segment_mm
721 738
         #if ENABLED(SCARA_FEEDRATE_SCALING)
722 739
           , inv_duration
723 740
         #endif
@@ -726,7 +743,7 @@ void restore_feedrate_and_scaling() {
726 743
     }
727 744
 
728 745
     // Ensure last segment arrives at target location.
729
-    planner.buffer_line(rtarget, _feedrate_mm_s, active_extruder, cartesian_segment_mm
746
+    planner.buffer_line(destination, scaled_fr_mm_s, active_extruder, cartesian_segment_mm
730 747
       #if ENABLED(SCARA_FEEDRATE_SCALING)
731 748
         , inv_duration
732 749
       #endif
@@ -746,7 +763,7 @@ void restore_feedrate_and_scaling() {
746 763
      * small incremental moves. This allows the planner to
747 764
      * apply more detailed bed leveling to the full move.
748 765
      */
749
-    inline void segmented_line_to_destination(const float &fr_mm_s, const float segment_size=LEVELED_SEGMENT_LENGTH) {
766
+    inline void segmented_line_to_destination(const feedRate_t &fr_mm_s, const float segment_size=LEVELED_SEGMENT_LENGTH) {
750 767
 
751 768
       const float xdiff = destination[X_AXIS] - current_position[X_AXIS],
752 769
                   ydiff = destination[Y_AXIS] - current_position[Y_AXIS];
@@ -784,7 +801,7 @@ void restore_feedrate_and_scaling() {
784 801
                   };
785 802
 
786 803
       #if ENABLED(SCARA_FEEDRATE_SCALING)
787
-        const float inv_duration = _feedrate_mm_s / cartesian_segment_mm;
804
+        const float inv_duration = scaled_fr_mm_s / cartesian_segment_mm;
788 805
       #endif
789 806
 
790 807
       // SERIAL_ECHOPAIR("mm=", cartesian_mm);
@@ -832,13 +849,14 @@ void restore_feedrate_and_scaling() {
832 849
    * Returns true if current_position[] was set to destination[]
833 850
    */
834 851
   inline bool prepare_move_to_destination_cartesian() {
852
+    const float scaled_fr_mm_s = MMS_SCALED(feedrate_mm_s);
835 853
     #if HAS_MESH
836 854
       if (planner.leveling_active && planner.leveling_active_at_z(destination[Z_AXIS])) {
837 855
         #if ENABLED(AUTO_BED_LEVELING_UBL)
838
-          ubl.line_to_destination_cartesian(MMS_SCALED(feedrate_mm_s), active_extruder);  // UBL's motion routine needs to know about
839
-          return true;                                                                    // all moves, including Z-only moves.
856
+          ubl.line_to_destination_cartesian(scaled_fr_mm_s, active_extruder); // UBL's motion routine needs to know about
857
+          return true;                                                        // all moves, including Z-only moves.
840 858
         #elif ENABLED(SEGMENT_LEVELED_MOVES)
841
-          segmented_line_to_destination(MMS_SCALED(feedrate_mm_s));
859
+          segmented_line_to_destination(scaled_fr_mm_s);
842 860
           return false; // caller will update current_position
843 861
         #else
844 862
           /**
@@ -847,9 +865,9 @@ void restore_feedrate_and_scaling() {
847 865
            */
848 866
           if (current_position[X_AXIS] != destination[X_AXIS] || current_position[Y_AXIS] != destination[Y_AXIS]) {
849 867
             #if ENABLED(MESH_BED_LEVELING)
850
-              mbl.line_to_destination(MMS_SCALED(feedrate_mm_s));
868
+              mbl.line_to_destination(scaled_fr_mm_s);
851 869
             #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
852
-              bilinear_line_to_destination(MMS_SCALED(feedrate_mm_s));
870
+              bilinear_line_to_destination(scaled_fr_mm_s);
853 871
             #endif
854 872
             return true;
855 873
           }
@@ -857,7 +875,7 @@ void restore_feedrate_and_scaling() {
857 875
       }
858 876
     #endif // HAS_MESH
859 877
 
860
-    buffer_line_to_destination(MMS_SCALED(feedrate_mm_s));
878
+    planner.buffer_line(destination, scaled_fr_mm_s, active_extruder);
861 879
     return false; // caller will update current_position
862 880
   }
863 881
 
@@ -971,6 +989,8 @@ void restore_feedrate_and_scaling() {
971 989
  *
972 990
  * Make sure current_position[E] and destination[E] are good
973 991
  * before calling or cold/lengthy extrusion may get missed.
992
+ *
993
+ * Before exit, current_position is set to destination.
974 994
  */
975 995
 void prepare_move_to_destination() {
976 996
   apply_motion_limits(destination);
@@ -1014,14 +1034,13 @@ void prepare_move_to_destination() {
1014 1034
 
1015 1035
   if (
1016 1036
     #if UBL_SEGMENTED
1017
-      //ubl.prepare_segmented_line_to(destination, MMS_SCALED(feedrate_mm_s))   // This doesn't seem to work correctly on UBL.
1018
-      #if IS_KINEMATIC                                                          // Use Kinematic / Cartesian cases as a workaround for now.
1019
-        ubl.prepare_segmented_line_to(destination, MMS_SCALED(feedrate_mm_s))
1037
+      #if IS_KINEMATIC // UBL using Kinematic / Cartesian cases as a workaround for now.
1038
+        ubl.line_to_destination_segmented(MMS_SCALED(feedrate_mm_s))
1020 1039
       #else
1021 1040
         prepare_move_to_destination_cartesian()
1022 1041
       #endif
1023 1042
     #elif IS_KINEMATIC
1024
-      prepare_kinematic_move_to(destination)
1043
+      line_to_destination_kinematic()
1025 1044
     #else
1026 1045
       prepare_move_to_destination_cartesian()
1027 1046
     #endif
@@ -1065,7 +1084,7 @@ bool axis_unhomed_error(uint8_t axis_bits/*=0x07*/) {
1065 1084
 /**
1066 1085
  * Homing bump feedrate (mm/s)
1067 1086
  */
1068
-float get_homing_bump_feedrate(const AxisEnum axis) {
1087
+feedRate_t get_homing_bump_feedrate(const AxisEnum axis) {
1069 1088
   #if HOMING_Z_WITH_PROBE
1070 1089
     if (axis == Z_AXIS) return MMM_TO_MMS(Z_PROBE_SPEED_SLOW);
1071 1090
   #endif
@@ -1075,7 +1094,7 @@ float get_homing_bump_feedrate(const AxisEnum axis) {
1075 1094
     hbd = 10;
1076 1095
     SERIAL_ECHO_MSG("Warning: Homing Bump Divisor < 1");
1077 1096
   }
1078
-  return homing_feedrate(axis) / hbd;
1097
+  return homing_feedrate(axis) / float(hbd);
1079 1098
 }
1080 1099
 
1081 1100
 #if ENABLED(SENSORLESS_HOMING)
@@ -1221,7 +1240,7 @@ float get_homing_bump_feedrate(const AxisEnum axis) {
1221 1240
 /**
1222 1241
  * Home an individual linear axis
1223 1242
  */
1224
-void do_homing_move(const AxisEnum axis, const float distance, const float fr_mm_s=0.0) {
1243
+void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t fr_mm_s=0.0) {
1225 1244
 
1226 1245
   if (DEBUGGING(LEVELING)) {
1227 1246
     DEBUG_ECHOPAIR(">>> do_homing_move(", axis_codes[axis], ", ", distance, ", ");
@@ -1266,12 +1285,13 @@ void do_homing_move(const AxisEnum axis, const float distance, const float fr_mm
1266 1285
     #endif
1267 1286
   }
1268 1287
 
1288
+  const feedRate_t real_fr_mm_s = fr_mm_s ? fr_mm_s : homing_feedrate(axis);
1269 1289
   #if IS_SCARA
1270 1290
     // Tell the planner the axis is at 0
1271 1291
     current_position[axis] = 0;
1272 1292
     sync_plan_position();
1273 1293
     current_position[axis] = distance;
1274
-    planner.buffer_line(current_position, fr_mm_s ? fr_mm_s : homing_feedrate(axis), active_extruder);
1294
+    line_to_current_position(real_fr_mm_s);
1275 1295
   #else
1276 1296
     float target[ABCE] = { planner.get_axis_position_mm(A_AXIS), planner.get_axis_position_mm(B_AXIS), planner.get_axis_position_mm(C_AXIS), planner.get_axis_position_mm(E_AXIS) };
1277 1297
     target[axis] = 0;
@@ -1287,7 +1307,7 @@ void do_homing_move(const AxisEnum axis, const float distance, const float fr_mm
1287 1307
       #if IS_KINEMATIC && ENABLED(JUNCTION_DEVIATION)
1288 1308
         , delta_mm_cart
1289 1309
       #endif
1290
-      , fr_mm_s ? fr_mm_s : homing_feedrate(axis), active_extruder
1310
+      , real_fr_mm_s, active_extruder
1291 1311
     );
1292 1312
   #endif
1293 1313
 
@@ -1507,7 +1527,7 @@ void homeaxis(const AxisEnum axis) {
1507 1527
     if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Move Away:");
1508 1528
     do_homing_move(axis, -bump
1509 1529
       #if HOMING_Z_WITH_PROBE
1510
-        , axis == Z_AXIS ? MMM_TO_MMS(Z_PROBE_SPEED_FAST) : 0.0
1530
+        , MMM_TO_MMS(axis == Z_AXIS ? Z_PROBE_SPEED_FAST : 0)
1511 1531
       #endif
1512 1532
     );
1513 1533
 

+ 29
- 22
Marlin/src/module/motion.h ファイルの表示

@@ -85,17 +85,16 @@ extern float cartes[XYZ];
85 85
  * Feed rates are often configured with mm/m
86 86
  * but the planner and stepper like mm/s units.
87 87
  */
88
-extern const float homing_feedrate_mm_s[XYZ];
89
-FORCE_INLINE float homing_feedrate(const AxisEnum a) { return pgm_read_float(&homing_feedrate_mm_s[a]); }
90
-float get_homing_bump_feedrate(const AxisEnum axis);
88
+extern const feedRate_t homing_feedrate_mm_s[XYZ];
89
+FORCE_INLINE feedRate_t homing_feedrate(const AxisEnum a) { return pgm_read_float(&homing_feedrate_mm_s[a]); }
90
+feedRate_t get_homing_bump_feedrate(const AxisEnum axis);
91 91
 
92
-extern float feedrate_mm_s;
92
+extern feedRate_t feedrate_mm_s;
93 93
 
94 94
 /**
95
- * Feedrate scaling and conversion
95
+ * Feedrate scaling
96 96
  */
97 97
 extern int16_t feedrate_percentage;
98
-#define MMS_SCALED(MM_S) ((MM_S)*feedrate_percentage*0.01f)
99 98
 
100 99
 // The active extruder (tool). Set with T<extruder> command.
101 100
 #if EXTRUDERS > 1
@@ -172,34 +171,42 @@ void sync_plan_position_e();
172 171
  * Move the planner to the current position from wherever it last moved
173 172
  * (or from wherever it has been told it is located).
174 173
  */
175
-void line_to_current_position(const float &fr_mm_s=feedrate_mm_s);
174
+void line_to_current_position(const feedRate_t &fr_mm_s=feedrate_mm_s);
176 175
 
177
-/**
178
- * Move the planner to the position stored in the destination array, which is
179
- * used by G0/G1/G2/G3/G5 and many other functions to set a destination.
180
- */
181
-void buffer_line_to_destination(const float fr_mm_s);
176
+void prepare_move_to_destination();
177
+
178
+void _internal_move_to_destination(const feedRate_t &fr_mm_s=0.0f
179
+  #if IS_KINEMATIC
180
+    , const bool is_fast=false
181
+  #endif
182
+);
183
+
184
+inline void prepare_internal_move_to_destination(const feedRate_t &fr_mm_s=0.0f) {
185
+  _internal_move_to_destination(fr_mm_s);
186
+}
182 187
 
183 188
 #if IS_KINEMATIC
184
-  void prepare_uninterpolated_move_to_destination(const float &fr_mm_s=0);
185
-#endif
189
+  void prepare_fast_move_to_destination(const feedRate_t &scaled_fr_mm_s=MMS_SCALED(feedrate_mm_s));
186 190
 
187
-void prepare_move_to_destination();
191
+  inline void prepare_internal_fast_move_to_destination(const feedRate_t &fr_mm_s=0.0f) {
192
+    _internal_move_to_destination(fr_mm_s, true);
193
+  }
194
+#endif
188 195
 
189 196
 /**
190 197
  * Blocking movement and shorthand functions
191 198
  */
192
-void do_blocking_move_to(const float rx, const float ry, const float rz, const float &fr_mm_s=0);
193
-void do_blocking_move_to_x(const float &rx, const float &fr_mm_s=0);
194
-void do_blocking_move_to_y(const float &ry, const float &fr_mm_s=0);
195
-void do_blocking_move_to_z(const float &rz, const float &fr_mm_s=0);
196
-void do_blocking_move_to_xy(const float &rx, const float &ry, const float &fr_mm_s=0);
199
+void do_blocking_move_to(const float rx, const float ry, const float rz, const feedRate_t &fr_mm_s=0.0f);
200
+void do_blocking_move_to_x(const float &rx, const feedRate_t &fr_mm_s=0.0f);
201
+void do_blocking_move_to_y(const float &ry, const feedRate_t &fr_mm_s=0.0f);
202
+void do_blocking_move_to_z(const float &rz, const feedRate_t &fr_mm_s=0.0f);
203
+void do_blocking_move_to_xy(const float &rx, const float &ry, const feedRate_t &fr_mm_s=0.0f);
197 204
 
198
-FORCE_INLINE void do_blocking_move_to(const float (&raw)[XYZ], const float &fr_mm_s=0) {
205
+FORCE_INLINE void do_blocking_move_to(const float (&raw)[XYZ], const feedRate_t &fr_mm_s=0) {
199 206
   do_blocking_move_to(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS], fr_mm_s);
200 207
 }
201 208
 
202
-FORCE_INLINE void do_blocking_move_to(const float (&raw)[XYZE], const float &fr_mm_s=0) {
209
+FORCE_INLINE void do_blocking_move_to(const float (&raw)[XYZE], const feedRate_t &fr_mm_s=0) {
203 210
   do_blocking_move_to(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS], fr_mm_s);
204 211
 }
205 212
 

+ 10
- 11
Marlin/src/module/planner.cpp ファイルの表示

@@ -1570,7 +1570,7 @@ bool Planner::_buffer_steps(const int32_t (&target)[XYZE]
1570 1570
   #if IS_KINEMATIC && ENABLED(JUNCTION_DEVIATION)
1571 1571
     , const float (&delta_mm_cart)[XYZE]
1572 1572
   #endif
1573
-  , float fr_mm_s, const uint8_t extruder, const float &millimeters
1573
+  , feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters
1574 1574
 ) {
1575 1575
 
1576 1576
   // If we are cleaning, do not accept queuing of movements
@@ -1634,7 +1634,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
1634 1634
   #if IS_KINEMATIC && ENABLED(JUNCTION_DEVIATION)
1635 1635
     , const float (&delta_mm_cart)[XYZE]
1636 1636
   #endif
1637
-  , float fr_mm_s, const uint8_t extruder, const float &millimeters/*=0.0*/
1637
+  , feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters/*=0.0*/
1638 1638
 ) {
1639 1639
 
1640 1640
   const int32_t da = target[A_AXIS] - position[A_AXIS],
@@ -2091,7 +2091,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
2091 2091
     #else
2092 2092
       const float delta_mm_i = delta_mm[i];
2093 2093
     #endif
2094
-    const float cs = ABS(current_speed[i] = delta_mm_i * inverse_secs);
2094
+    const feedRate_t cs = ABS(current_speed[i] = delta_mm_i * inverse_secs);
2095 2095
     #if ENABLED(DISTINCT_E_FACTORS)
2096 2096
       if (i == E_AXIS) i += extruder;
2097 2097
     #endif
@@ -2569,7 +2569,7 @@ bool Planner::buffer_segment(const float &a, const float &b, const float &c, con
2569 2569
   #if IS_KINEMATIC && ENABLED(JUNCTION_DEVIATION)
2570 2570
     , const float (&delta_mm_cart)[XYZE]
2571 2571
   #endif
2572
-  , const float &fr_mm_s, const uint8_t extruder, const float &millimeters/*=0.0*/
2572
+  , const feedRate_t &fr_mm_s, const uint8_t extruder, const float &millimeters/*=0.0*/
2573 2573
 ) {
2574 2574
 
2575 2575
   // If we are cleaning, do not accept queuing of movements
@@ -2651,9 +2651,8 @@ bool Planner::buffer_segment(const float &a, const float &b, const float &c, con
2651 2651
 
2652 2652
 /**
2653 2653
  * Add a new linear movement to the buffer.
2654
- * The target is cartesian, it's translated to delta/scara if
2655
- * needed.
2656
- *
2654
+ * The target is cartesian. It's translated to
2655
+ * delta/scara if needed.
2657 2656
  *
2658 2657
  *  rx,ry,rz,e   - target position in mm or degrees
2659 2658
  *  fr_mm_s      - (target) speed of the move (mm/s)
@@ -2661,7 +2660,7 @@ bool Planner::buffer_segment(const float &a, const float &b, const float &c, con
2661 2660
  *  millimeters  - the length of the movement, if known
2662 2661
  *  inv_duration - the reciprocal if the duration of the movement, if known (kinematic only if feeedrate scaling is enabled)
2663 2662
  */
2664
-bool Planner::buffer_line(const float &rx, const float &ry, const float &rz, const float &e, const float &fr_mm_s, const uint8_t extruder, const float millimeters
2663
+bool Planner::buffer_line(const float &rx, const float &ry, const float &rz, const float &e, const feedRate_t &fr_mm_s, const uint8_t extruder, const float millimeters
2665 2664
   #if ENABLED(SCARA_FEEDRATE_SCALING)
2666 2665
     , const float &inv_duration
2667 2666
   #endif
@@ -2690,10 +2689,10 @@ bool Planner::buffer_line(const float &rx, const float &ry, const float &rz, con
2690 2689
     #if ENABLED(SCARA_FEEDRATE_SCALING)
2691 2690
       // For SCARA scale the feed rate from mm/s to degrees/s
2692 2691
       // i.e., Complete the angular vector in the given time.
2693
-      const float duration_recip = inv_duration ? inv_duration : fr_mm_s / mm,
2694
-                  feedrate = HYPOT(delta[A_AXIS] - position_float[A_AXIS], delta[B_AXIS] - position_float[B_AXIS]) * duration_recip;
2692
+      const float duration_recip = inv_duration ? inv_duration : fr_mm_s / mm;
2693
+      const feedRate_t feedrate = HYPOT(delta[A_AXIS] - position_float[A_AXIS], delta[B_AXIS] - position_float[B_AXIS]) * duration_recip;
2695 2694
     #else
2696
-      const float feedrate = fr_mm_s;
2695
+      const feedRate_t feedrate = fr_mm_s;
2697 2696
     #endif
2698 2697
     if (buffer_segment(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], raw[E_AXIS]
2699 2698
       #if ENABLED(JUNCTION_DEVIATION)

+ 18
- 19
Marlin/src/module/planner.h ファイルの表示

@@ -170,15 +170,15 @@ typedef struct block_t {
170 170
 #define BLOCK_MOD(n) ((n)&(BLOCK_BUFFER_SIZE-1))
171 171
 
172 172
 typedef struct {
173
-  uint32_t max_acceleration_mm_per_s2[XYZE_N],  // (mm/s^2) M201 XYZE
174
-           min_segment_time_us;                 // (µs) M205 B
175
-  float axis_steps_per_mm[XYZE_N],              // (steps) M92 XYZE - Steps per millimeter
176
-        max_feedrate_mm_s[XYZE_N],              // (mm/s) M203 XYZE - Max speeds
177
-        acceleration,                           // (mm/s^2) M204 S - Normal acceleration. DEFAULT ACCELERATION for all printing moves.
178
-        retract_acceleration,                   // (mm/s^2) M204 R - Retract acceleration. Filament pull-back and push-forward while standing still in the other axes
179
-        travel_acceleration,                    // (mm/s^2) M204 T - Travel acceleration. DEFAULT ACCELERATION for all NON printing moves.
180
-        min_feedrate_mm_s,                      // (mm/s) M205 S - Minimum linear feedrate
181
-        min_travel_feedrate_mm_s;               // (mm/s) M205 T - Minimum travel feedrate
173
+   uint32_t max_acceleration_mm_per_s2[XYZE_N], // (mm/s^2) M201 XYZE
174
+            min_segment_time_us;                // (µs) M205 B
175
+      float axis_steps_per_mm[XYZE_N];          // (steps) M92 XYZE - Steps per millimeter
176
+ feedRate_t max_feedrate_mm_s[XYZE_N];          // (mm/s) M203 XYZE - Max speeds
177
+      float acceleration,                       // (mm/s^2) M204 S - Normal acceleration. DEFAULT ACCELERATION for all printing moves.
178
+            retract_acceleration,               // (mm/s^2) M204 R - Retract acceleration. Filament pull-back and push-forward while standing still in the other axes
179
+            travel_acceleration;                // (mm/s^2) M204 T - Travel acceleration. DEFAULT ACCELERATION for all NON printing moves.
180
+ feedRate_t min_feedrate_mm_s,                  // (mm/s) M205 S - Minimum linear feedrate
181
+            min_travel_feedrate_mm_s;           // (mm/s) M205 T - Minimum travel feedrate
182 182
 } planner_settings_t;
183 183
 
184 184
 #if DISABLED(SKEW_CORRECTION)
@@ -585,7 +585,7 @@ class Planner {
585 585
       #if IS_KINEMATIC && ENABLED(JUNCTION_DEVIATION)
586 586
         , const float (&delta_mm_cart)[XYZE]
587 587
       #endif
588
-      , float fr_mm_s, const uint8_t extruder, const float &millimeters=0.0
588
+      , feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters=0.0
589 589
     );
590 590
 
591 591
     /**
@@ -608,7 +608,7 @@ class Planner {
608 608
       #if IS_KINEMATIC && ENABLED(JUNCTION_DEVIATION)
609 609
         , const float (&delta_mm_cart)[XYZE]
610 610
       #endif
611
-      , float fr_mm_s, const uint8_t extruder, const float &millimeters=0.0
611
+      , feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters=0.0
612 612
     );
613 613
 
614 614
     /**
@@ -621,7 +621,7 @@ class Planner {
621 621
     private:
622 622
 
623 623
       // Allow do_homing_move to access internal functions, such as buffer_segment.
624
-      friend void do_homing_move(const AxisEnum, const float, const float);
624
+      friend void do_homing_move(const AxisEnum, const float, const feedRate_t);
625 625
   #endif
626 626
 
627 627
     /**
@@ -640,14 +640,14 @@ class Planner {
640 640
       #if IS_KINEMATIC && ENABLED(JUNCTION_DEVIATION)
641 641
         , const float (&delta_mm_cart)[XYZE]
642 642
       #endif
643
-      , const float &fr_mm_s, const uint8_t extruder, const float &millimeters=0.0
643
+      , const feedRate_t &fr_mm_s, const uint8_t extruder, const float &millimeters=0.0
644 644
     );
645 645
 
646 646
     FORCE_INLINE static bool buffer_segment(const float (&abce)[ABCE]
647 647
       #if IS_KINEMATIC && ENABLED(JUNCTION_DEVIATION)
648 648
         , const float (&delta_mm_cart)[XYZE]
649 649
       #endif
650
-      , const float &fr_mm_s, const uint8_t extruder, const float &millimeters=0.0
650
+      , const feedRate_t &fr_mm_s, const uint8_t extruder, const float &millimeters=0.0
651 651
     ) {
652 652
       return buffer_segment(abce[A_AXIS], abce[B_AXIS], abce[C_AXIS], abce[E_AXIS]
653 653
         #if IS_KINEMATIC && ENABLED(JUNCTION_DEVIATION)
@@ -660,9 +660,8 @@ class Planner {
660 660
 
661 661
     /**
662 662
      * Add a new linear movement to the buffer.
663
-     * The target is cartesian, it's translated to delta/scara if
664
-     * needed.
665
-     *
663
+     * The target is cartesian. It's translated to
664
+     * delta/scara if needed.
666 665
      *
667 666
      *  rx,ry,rz,e   - target position in mm or degrees
668 667
      *  fr_mm_s      - (target) speed of the move (mm/s)
@@ -670,13 +669,13 @@ class Planner {
670 669
      *  millimeters  - the length of the movement, if known
671 670
      *  inv_duration - the reciprocal if the duration of the movement, if known (kinematic only if feeedrate scaling is enabled)
672 671
      */
673
-    static bool buffer_line(const float &rx, const float &ry, const float &rz, const float &e, const float &fr_mm_s, const uint8_t extruder, const float millimeters=0.0
672
+    static bool buffer_line(const float &rx, const float &ry, const float &rz, const float &e, const feedRate_t &fr_mm_s, const uint8_t extruder, const float millimeters=0.0
674 673
       #if ENABLED(SCARA_FEEDRATE_SCALING)
675 674
         , const float &inv_duration=0.0
676 675
       #endif
677 676
     );
678 677
 
679
-    FORCE_INLINE static bool buffer_line(const float (&cart)[XYZE], const float &fr_mm_s, const uint8_t extruder, const float millimeters=0.0
678
+    FORCE_INLINE static bool buffer_line(const float (&cart)[XYZE], const feedRate_t &fr_mm_s, const uint8_t extruder, const float millimeters=0.0
680 679
       #if ENABLED(SCARA_FEEDRATE_SCALING)
681 680
         , const float &inv_duration=0.0
682 681
       #endif

+ 9
- 4
Marlin/src/module/planner_bezier.cpp ファイルの表示

@@ -107,13 +107,18 @@ static inline float dist1(const float &x1, const float &y1, const float &x2, con
107 107
  * the mitigation offered by MIN_STEP and the small computational
108 108
  * power available on Arduino, I think it is not wise to implement it.
109 109
  */
110
-void cubic_b_spline(const float position[NUM_AXIS], const float target[NUM_AXIS], const float offset[4], float fr_mm_s, uint8_t extruder) {
110
+void cubic_b_spline(
111
+  const float position[NUM_AXIS],   // current position
112
+  const float target[NUM_AXIS],     // target position
113
+  const float (&offset)[4],         // a pair of offsets
114
+  const feedRate_t &scaled_fr_mm_s, // mm/s scaled by feedrate %
115
+  const uint8_t extruder
116
+) {
111 117
   // Absolute first and second control points are recovered.
112 118
   const float first0 = position[X_AXIS] + offset[0],
113 119
               first1 = position[Y_AXIS] + offset[1],
114 120
               second0 = target[X_AXIS] + offset[2],
115 121
               second1 = target[Y_AXIS] + offset[3];
116
-  float t = 0;
117 122
 
118 123
   float bez_target[4];
119 124
   bez_target[X_AXIS] = position[X_AXIS];
@@ -122,7 +127,7 @@ void cubic_b_spline(const float position[NUM_AXIS], const float target[NUM_AXIS]
122 127
 
123 128
   millis_t next_idle_ms = millis() + 200UL;
124 129
 
125
-  while (t < 1) {
130
+  for (float t = 0; t < 1;) {
126 131
 
127 132
     thermalManager.manage_heater();
128 133
     millis_t now = millis();
@@ -197,7 +202,7 @@ void cubic_b_spline(const float position[NUM_AXIS], const float target[NUM_AXIS]
197 202
       const float (&pos)[XYZE] = bez_target;
198 203
     #endif
199 204
 
200
-    if (!planner.buffer_line(pos, fr_mm_s, active_extruder, step))
205
+    if (!planner.buffer_line(pos, scaled_fr_mm_s, active_extruder, step))
201 206
       break;
202 207
   }
203 208
 }

+ 6
- 6
Marlin/src/module/planner_bezier.h ファイルの表示

@@ -32,9 +32,9 @@
32 32
 #include "../core/macros.h"
33 33
 
34 34
 void cubic_b_spline(
35
-              const float position[NUM_AXIS], // current position
36
-              const float target[NUM_AXIS],   // target position
37
-              const float offset[4],          // a pair of offsets
38
-              float fr_mm_s,
39
-              uint8_t extruder
40
-            );
35
+  const float position[NUM_AXIS],   // current position
36
+  const float target[NUM_AXIS],     // target position
37
+  const float (&offset)[4],         // a pair of offsets
38
+  const feedRate_t &scaled_fr_mm_s, // mm/s scaled by feedrate %
39
+  const uint8_t extruder
40
+);

+ 1
- 1
Marlin/src/module/probe.cpp ファイルの表示

@@ -446,7 +446,7 @@ bool set_probe_deployed(const bool deploy) {
446 446
   const char msg_wait_for_bed_heating[25] PROGMEM = "Wait for bed heating...\n";
447 447
 #endif
448 448
 
449
-static bool do_probe_move(const float z, const float fr_mm_s) {
449
+static bool do_probe_move(const float z, const feedRate_t fr_mm_s) {
450 450
   if (DEBUGGING(LEVELING)) DEBUG_POS(">>> do_probe_move", current_position);
451 451
 
452 452
   #if HAS_HEATED_BED && ENABLED(WAIT_FOR_BED_HEATER)

+ 6
- 6
Marlin/src/module/tool_change.h ファイルの表示

@@ -71,12 +71,12 @@
71 71
 #elif ENABLED(MAGNETIC_PARKING_EXTRUDER)
72 72
 
73 73
   typedef struct MPESettings {
74
-    float parking_xpos[2],      // M951 L R
75
-          grab_distance,        // M951 I
76
-          slow_feedrate,        // M951 J
77
-          fast_feedrate,        // M951 H
78
-          travel_distance,      // M951 D
79
-          compensation_factor;  // M951 C
74
+      float parking_xpos[2],      // M951 L R
75
+            grab_distance;        // M951 I
76
+ feedRate_t slow_feedrate,        // M951 J
77
+            fast_feedrate;        // M951 H
78
+      float travel_distance,      // M951 D
79
+            compensation_factor;  // M951 C
80 80
   } mpe_settings_t;
81 81
 
82 82
   extern mpe_settings_t mpe_settings;

読み込み中…
キャンセル
保存