Browse Source

Apply const to some planner vars

pull/1/head
Scott Lahteine 7 years ago
parent
commit
23e45fa3c4
  1. 12
      Marlin/src/module/planner.cpp

12
Marlin/src/module/planner.cpp

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

Loading…
Cancel
Save