Browse Source

const float ref args in planner.h

Scott Lahteine 8 years ago
parent
commit
8e787304c9
1 changed files with 8 additions and 8 deletions
  1. 8
    8
      Marlin/planner.h

+ 8
- 8
Marlin/planner.h View File

264
      *  fr_mm_s      - (target) speed of the move (mm/s)
264
      *  fr_mm_s      - (target) speed of the move (mm/s)
265
      *  extruder     - target extruder
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
       #if PLANNER_LEVELING && IS_CARTESIAN
268
       #if PLANNER_LEVELING && IS_CARTESIAN
269
         apply_leveling(lx, ly, lz);
269
         apply_leveling(lx, ly, lz);
270
       #endif
270
       #endif
280
      *  fr_mm_s  - (target) speed of the move (mm/s)
280
      *  fr_mm_s  - (target) speed of the move (mm/s)
281
      *  extruder - target extruder
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
       #if PLANNER_LEVELING
284
       #if PLANNER_LEVELING
285
         float pos[XYZ] = { target[X_AXIS], target[Y_AXIS], target[Z_AXIS] };
285
         float pos[XYZ] = { target[X_AXIS], target[Y_AXIS], target[Z_AXIS] };
286
         apply_leveling(pos);
286
         apply_leveling(pos);
311
       _set_position_mm(lx, ly, lz, e);
311
       _set_position_mm(lx, ly, lz, e);
312
     }
312
     }
313
     static void set_position_mm_kinematic(const float position[NUM_AXIS]);
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
      * Sync from the stepper positions. (e.g., after an interrupted move)
319
      * Sync from the stepper positions. (e.g., after an interrupted move)
369
      * Calculate the distance (not time) it takes to accelerate
369
      * Calculate the distance (not time) it takes to accelerate
370
      * from initial_rate to target_rate using the given acceleration:
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
       if (accel == 0) return 0; // accel was 0, set acceleration distance to 0
373
       if (accel == 0) return 0; // accel was 0, set acceleration distance to 0
374
       return (sq(target_rate) - sq(initial_rate)) / (accel * 2);
374
       return (sq(target_rate) - sq(initial_rate)) / (accel * 2);
375
     }
375
     }
382
      * This is used to compute the intersection point between acceleration and deceleration
382
      * This is used to compute the intersection point between acceleration and deceleration
383
      * in cases where the "trapezoid" has no plateau (i.e., never reaches maximum speed)
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
       if (accel == 0) return 0; // accel was 0, set intersection distance to 0
386
       if (accel == 0) return 0; // accel was 0, set intersection distance to 0
387
       return (accel * 2 * distance - sq(initial_rate) + sq(final_rate)) / (accel * 4);
387
       return (accel * 2 * distance - sq(initial_rate) + sq(final_rate)) / (accel * 4);
388
     }
388
     }
392
      * to reach 'target_velocity' using 'acceleration' within a given
392
      * to reach 'target_velocity' using 'acceleration' within a given
393
      * 'distance'.
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
       return sqrt(sq(target_velocity) - 2 * accel * distance);
396
       return sqrt(sq(target_velocity) - 2 * accel * distance);
397
     }
397
     }
398
 
398
 

Loading…
Cancel
Save