Browse Source

Use memcpy/memset in planner

pull/1/head
Scott Lahteine 8 years ago
parent
commit
0427f3cc3b
  1. 12
      Marlin/planner.cpp

12
Marlin/planner.cpp

@ -135,8 +135,8 @@ Planner::Planner() { init(); }
void Planner::init() {
block_buffer_head = block_buffer_tail = 0;
memset(position, 0, sizeof(position)); // clear position
LOOP_XYZE(i) previous_speed[i] = 0.0;
memset(position, 0, sizeof(position));
memset(previous_speed, 0, sizeof(previous_speed));
previous_nominal_speed = 0.0;
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
bed_level_matrix.set_to_identity();
@ -1134,7 +1134,7 @@ void Planner::buffer_line(ARG_X, ARG_Y, ARG_Z, const float &e, float fr_mm_s, co
block->recalculate_flag = true; // Always calculate trapezoid for new block
// Update previous path unit_vector and nominal speed
LOOP_XYZE(i) previous_speed[i] = current_speed[i];
memcpy(previous_speed, current_speed, sizeof(previous_speed));
previous_nominal_speed = block->nominal_speed;
#if ENABLED(LIN_ADVANCE)
@ -1180,8 +1180,8 @@ void Planner::buffer_line(ARG_X, ARG_Y, ARG_Z, const float &e, float fr_mm_s, co
// Move buffer head
block_buffer_head = next_buffer_head;
// Update position
LOOP_XYZE(i) position[i] = target[i];
// Update the position (only when a move was queued)
memcpy(position, target, sizeof(position));
recalculate();
@ -1207,7 +1207,7 @@ void Planner::set_position_mm(ARG_X, ARG_Y, ARG_Z, const float &e) {
stepper.set_position(nx, ny, nz, ne);
previous_nominal_speed = 0.0; // Resets planner junction speeds. Assumes start from rest.
LOOP_XYZE(i) previous_speed[i] = 0.0;
memset(previous_speed, 0, sizeof(previous_speed));
}
/**

Loading…
Cancel
Save