Procházet zdrojové kódy

Apply const to some planner vars

Scott Lahteine před 7 roky
rodič
revize
23e45fa3c4
1 změnil soubory, kde provedl 6 přidání a 6 odebrání
  1. 6
    6
      Marlin/src/module/planner.cpp

+ 6
- 6
Marlin/src/module/planner.cpp Zobrazit soubor

@@ -1316,8 +1316,8 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
1316 1316
     // then the machine is not coasting anymore and the safe entry / exit velocities shall be used.
1317 1317
 
1318 1318
     // The junction velocity will be shared between successive segments. Limit the junction velocity to their minimum.
1319
-    bool prev_speed_larger = previous_nominal_speed > block->nominal_speed;
1320
-    float smaller_speed_factor = prev_speed_larger ? (block->nominal_speed / previous_nominal_speed) : (previous_nominal_speed / block->nominal_speed);
1319
+    const bool prev_speed_larger = previous_nominal_speed > block->nominal_speed;
1320
+    const float smaller_speed_factor = prev_speed_larger ? (block->nominal_speed / previous_nominal_speed) : (previous_nominal_speed / block->nominal_speed);
1321 1321
     // Pick the smaller of the nominal speeds. Higher speed shall not be achieved at the junction during coasting.
1322 1322
     vmax_junction = prev_speed_larger ? block->nominal_speed : previous_nominal_speed;
1323 1323
     // Factor to multiply the previous / current nominal velocities to get componentwise limited velocities.
@@ -1449,10 +1449,10 @@ void Planner::_set_position_mm(const float &a, const float &b, const float &c, c
1449 1449
   #else
1450 1450
     #define _EINDEX E_AXIS
1451 1451
   #endif
1452
-  long na = position[X_AXIS] = LROUND(a * axis_steps_per_mm[X_AXIS]),
1453
-       nb = position[Y_AXIS] = LROUND(b * axis_steps_per_mm[Y_AXIS]),
1454
-       nc = position[Z_AXIS] = LROUND(c * axis_steps_per_mm[Z_AXIS]),
1455
-       ne = position[E_AXIS] = LROUND(e * axis_steps_per_mm[_EINDEX]);
1452
+  const long na = position[X_AXIS] = LROUND(a * axis_steps_per_mm[X_AXIS]),
1453
+             nb = position[Y_AXIS] = LROUND(b * axis_steps_per_mm[Y_AXIS]),
1454
+             nc = position[Z_AXIS] = LROUND(c * axis_steps_per_mm[Z_AXIS]),
1455
+             ne = position[E_AXIS] = LROUND(e * axis_steps_per_mm[_EINDEX]);
1456 1456
   #if ENABLED(LIN_ADVANCE)
1457 1457
     position_float[X_AXIS] = a;
1458 1458
     position_float[Y_AXIS] = b;

Loading…
Zrušit
Uložit