Browse Source

Improve G2 / G3 motion accuracy (#18144)

Eyal 4 years ago
parent
commit
815c8d2b55
No account linked to committer's email address
1 changed files with 5 additions and 4 deletions
  1. 5
    4
      Marlin/src/gcode/motion/G2_G3.cpp

+ 5
- 4
Marlin/src/gcode/motion/G2_G3.cpp View File

@@ -117,8 +117,8 @@ void plan_arc(
117 117
   uint16_t segments = FLOOR(mm_of_travel / seg_length);
118 118
   if (segments < min_segments) {            // Too few segments?
119 119
     segments = min_segments;                // More segments
120
-    seg_length = mm_of_travel / segments;   // but also shorter
121 120
   }
121
+  seg_length = mm_of_travel / segments;
122 122
 
123 123
   /**
124 124
    * Vector rotation by transformation matrix: r is the original vector, r_T is the rotated vector,
@@ -151,8 +151,9 @@ void plan_arc(
151 151
   const float theta_per_segment = angular_travel / segments,
152 152
               linear_per_segment = linear_travel / segments,
153 153
               extruder_per_segment = extruder_travel / segments,
154
-              sin_T = theta_per_segment,
155
-              cos_T = 1 - 0.5f * sq(theta_per_segment); // Small angle approximation
154
+              sq_theta_per_segment = sq(theta_per_segment),
155
+              sin_T = theta_per_segment - sq_theta_per_segment*theta_per_segment/6,
156
+              cos_T = 1 - 0.5f * sq_theta_per_segment; // Small angle approximation
156 157
 
157 158
   // Initialize the linear axis
158 159
   raw[l_axis] = current_position[l_axis];
@@ -218,7 +219,7 @@ void plan_arc(
218 219
       planner.apply_leveling(raw);
219 220
     #endif
220 221
 
221
-    if (!planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, seg_length
222
+    if (!planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, 0
222 223
       #if ENABLED(SCARA_FEEDRATE_SCALING)
223 224
         , inv_duration
224 225
       #endif

Loading…
Cancel
Save