Use memcpy/memset in planner

master
Scott Lahteine 8 years ago
parent 6b9bf8e8fe
commit 0427f3cc3b

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