Scott Lahteine 7 лет назад
Родитель
Сommit
d568e586b7
1 измененных файлов: 180 добавлений и 180 удалений
  1. 180
    180
      Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp

+ 180
- 180
Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp Просмотреть файл

@@ -23,23 +23,23 @@
23 23
 
24 24
 #if ENABLED(AUTO_BED_LEVELING_UBL)
25 25
 
26
-  #include "../bedlevel.h"
27
-  #include "../../../module/planner.h"
28
-  #include "../../../module/stepper.h"
29
-  #include "../../../module/motion.h"
26
+#include "../bedlevel.h"
27
+#include "../../../module/planner.h"
28
+#include "../../../module/stepper.h"
29
+#include "../../../module/motion.h"
30 30
 
31
-  #if ENABLED(DELTA)
32
-    #include "../../../module/delta.h"
33
-  #endif
31
+#if ENABLED(DELTA)
32
+  #include "../../../module/delta.h"
33
+#endif
34 34
 
35
-  #include "../../../Marlin.h"
36
-  #include <math.h>
35
+#include "../../../Marlin.h"
36
+#include <math.h>
37 37
 
38
-  #if AVR_AT90USB1286_FAMILY  // Teensyduino & Printrboard IDE extensions have compile errors without this
39
-    inline void set_current_from_destination() { COPY(current_position, destination); }
40
-  #else
41
-    extern void set_current_from_destination();
42
-  #endif
38
+#if AVR_AT90USB1286_FAMILY  // Teensyduino & Printrboard IDE extensions have compile errors without this
39
+  inline void set_current_from_destination() { COPY(current_position, destination); }
40
+#else
41
+  extern void set_current_from_destination();
42
+#endif
43 43
 
44 44
 #if !UBL_SEGMENTED
45 45
 
@@ -409,219 +409,219 @@
409 409
 
410 410
 #else // UBL_SEGMENTED
411 411
 
412
-    #if IS_SCARA // scale the feed rate from mm/s to degrees/s
413
-      static float scara_feed_factor, scara_oldA, scara_oldB;
412
+  #if IS_SCARA // scale the feed rate from mm/s to degrees/s
413
+    static float scara_feed_factor, scara_oldA, scara_oldB;
414
+  #endif
415
+
416
+  // We don't want additional apply_leveling() performed by regular buffer_line or buffer_line_kinematic,
417
+  // so we call buffer_segment directly here.  Per-segmented leveling and kinematics performed first.
418
+
419
+  inline void _O2 ubl_buffer_segment_raw(const float (&in_raw)[XYZE], const float &fr) {
420
+
421
+    #if ENABLED(SKEW_CORRECTION)
422
+      float raw[XYZE] = { in_raw[X_AXIS], in_raw[Y_AXIS], in_raw[Z_AXIS] };
423
+      planner.skew(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS]);
424
+    #else
425
+      const float (&raw)[XYZE] = in_raw;
414 426
     #endif
415 427
 
416
-    // We don't want additional apply_leveling() performed by regular buffer_line or buffer_line_kinematic,
417
-    // so we call buffer_segment directly here.  Per-segmented leveling and kinematics performed first.
428
+    #if ENABLED(DELTA)  // apply delta inverse_kinematics
418 429
 
419
-    inline void _O2 ubl_buffer_segment_raw(const float (&in_raw)[XYZE], const float &fr) {
430
+      DELTA_RAW_IK();
431
+      planner.buffer_segment(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], in_raw[E_AXIS], fr, active_extruder);
420 432
 
421
-      #if ENABLED(SKEW_CORRECTION)
422
-        float raw[XYZE] = { in_raw[X_AXIS], in_raw[Y_AXIS], in_raw[Z_AXIS] };
423
-        planner.skew(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS]);
424
-      #else
425
-        const float (&raw)[XYZE] = in_raw;
426
-      #endif
433
+    #elif IS_SCARA  // apply scara inverse_kinematics (should be changed to save raw->logical->raw)
427 434
 
428
-      #if ENABLED(DELTA)  // apply delta inverse_kinematics
435
+      inverse_kinematics(raw);  // this writes delta[ABC] from raw[XYZE]
436
+                                // should move the feedrate scaling to scara inverse_kinematics
429 437
 
430
-        DELTA_RAW_IK();
431
-        planner.buffer_segment(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], in_raw[E_AXIS], fr, active_extruder);
438
+      const float adiff = FABS(delta[A_AXIS] - scara_oldA),
439
+                  bdiff = FABS(delta[B_AXIS] - scara_oldB);
440
+      scara_oldA = delta[A_AXIS];
441
+      scara_oldB = delta[B_AXIS];
442
+      float s_feedrate = max(adiff, bdiff) * scara_feed_factor;
432 443
 
433
-      #elif IS_SCARA  // apply scara inverse_kinematics (should be changed to save raw->logical->raw)
444
+      planner.buffer_segment(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], in_raw[E_AXIS], s_feedrate, active_extruder);
434 445
 
435
-        inverse_kinematics(raw);  // this writes delta[ABC] from raw[XYZE]
436
-                                  // should move the feedrate scaling to scara inverse_kinematics
446
+    #else // CARTESIAN
437 447
 
438
-        const float adiff = FABS(delta[A_AXIS] - scara_oldA),
439
-                    bdiff = FABS(delta[B_AXIS] - scara_oldB);
440
-        scara_oldA = delta[A_AXIS];
441
-        scara_oldB = delta[B_AXIS];
442
-        float s_feedrate = max(adiff, bdiff) * scara_feed_factor;
448
+      planner.buffer_segment(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS], in_raw[E_AXIS], fr, active_extruder);
443 449
 
444
-        planner.buffer_segment(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], in_raw[E_AXIS], s_feedrate, active_extruder);
450
+    #endif
451
+  }
445 452
 
446
-      #else // CARTESIAN
453
+  #if IS_SCARA
454
+    #define DELTA_SEGMENT_MIN_LENGTH 0.25 // SCARA minimum segment size is 0.25mm
455
+  #elif ENABLED(DELTA)
456
+    #define DELTA_SEGMENT_MIN_LENGTH 0.10 // mm (still subject to DELTA_SEGMENTS_PER_SECOND)
457
+  #else // CARTESIAN
458
+    #ifdef LEVELED_SEGMENT_LENGTH
459
+      #define DELTA_SEGMENT_MIN_LENGTH LEVELED_SEGMENT_LENGTH
460
+    #else
461
+      #define DELTA_SEGMENT_MIN_LENGTH 1.00 // mm (similar to G2/G3 arc segmentation)
462
+    #endif
463
+  #endif
447 464
 
448
-        planner.buffer_segment(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS], in_raw[E_AXIS], fr, active_extruder);
465
+  /**
466
+   * Prepare a segmented linear move for DELTA/SCARA/CARTESIAN with UBL and FADE semantics.
467
+   * This calls planner.buffer_segment multiple times for small incremental moves.
468
+   * Returns true if did NOT move, false if moved (requires current_position update).
469
+   */
449 470
 
450
-      #endif
451
-    }
471
+  bool _O2 unified_bed_leveling::prepare_segmented_line_to(const float (&rtarget)[XYZE], const float &feedrate) {
452 472
 
453
-    #if IS_SCARA
454
-      #define DELTA_SEGMENT_MIN_LENGTH 0.25 // SCARA minimum segment size is 0.25mm
455
-    #elif ENABLED(DELTA)
456
-      #define DELTA_SEGMENT_MIN_LENGTH 0.10 // mm (still subject to DELTA_SEGMENTS_PER_SECOND)
457
-    #else // CARTESIAN
458
-      #ifdef LEVELED_SEGMENT_LENGTH
459
-        #define DELTA_SEGMENT_MIN_LENGTH LEVELED_SEGMENT_LENGTH
460
-      #else
461
-        #define DELTA_SEGMENT_MIN_LENGTH 1.00 // mm (similar to G2/G3 arc segmentation)
462
-      #endif
473
+    if (!position_is_reachable(rtarget[X_AXIS], rtarget[Y_AXIS]))  // fail if moving outside reachable boundary
474
+      return true; // did not move, so current_position still accurate
475
+
476
+    const float total[XYZE] = {
477
+      rtarget[X_AXIS] - current_position[X_AXIS],
478
+      rtarget[Y_AXIS] - current_position[Y_AXIS],
479
+      rtarget[Z_AXIS] - current_position[Z_AXIS],
480
+      rtarget[E_AXIS] - current_position[E_AXIS]
481
+    };
482
+
483
+    const float cartesian_xy_mm = HYPOT(total[X_AXIS], total[Y_AXIS]);  // total horizontal xy distance
484
+
485
+    #if IS_KINEMATIC
486
+      const float seconds = cartesian_xy_mm / feedrate;                                  // seconds to move xy distance at requested rate
487
+      uint16_t segments = lroundf(delta_segments_per_second * seconds),                  // preferred number of segments for distance @ feedrate
488
+               seglimit = lroundf(cartesian_xy_mm * (1.0 / (DELTA_SEGMENT_MIN_LENGTH))); // number of segments at minimum segment length
489
+      NOMORE(segments, seglimit);                                                        // limit to minimum segment length (fewer segments)
490
+    #else
491
+      uint16_t segments = lroundf(cartesian_xy_mm * (1.0 / (DELTA_SEGMENT_MIN_LENGTH))); // cartesian fixed segment length
463 492
     #endif
464 493
 
465
-    /**
466
-     * Prepare a segmented linear move for DELTA/SCARA/CARTESIAN with UBL and FADE semantics.
467
-     * This calls planner.buffer_segment multiple times for small incremental moves.
468
-     * Returns true if did NOT move, false if moved (requires current_position update).
469
-     */
494
+    NOLESS(segments, 1);                        // must have at least one segment
495
+    const float inv_segments = 1.0 / segments;  // divide once, multiply thereafter
470 496
 
471
-    bool _O2 unified_bed_leveling::prepare_segmented_line_to(const float (&rtarget)[XYZE], const float &feedrate) {
472
-
473
-      if (!position_is_reachable(rtarget[X_AXIS], rtarget[Y_AXIS]))  // fail if moving outside reachable boundary
474
-        return true; // did not move, so current_position still accurate
475
-
476
-      const float total[XYZE] = {
477
-        rtarget[X_AXIS] - current_position[X_AXIS],
478
-        rtarget[Y_AXIS] - current_position[Y_AXIS],
479
-        rtarget[Z_AXIS] - current_position[Z_AXIS],
480
-        rtarget[E_AXIS] - current_position[E_AXIS]
481
-      };
482
-
483
-      const float cartesian_xy_mm = HYPOT(total[X_AXIS], total[Y_AXIS]);  // total horizontal xy distance
484
-
485
-      #if IS_KINEMATIC
486
-        const float seconds = cartesian_xy_mm / feedrate;                                  // seconds to move xy distance at requested rate
487
-        uint16_t segments = lroundf(delta_segments_per_second * seconds),                  // preferred number of segments for distance @ feedrate
488
-                 seglimit = lroundf(cartesian_xy_mm * (1.0 / (DELTA_SEGMENT_MIN_LENGTH))); // number of segments at minimum segment length
489
-        NOMORE(segments, seglimit);                                                        // limit to minimum segment length (fewer segments)
490
-      #else
491
-        uint16_t segments = lroundf(cartesian_xy_mm * (1.0 / (DELTA_SEGMENT_MIN_LENGTH))); // cartesian fixed segment length
492
-      #endif
493
-
494
-      NOLESS(segments, 1);                        // must have at least one segment
495
-      const float inv_segments = 1.0 / segments;  // divide once, multiply thereafter
496
-
497
-      #if IS_SCARA // scale the feed rate from mm/s to degrees/s
498
-        scara_feed_factor = cartesian_xy_mm * inv_segments * feedrate;
499
-        scara_oldA = stepper.get_axis_position_degrees(A_AXIS);
500
-        scara_oldB = stepper.get_axis_position_degrees(B_AXIS);
501
-      #endif
502
-
503
-      const float diff[XYZE] = {
504
-        total[X_AXIS] * inv_segments,
505
-        total[Y_AXIS] * inv_segments,
506
-        total[Z_AXIS] * inv_segments,
507
-        total[E_AXIS] * inv_segments
508
-      };
509
-
510
-      // Note that E segment distance could vary slightly as z mesh height
511
-      // changes for each segment, but small enough to ignore.
512
-
513
-      float raw[XYZE] = {
514
-        current_position[X_AXIS],
515
-        current_position[Y_AXIS],
516
-        current_position[Z_AXIS],
517
-        current_position[E_AXIS]
518
-      };
519
-
520
-      // Only compute leveling per segment if ubl active and target below z_fade_height.
521
-      if (!planner.leveling_active || !planner.leveling_active_at_z(rtarget[Z_AXIS])) {   // no mesh leveling
522
-        while (--segments) {
523
-          LOOP_XYZE(i) raw[i] += diff[i];
524
-          ubl_buffer_segment_raw(raw, feedrate);
525
-        }
526
-        ubl_buffer_segment_raw(rtarget, feedrate);
527
-        return false; // moved but did not set_current_from_destination();
497
+    #if IS_SCARA // scale the feed rate from mm/s to degrees/s
498
+      scara_feed_factor = cartesian_xy_mm * inv_segments * feedrate;
499
+      scara_oldA = stepper.get_axis_position_degrees(A_AXIS);
500
+      scara_oldB = stepper.get_axis_position_degrees(B_AXIS);
501
+    #endif
502
+
503
+    const float diff[XYZE] = {
504
+      total[X_AXIS] * inv_segments,
505
+      total[Y_AXIS] * inv_segments,
506
+      total[Z_AXIS] * inv_segments,
507
+      total[E_AXIS] * inv_segments
508
+    };
509
+
510
+    // Note that E segment distance could vary slightly as z mesh height
511
+    // changes for each segment, but small enough to ignore.
512
+
513
+    float raw[XYZE] = {
514
+      current_position[X_AXIS],
515
+      current_position[Y_AXIS],
516
+      current_position[Z_AXIS],
517
+      current_position[E_AXIS]
518
+    };
519
+
520
+    // Only compute leveling per segment if ubl active and target below z_fade_height.
521
+    if (!planner.leveling_active || !planner.leveling_active_at_z(rtarget[Z_AXIS])) {   // no mesh leveling
522
+      while (--segments) {
523
+        LOOP_XYZE(i) raw[i] += diff[i];
524
+        ubl_buffer_segment_raw(raw, feedrate);
528 525
       }
526
+      ubl_buffer_segment_raw(rtarget, feedrate);
527
+      return false; // moved but did not set_current_from_destination();
528
+    }
529 529
 
530
-      // Otherwise perform per-segment leveling
530
+    // Otherwise perform per-segment leveling
531 531
 
532
-      #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
533
-        const float fade_scaling_factor = planner.fade_scaling_factor_for_z(rtarget[Z_AXIS]);
534
-      #endif
532
+    #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
533
+      const float fade_scaling_factor = planner.fade_scaling_factor_for_z(rtarget[Z_AXIS]);
534
+    #endif
535 535
 
536
-      // increment to first segment destination
537
-      LOOP_XYZE(i) raw[i] += diff[i];
536
+    // increment to first segment destination
537
+    LOOP_XYZE(i) raw[i] += diff[i];
538 538
 
539
-      for(;;) {  // for each mesh cell encountered during the move
539
+    for(;;) {  // for each mesh cell encountered during the move
540 540
 
541
-        // Compute mesh cell invariants that remain constant for all segments within cell.
542
-        // Note for cell index, if point is outside the mesh grid (in MESH_INSET perimeter)
543
-        // the bilinear interpolation from the adjacent cell within the mesh will still work.
544
-        // Inner loop will exit each time (because out of cell bounds) but will come back
545
-        // in top of loop and again re-find same adjacent cell and use it, just less efficient
546
-        // for mesh inset area.
541
+      // Compute mesh cell invariants that remain constant for all segments within cell.
542
+      // Note for cell index, if point is outside the mesh grid (in MESH_INSET perimeter)
543
+      // the bilinear interpolation from the adjacent cell within the mesh will still work.
544
+      // Inner loop will exit each time (because out of cell bounds) but will come back
545
+      // in top of loop and again re-find same adjacent cell and use it, just less efficient
546
+      // for mesh inset area.
547 547
 
548
-        int8_t cell_xi = (raw[X_AXIS] - (MESH_MIN_X)) * (1.0 / (MESH_X_DIST)),
549
-               cell_yi = (raw[Y_AXIS] - (MESH_MIN_Y)) * (1.0 / (MESH_X_DIST));
548
+      int8_t cell_xi = (raw[X_AXIS] - (MESH_MIN_X)) * (1.0 / (MESH_X_DIST)),
549
+             cell_yi = (raw[Y_AXIS] - (MESH_MIN_Y)) * (1.0 / (MESH_X_DIST));
550 550
 
551
-        cell_xi = constrain(cell_xi, 0, (GRID_MAX_POINTS_X) - 1);
552
-        cell_yi = constrain(cell_yi, 0, (GRID_MAX_POINTS_Y) - 1);
551
+      cell_xi = constrain(cell_xi, 0, (GRID_MAX_POINTS_X) - 1);
552
+      cell_yi = constrain(cell_yi, 0, (GRID_MAX_POINTS_Y) - 1);
553 553
 
554
-        const float x0 = mesh_index_to_xpos(cell_xi),   // 64 byte table lookup avoids mul+add
555
-                    y0 = mesh_index_to_ypos(cell_yi);
554
+      const float x0 = mesh_index_to_xpos(cell_xi),   // 64 byte table lookup avoids mul+add
555
+                  y0 = mesh_index_to_ypos(cell_yi);
556 556
 
557
-        float z_x0y0 = z_values[cell_xi  ][cell_yi  ],  // z at lower left corner
558
-              z_x1y0 = z_values[cell_xi+1][cell_yi  ],  // z at upper left corner
559
-              z_x0y1 = z_values[cell_xi  ][cell_yi+1],  // z at lower right corner
560
-              z_x1y1 = z_values[cell_xi+1][cell_yi+1];  // z at upper right corner
557
+      float z_x0y0 = z_values[cell_xi  ][cell_yi  ],  // z at lower left corner
558
+            z_x1y0 = z_values[cell_xi+1][cell_yi  ],  // z at upper left corner
559
+            z_x0y1 = z_values[cell_xi  ][cell_yi+1],  // z at lower right corner
560
+            z_x1y1 = z_values[cell_xi+1][cell_yi+1];  // z at upper right corner
561 561
 
562
-        if (isnan(z_x0y0)) z_x0y0 = 0;              // ideally activating planner.leveling_active (G29 A)
563
-        if (isnan(z_x1y0)) z_x1y0 = 0;              //   should refuse if any invalid mesh points
564
-        if (isnan(z_x0y1)) z_x0y1 = 0;              //   in order to avoid isnan tests per cell,
565
-        if (isnan(z_x1y1)) z_x1y1 = 0;              //   thus guessing zero for undefined points
562
+      if (isnan(z_x0y0)) z_x0y0 = 0;              // ideally activating planner.leveling_active (G29 A)
563
+      if (isnan(z_x1y0)) z_x1y0 = 0;              //   should refuse if any invalid mesh points
564
+      if (isnan(z_x0y1)) z_x0y1 = 0;              //   in order to avoid isnan tests per cell,
565
+      if (isnan(z_x1y1)) z_x1y1 = 0;              //   thus guessing zero for undefined points
566 566
 
567
-        float cx = raw[X_AXIS] - x0,   // cell-relative x and y
568
-              cy = raw[Y_AXIS] - y0;
567
+      float cx = raw[X_AXIS] - x0,   // cell-relative x and y
568
+            cy = raw[Y_AXIS] - y0;
569 569
 
570
-        const float z_xmy0 = (z_x1y0 - z_x0y0) * (1.0 / (MESH_X_DIST)),   // z slope per x along y0 (lower left to lower right)
571
-                    z_xmy1 = (z_x1y1 - z_x0y1) * (1.0 / (MESH_X_DIST));   // z slope per x along y1 (upper left to upper right)
570
+      const float z_xmy0 = (z_x1y0 - z_x0y0) * (1.0 / (MESH_X_DIST)),   // z slope per x along y0 (lower left to lower right)
571
+                  z_xmy1 = (z_x1y1 - z_x0y1) * (1.0 / (MESH_X_DIST));   // z slope per x along y1 (upper left to upper right)
572 572
 
573
-              float z_cxy0 = z_x0y0 + z_xmy0 * cx;            // z height along y0 at cx (changes for each cx in cell)
573
+            float z_cxy0 = z_x0y0 + z_xmy0 * cx;            // z height along y0 at cx (changes for each cx in cell)
574 574
 
575
-        const float z_cxy1 = z_x0y1 + z_xmy1 * cx,            // z height along y1 at cx
576
-                    z_cxyd = z_cxy1 - z_cxy0;                 // z height difference along cx from y0 to y1
575
+      const float z_cxy1 = z_x0y1 + z_xmy1 * cx,            // z height along y1 at cx
576
+                  z_cxyd = z_cxy1 - z_cxy0;                 // z height difference along cx from y0 to y1
577 577
 
578
-              float z_cxym = z_cxyd * (1.0 / (MESH_Y_DIST));  // z slope per y along cx from y0 to y1 (changes for each cx in cell)
578
+            float z_cxym = z_cxyd * (1.0 / (MESH_Y_DIST));  // z slope per y along cx from y0 to y1 (changes for each cx in cell)
579 579
 
580
-        //    float z_cxcy = z_cxy0 + z_cxym * cy;            // interpolated mesh z height along cx at cy (do inside the segment loop)
580
+      //    float z_cxcy = z_cxy0 + z_cxym * cy;            // interpolated mesh z height along cx at cy (do inside the segment loop)
581 581
 
582
-        // As subsequent segments step through this cell, the z_cxy0 intercept will change
583
-        // and the z_cxym slope will change, both as a function of cx within the cell, and
584
-        // each change by a constant for fixed segment lengths.
582
+      // As subsequent segments step through this cell, the z_cxy0 intercept will change
583
+      // and the z_cxym slope will change, both as a function of cx within the cell, and
584
+      // each change by a constant for fixed segment lengths.
585 585
 
586
-        const float z_sxy0 = z_xmy0 * diff[X_AXIS],                                     // per-segment adjustment to z_cxy0
587
-                    z_sxym = (z_xmy1 - z_xmy0) * (1.0 / (MESH_Y_DIST)) * diff[X_AXIS];  // per-segment adjustment to z_cxym
586
+      const float z_sxy0 = z_xmy0 * diff[X_AXIS],                                     // per-segment adjustment to z_cxy0
587
+                  z_sxym = (z_xmy1 - z_xmy0) * (1.0 / (MESH_Y_DIST)) * diff[X_AXIS];  // per-segment adjustment to z_cxym
588 588
 
589
-        for(;;) {  // for all segments within this mesh cell
589
+      for(;;) {  // for all segments within this mesh cell
590 590
 
591
-          if (--segments == 0)                      // if this is last segment, use rtarget for exact
592
-            COPY(raw, rtarget);
591
+        if (--segments == 0)                      // if this is last segment, use rtarget for exact
592
+          COPY(raw, rtarget);
593 593
 
594
-          const float z_cxcy = (z_cxy0 + z_cxym * cy) // interpolated mesh z height along cx at cy
595
-            #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
596
-              * fade_scaling_factor                   // apply fade factor to interpolated mesh height
597
-            #endif
598
-          ;
594
+        const float z_cxcy = (z_cxy0 + z_cxym * cy) // interpolated mesh z height along cx at cy
595
+          #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
596
+            * fade_scaling_factor                   // apply fade factor to interpolated mesh height
597
+          #endif
598
+        ;
599 599
 
600
-          const float z = raw[Z_AXIS];
601
-          raw[Z_AXIS] += z_cxcy;
602
-          ubl_buffer_segment_raw(raw, feedrate);
603
-          raw[Z_AXIS] = z;
600
+        const float z = raw[Z_AXIS];
601
+        raw[Z_AXIS] += z_cxcy;
602
+        ubl_buffer_segment_raw(raw, feedrate);
603
+        raw[Z_AXIS] = z;
604 604
 
605
-          if (segments == 0)                        // done with last segment
606
-            return false;                           // did not set_current_from_destination()
605
+        if (segments == 0)                        // done with last segment
606
+          return false;                           // did not set_current_from_destination()
607 607
 
608
-          LOOP_XYZE(i) raw[i] += diff[i];
608
+        LOOP_XYZE(i) raw[i] += diff[i];
609 609
 
610
-          cx += diff[X_AXIS];
611
-          cy += diff[Y_AXIS];
610
+        cx += diff[X_AXIS];
611
+        cy += diff[Y_AXIS];
612 612
 
613
-          if (!WITHIN(cx, 0, MESH_X_DIST) || !WITHIN(cy, 0, MESH_Y_DIST))    // done within this cell, break to next
614
-            break;
613
+        if (!WITHIN(cx, 0, MESH_X_DIST) || !WITHIN(cy, 0, MESH_Y_DIST))    // done within this cell, break to next
614
+          break;
615 615
 
616
-          // Next segment still within same mesh cell, adjust the per-segment
617
-          // slope and intercept to compute next z height.
616
+        // Next segment still within same mesh cell, adjust the per-segment
617
+        // slope and intercept to compute next z height.
618 618
 
619
-          z_cxy0 += z_sxy0;   // adjust z_cxy0 by per-segment z_sxy0
620
-          z_cxym += z_sxym;   // adjust z_cxym by per-segment z_sxym
619
+        z_cxy0 += z_sxy0;   // adjust z_cxy0 by per-segment z_sxy0
620
+        z_cxym += z_sxym;   // adjust z_cxym by per-segment z_sxym
621 621
 
622
-        } // segment loop
623
-      } // cell loop
624
-    }
622
+      } // segment loop
623
+    } // cell loop
624
+  }
625 625
 
626 626
 #endif // UBL_SEGMENTED
627 627
 

Загрузка…
Отмена
Сохранить