ソースを参照

Add UBL support for G2/G3 and G5 (#10648)

Scott Lahteine 7年前
コミット
19f189b4e5
コミッターのメールアドレスに関連付けられたアカウントが存在しません

+ 8
- 0
Marlin/src/gcode/motion/G2_G3.cpp ファイルの表示

199
       ADJUST_DELTA(raw);
199
       ADJUST_DELTA(raw);
200
       planner.buffer_segment(delta[A_AXIS], delta[B_AXIS], raw[Z_AXIS], raw[E_AXIS], HYPOT(delta[A_AXIS] - oldA, delta[B_AXIS] - oldB) * inverse_secs, active_extruder);
200
       planner.buffer_segment(delta[A_AXIS], delta[B_AXIS], raw[Z_AXIS], raw[E_AXIS], HYPOT(delta[A_AXIS] - oldA, delta[B_AXIS] - oldB) * inverse_secs, active_extruder);
201
       oldA = delta[A_AXIS]; oldB = delta[B_AXIS];
201
       oldA = delta[A_AXIS]; oldB = delta[B_AXIS];
202
+    #elif HAS_UBL_AND_CURVES
203
+      float pos[XYZ] = { raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS] };
204
+      planner.apply_leveling(pos);
205
+      planner.buffer_segment(pos[X_AXIS], pos[Y_AXIS], pos[Z_AXIS], raw[E_AXIS], fr_mm_s, active_extruder);
202
     #else
206
     #else
203
       planner.buffer_line_kinematic(raw, fr_mm_s, active_extruder);
207
       planner.buffer_line_kinematic(raw, fr_mm_s, active_extruder);
204
     #endif
208
     #endif
211
     const float diff2 = HYPOT2(delta[A_AXIS] - oldA, delta[B_AXIS] - oldB);
215
     const float diff2 = HYPOT2(delta[A_AXIS] - oldA, delta[B_AXIS] - oldB);
212
     if (diff2)
216
     if (diff2)
213
       planner.buffer_segment(delta[A_AXIS], delta[B_AXIS], cart[Z_AXIS], cart[E_AXIS], SQRT(diff2) * inverse_secs, active_extruder);
217
       planner.buffer_segment(delta[A_AXIS], delta[B_AXIS], cart[Z_AXIS], cart[E_AXIS], SQRT(diff2) * inverse_secs, active_extruder);
218
+  #elif HAS_UBL_AND_CURVES
219
+    float pos[XYZ] = { cart[X_AXIS], cart[Y_AXIS], cart[Z_AXIS] };
220
+    planner.apply_leveling(pos);
221
+    planner.buffer_segment(pos[X_AXIS], pos[Y_AXIS], pos[Z_AXIS], cart[E_AXIS], fr_mm_s, active_extruder);
214
   #else
222
   #else
215
     planner.buffer_line_kinematic(cart, fr_mm_s, active_extruder);
223
     planner.buffer_line_kinematic(cart, fr_mm_s, active_extruder);
216
   #endif
224
   #endif

+ 1
- 0
Marlin/src/inc/Conditionals_post.h ファイルの表示

1058
 #define HAS_MESH       (ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(MESH_BED_LEVELING))
1058
 #define HAS_MESH       (ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(MESH_BED_LEVELING))
1059
 #define PLANNER_LEVELING      (OLDSCHOOL_ABL || ENABLED(MESH_BED_LEVELING) || UBL_SEGMENTED || ENABLED(SKEW_CORRECTION))
1059
 #define PLANNER_LEVELING      (OLDSCHOOL_ABL || ENABLED(MESH_BED_LEVELING) || UBL_SEGMENTED || ENABLED(SKEW_CORRECTION))
1060
 #define HAS_PROBING_PROCEDURE (HAS_ABL || ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST))
1060
 #define HAS_PROBING_PROCEDURE (HAS_ABL || ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST))
1061
+#define HAS_UBL_AND_CURVES (ENABLED(AUTO_BED_LEVELING_UBL) && !PLANNER_LEVELING && (ENABLED(ARC_SUPPORT) || ENABLED(BEZIER_CURVE_SUPPORT)))
1061
 
1062
 
1062
 #if ENABLED(AUTO_BED_LEVELING_UBL)
1063
 #if ENABLED(AUTO_BED_LEVELING_UBL)
1063
   #undef LCD_BED_LEVELING
1064
   #undef LCD_BED_LEVELING

+ 5
- 1
Marlin/src/module/planner.cpp ファイルの表示

1190
   }
1190
   }
1191
 #endif
1191
 #endif
1192
 
1192
 
1193
-#if PLANNER_LEVELING
1193
+#if PLANNER_LEVELING || HAS_UBL_AND_CURVES
1194
   /**
1194
   /**
1195
    * rx, ry, rz - Cartesian positions in mm
1195
    * rx, ry, rz - Cartesian positions in mm
1196
    *              Leveled XYZ on completion
1196
    *              Leveled XYZ on completion
1242
     #endif
1242
     #endif
1243
   }
1243
   }
1244
 
1244
 
1245
+#endif
1246
+
1247
+#if PLANNER_LEVELING
1248
+
1245
   void Planner::unapply_leveling(float raw[XYZ]) {
1249
   void Planner::unapply_leveling(float raw[XYZ]) {
1246
 
1250
 
1247
     if (leveling_active) {
1251
     if (leveling_active) {

+ 12
- 7
Marlin/src/module/planner.h ファイルの表示

404
 
404
 
405
     #endif // SKEW_CORRECTION
405
     #endif // SKEW_CORRECTION
406
 
406
 
407
-    #if PLANNER_LEVELING
408
-
409
-      #define ARG_X float rx
410
-      #define ARG_Y float ry
411
-      #define ARG_Z float rz
407
+    #if PLANNER_LEVELING || HAS_UBL_AND_CURVES
412
 
408
 
413
       /**
409
       /**
414
        * Apply leveling to transform a cartesian position
410
        * Apply leveling to transform a cartesian position
415
        * as it will be given to the planner and steppers.
411
        * as it will be given to the planner and steppers.
416
        */
412
        */
417
       static void apply_leveling(float &rx, float &ry, float &rz);
413
       static void apply_leveling(float &rx, float &ry, float &rz);
418
-      static void apply_leveling(float (&raw)[XYZ]) { apply_leveling(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS]); }
419
-      static void unapply_leveling(float raw[XYZ]);
414
+      FORCE_INLINE static void apply_leveling(float (&raw)[XYZ]) { apply_leveling(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS]); }
415
+
416
+      #if PLANNER_LEVELING
417
+
418
+        #define ARG_X float rx
419
+        #define ARG_Y float ry
420
+        #define ARG_Z float rz
421
+
422
+        static void unapply_leveling(float raw[XYZ]);
423
+
424
+      #endif
420
 
425
 
421
     #else
426
     #else
422
 
427
 

+ 8
- 1
Marlin/src/module/planner_bezier.cpp ファイルの表示

190
     bez_target[Z_AXIS] = interp(position[Z_AXIS], target[Z_AXIS], t);
190
     bez_target[Z_AXIS] = interp(position[Z_AXIS], target[Z_AXIS], t);
191
     bez_target[E_AXIS] = interp(position[E_AXIS], target[E_AXIS], t);
191
     bez_target[E_AXIS] = interp(position[E_AXIS], target[E_AXIS], t);
192
     clamp_to_software_endstops(bez_target);
192
     clamp_to_software_endstops(bez_target);
193
-    planner.buffer_line_kinematic(bez_target, fr_mm_s, extruder);
193
+
194
+    #if HAS_UBL_AND_CURVES
195
+      float pos[XYZ] = { bez_target[X_AXIS], bez_target[Y_AXIS], bez_target[Z_AXIS] };
196
+      planner.apply_leveling(pos);
197
+      planner.buffer_segment(pos[X_AXIS], pos[Y_AXIS], pos[Z_AXIS], bez_target[E_AXIS], fr_mm_s, active_extruder);
198
+    #else
199
+      planner.buffer_line_kinematic(bez_target, fr_mm_s, extruder);
200
+    #endif
194
   }
201
   }
195
 }
202
 }
196
 
203
 

読み込み中…
キャンセル
保存