瀏覽代碼

const float ref args in planner.h

Scott Lahteine 8 年之前
父節點
當前提交
8e787304c9
共有 1 個檔案被更改,包括 8 行新增8 行删除
  1. 8
    8
      Marlin/planner.h

+ 8
- 8
Marlin/planner.h 查看文件

@@ -264,7 +264,7 @@ class Planner {
264 264
      *  fr_mm_s      - (target) speed of the move (mm/s)
265 265
      *  extruder     - target extruder
266 266
      */
267
-    static FORCE_INLINE void buffer_line(ARG_X, ARG_Y, ARG_Z, const float &e, float fr_mm_s, const uint8_t extruder) {
267
+    static FORCE_INLINE void buffer_line(ARG_X, ARG_Y, ARG_Z, const float &e, const float &fr_mm_s, const uint8_t extruder) {
268 268
       #if PLANNER_LEVELING && IS_CARTESIAN
269 269
         apply_leveling(lx, ly, lz);
270 270
       #endif
@@ -280,7 +280,7 @@ class Planner {
280 280
      *  fr_mm_s  - (target) speed of the move (mm/s)
281 281
      *  extruder - target extruder
282 282
      */
283
-    static FORCE_INLINE void buffer_line_kinematic(const float target[XYZE], float fr_mm_s, const uint8_t extruder) {
283
+    static FORCE_INLINE void buffer_line_kinematic(const float target[XYZE], const float &fr_mm_s, const uint8_t extruder) {
284 284
       #if PLANNER_LEVELING
285 285
         float pos[XYZ] = { target[X_AXIS], target[Y_AXIS], target[Z_AXIS] };
286 286
         apply_leveling(pos);
@@ -311,9 +311,9 @@ class Planner {
311 311
       _set_position_mm(lx, ly, lz, e);
312 312
     }
313 313
     static void set_position_mm_kinematic(const float position[NUM_AXIS]);
314
-    static void set_position_mm(const AxisEnum axis, const float& v);
315
-    static FORCE_INLINE void set_z_position_mm(const float& z) { set_position_mm(Z_AXIS, z); }
316
-    static FORCE_INLINE void set_e_position_mm(const float& e) { set_position_mm(E_AXIS, e); }
314
+    static void set_position_mm(const AxisEnum axis, const float &v);
315
+    static FORCE_INLINE void set_z_position_mm(const float &z) { set_position_mm(Z_AXIS, z); }
316
+    static FORCE_INLINE void set_e_position_mm(const float &e) { set_position_mm(E_AXIS, e); }
317 317
 
318 318
     /**
319 319
      * Sync from the stepper positions. (e.g., after an interrupted move)
@@ -369,7 +369,7 @@ class Planner {
369 369
      * Calculate the distance (not time) it takes to accelerate
370 370
      * from initial_rate to target_rate using the given acceleration:
371 371
      */
372
-    static float estimate_acceleration_distance(float initial_rate, float target_rate, float accel) {
372
+    static float estimate_acceleration_distance(const float &initial_rate, const float &target_rate, const float &accel) {
373 373
       if (accel == 0) return 0; // accel was 0, set acceleration distance to 0
374 374
       return (sq(target_rate) - sq(initial_rate)) / (accel * 2);
375 375
     }
@@ -382,7 +382,7 @@ class Planner {
382 382
      * This is used to compute the intersection point between acceleration and deceleration
383 383
      * in cases where the "trapezoid" has no plateau (i.e., never reaches maximum speed)
384 384
      */
385
-    static float intersection_distance(float initial_rate, float final_rate, float accel, float distance) {
385
+    static float intersection_distance(const float &initial_rate, const float &final_rate, const float &accel, const float &distance) {
386 386
       if (accel == 0) return 0; // accel was 0, set intersection distance to 0
387 387
       return (accel * 2 * distance - sq(initial_rate) + sq(final_rate)) / (accel * 4);
388 388
     }
@@ -392,7 +392,7 @@ class Planner {
392 392
      * to reach 'target_velocity' using 'acceleration' within a given
393 393
      * 'distance'.
394 394
      */
395
-    static float max_allowable_speed(float accel, float target_velocity, float distance) {
395
+    static float max_allowable_speed(const float &accel, const float &target_velocity, const float &distance) {
396 396
       return sqrt(sq(target_velocity) - 2 * accel * distance);
397 397
     }
398 398
 

Loading…
取消
儲存