瀏覽代碼

Skew should apply per-segment

Segmented moves can account for skew points off the edge, while long regular cartesian moves may be off if the skewed destination point is outside movement bounds.

Followup to #8729
Scott Lahteine 7 年之前
父節點
當前提交
eca1509cb2
共有 1 個文件被更改,包括 13 次插入18 次删除
  1. 13
    18
      Marlin/ubl_motion.cpp

+ 13
- 18
Marlin/ubl_motion.cpp 查看文件

@@ -411,12 +411,19 @@
411 411
     // We don't want additional apply_leveling() performed by regular buffer_line or buffer_line_kinematic,
412 412
     // so we call buffer_segment directly here.  Per-segmented leveling and kinematics performed first.
413 413
 
414
-    inline void _O2 ubl_buffer_segment_raw(const float (&raw)[XYZE], const float &fr) {
414
+    inline void _O2 ubl_buffer_segment_raw(const float (&in_raw)[XYZE], const float &fr) {
415
+
416
+      #if ENABLED(SKEW_CORRECTION)
417
+        float raw[XYZE] = { in_raw[X_AXIS], in_raw[Y_AXIS], in_raw[Z_AXIS], in_raw[E_AXIS] };
418
+        planner.skew(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS]);
419
+      #else
420
+        const float (&raw)[XYZE] = in_raw;
421
+      #endif
415 422
 
416 423
       #if ENABLED(DELTA)  // apply delta inverse_kinematics
417 424
 
418 425
         DELTA_RAW_IK();
419
-        planner.buffer_segment(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], raw[E_AXIS], fr, active_extruder);
426
+        planner.buffer_segment(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], in_raw[E_AXIS], fr, active_extruder);
420 427
 
421 428
       #elif IS_SCARA  // apply scara inverse_kinematics (should be changed to save raw->logical->raw)
422 429
 
@@ -429,11 +436,11 @@
429 436
         scara_oldB = delta[B_AXIS];
430 437
         float s_feedrate = max(adiff, bdiff) * scara_feed_factor;
431 438
 
432
-        planner.buffer_segment(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], raw[E_AXIS], s_feedrate, active_extruder);
439
+        planner.buffer_segment(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], in_raw[E_AXIS], s_feedrate, active_extruder);
433 440
 
434 441
       #else // CARTESIAN
435 442
 
436
-        planner.buffer_segment(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS], raw[E_AXIS], fr, active_extruder);
443
+        planner.buffer_segment(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS], in_raw[E_AXIS], fr, active_extruder);
437 444
 
438 445
       #endif
439 446
     }
@@ -456,19 +463,11 @@
456 463
      * Returns true if did NOT move, false if moved (requires current_position update).
457 464
      */
458 465
 
459
-    bool _O2 unified_bed_leveling::prepare_segmented_line_to(const float (&in_target)[XYZE], const float &feedrate) {
466
+    bool _O2 unified_bed_leveling::prepare_segmented_line_to(const float (&rtarget)[XYZE], const float &feedrate) {
460 467
 
461
-      if (!position_is_reachable(in_target[X_AXIS], in_target[Y_AXIS]))  // fail if moving outside reachable boundary
468
+      if (!position_is_reachable(rtarget[X_AXIS], rtarget[Y_AXIS]))  // fail if moving outside reachable boundary
462 469
         return true; // did not move, so current_position still accurate
463 470
 
464
-      #if ENABLED(SKEW_CORRECTION)
465
-        // For skew correction just adjust the destination point and we're done
466
-        float rtarget[XYZE] = { in_target[X_AXIS], in_target[Y_AXIS], in_target[Z_AXIS], in_target[E_AXIS] };
467
-        planner.skew(rtarget[X_AXIS], rtarget[Y_AXIS], rtarget[Z_AXIS]);
468
-      #else
469
-        const float (&rtarget)[XYZE] = in_target;
470
-      #endif
471
-
472 471
       const float total[XYZE] = {
473 472
         rtarget[X_AXIS] - current_position[X_AXIS],
474 473
         rtarget[Y_AXIS] - current_position[Y_AXIS],
@@ -513,10 +512,6 @@
513 512
         current_position[E_AXIS]
514 513
       };
515 514
 
516
-      #if ENABLED(SKEW_CORRECTION)
517
-        planner.skew(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS]);
518
-      #endif
519
-
520 515
       // Only compute leveling per segment if ubl active and target below z_fade_height.
521 516
       if (!planner.leveling_active || !planner.leveling_active_at_z(rtarget[Z_AXIS])) {   // no mesh leveling
522 517
         while (--segments) {

Loading…
取消
儲存