瀏覽代碼

Use COPY_XYZE macro to copy exactly 4 elements (#6758)

Fix undefined DELTA_PROBEABLE_RADIUS for UBL_DELTA
oldmcg 8 年之前
父節點
當前提交
5a9e52a3e0
共有 2 個文件被更改,包括 17 次插入6 次删除
  1. 5
    2
      Marlin/Conditionals_post.h
  2. 12
    4
      Marlin/ubl_motion.cpp

+ 5
- 2
Marlin/Conditionals_post.h 查看文件

@@ -818,7 +818,7 @@
818 818
   #endif
819 819
 
820 820
   /**
821
-   * DELTA_SEGMENT_MIN_LENGTH for UBL_DELTA
821
+   * DELTA_SEGMENT_MIN_LENGTH and DELTA_PROBEABLE_RADIUS for UBL_DELTA
822 822
    */
823 823
   #if UBL_DELTA
824 824
     #ifndef DELTA_SEGMENT_MIN_LENGTH
@@ -830,8 +830,11 @@
830 830
         #define DELTA_SEGMENT_MIN_LENGTH 1.00 // mm (similar to G2/G3 arc segmentation)
831 831
       #endif
832 832
     #endif
833
+    #ifndef DELTA_PROBEABLE_RADIUS
834
+      #define DELTA_PROBEABLE_RADIUS DELTA_PRINTABLE_RADIUS
835
+    #endif
833 836
   #endif
834
-
837
+    
835 838
   // Shorthand
836 839
   #define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y))
837 840
 

+ 12
- 4
Marlin/ubl_motion.cpp 查看文件

@@ -457,6 +457,14 @@
457 457
 
458 458
   #if UBL_DELTA
459 459
 
460
+    // macro to inline copy exactly 4 floats, don't rely on sizeof operator
461
+    #define COPY_XYZE( target, source ) { \
462
+                target[X_AXIS] = source[X_AXIS]; \
463
+                target[Y_AXIS] = source[Y_AXIS]; \
464
+                target[Z_AXIS] = source[Z_AXIS]; \
465
+                target[E_AXIS] = source[E_AXIS]; \
466
+            }
467
+
460 468
     #if IS_SCARA // scale the feed rate from mm/s to degrees/s
461 469
       static float scara_feed_factor, scara_oldA, scara_oldB;
462 470
     #endif
@@ -550,8 +558,8 @@
550 558
 
551 559
         const float z_offset = ubl.state.active ? ubl.state.z_offset : 0.0;
552 560
 
553
-        float seg_dest[XYZE];              // per-segment destination,
554
-        COPY(seg_dest, current_position);  // starting from current position
561
+        float seg_dest[XYZE];                   // per-segment destination,
562
+        COPY_XYZE(seg_dest, current_position);  // starting from current position
555 563
 
556 564
         while (--segments) {
557 565
           LOOP_XYZE(i) seg_dest[i] += segment_distance[i];
@@ -562,7 +570,7 @@
562 570
         }
563 571
 
564 572
         // Since repeated adding segment_distance accumulates small errors, final move to exact destination.
565
-        COPY(seg_dest, ltarget);
573
+        COPY_XYZE(seg_dest, ltarget);
566 574
         seg_dest[Z_AXIS] += z_offset;
567 575
         ubl_buffer_line_segment(seg_dest, feedrate, active_extruder);
568 576
         return false; // moved but did not set_current_to_destination();
@@ -645,7 +653,7 @@
645 653
           z_cxcy += ubl.state.z_offset;             // add fixed mesh offset from G29 Z
646 654
 
647 655
           if (--segments == 0) {                    // if this is last segment, use ltarget for exact
648
-            COPY(seg_dest, ltarget);
656
+            COPY_XYZE(seg_dest, ltarget);
649 657
             seg_dest[Z_AXIS] += z_cxcy;
650 658
             ubl_buffer_line_segment(seg_dest, feedrate, active_extruder);
651 659
             return false;   // did not set_current_to_destination()

Loading…
取消
儲存