|
@@ -63,9 +63,9 @@ void mc_arc(float* position, float* target, float* offset, float feed_rate, floa
|
|
|
{
|
|
|
|
|
|
|
|
|
- mm_per_arc_segment = cs.min_mm_per_arc_segment;
|
|
|
+ mm_per_arc_segment = cs.min_mm_per_arc_segment;
|
|
|
}
|
|
|
- else if (mm_per_arc_segment > cs.mm_per_arc_segment){
|
|
|
+ else if (mm_per_arc_segment > cs.mm_per_arc_segment) {
|
|
|
|
|
|
|
|
|
mm_per_arc_segment = cs.mm_per_arc_segment;
|
|
@@ -86,7 +86,7 @@ void mc_arc(float* position, float* target, float* offset, float feed_rate, floa
|
|
|
|
|
|
const float millimeters_of_travel_arc = hypot(angular_travel_total * radius, fabs(travel_z));
|
|
|
if (millimeters_of_travel_arc < 0.001) { return; }
|
|
|
-
|
|
|
+
|
|
|
|
|
|
uint16_t segments = static_cast<uint16_t>(ceil(millimeters_of_travel_arc / mm_per_arc_segment));
|
|
|
|
|
@@ -115,17 +115,18 @@ void mc_arc(float* position, float* target, float* offset, float feed_rate, floa
|
|
|
|
|
|
if (segments > 1)
|
|
|
{
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
const float theta_per_segment = angular_travel_total / segments,
|
|
|
- linear_per_segment = travel_z / (segments),
|
|
|
- segment_extruder_travel = (target[E_AXIS] - position[E_AXIS]) / (segments),
|
|
|
- sq_theta_per_segment = theta_per_segment * theta_per_segment,
|
|
|
- sin_T = theta_per_segment - sq_theta_per_segment * theta_per_segment / 6,
|
|
|
- cos_T = 1 - 0.5f * sq_theta_per_segment;
|
|
|
-
|
|
|
- for (uint16_t i = 1; i < segments; i++) {
|
|
|
- if (n_arc_correction--<1) {
|
|
|
+ linear_per_segment = travel_z / (segments),
|
|
|
+ segment_extruder_travel = (target[E_AXIS] - position[E_AXIS]) / (segments),
|
|
|
+ sq_theta_per_segment = theta_per_segment * theta_per_segment,
|
|
|
+ sin_T = theta_per_segment - sq_theta_per_segment * theta_per_segment / 6,
|
|
|
+ cos_T = 1 - 0.5f * sq_theta_per_segment;
|
|
|
+
|
|
|
+
|
|
|
+ for (uint16_t i = 1; i < segments; i++) {
|
|
|
+ if (n_arc_correction-- == 0) {
|
|
|
|
|
|
const float cos_Ti = cos(i * theta_per_segment), sin_Ti = sin(i * theta_per_segment);
|
|
|
r_axis_x = -offset[X_AXIS] * cos_Ti + offset[Y_AXIS] * sin_Ti;
|
|
@@ -134,24 +135,25 @@ void mc_arc(float* position, float* target, float* offset, float feed_rate, floa
|
|
|
n_arc_correction = cs.n_arc_correction;
|
|
|
}
|
|
|
else {
|
|
|
+
|
|
|
const float r_axisi = r_axis_x * sin_T + r_axis_y * cos_T;
|
|
|
r_axis_x = r_axis_x * cos_T - r_axis_y * sin_T;
|
|
|
r_axis_y = r_axisi;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
position[X_AXIS] = center_axis_x + r_axis_x;
|
|
|
position[Y_AXIS] = center_axis_y + r_axis_y;
|
|
|
position[Z_AXIS] += linear_per_segment;
|
|
|
position[E_AXIS] += segment_extruder_travel;
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
clamp_to_software_endstops(position);
|
|
|
- plan_buffer_line(position[X_AXIS], position[Y_AXIS], position[Z_AXIS], position[E_AXIS], feed_rate, extruder);
|
|
|
+
|
|
|
+ plan_buffer_line(position[X_AXIS], position[Y_AXIS], position[Z_AXIS], position[E_AXIS], feed_rate, extruder, position);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
clamp_to_software_endstops(target);
|
|
|
- plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feed_rate, extruder);
|
|
|
+
|
|
|
+ plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feed_rate, extruder, target);
|
|
|
}
|