Przeglądaj źródła

More G26 arc cleanup

Followup to #13531
Scott Lahteine 6 lat temu
rodzic
commit
2aa35e95af
1 zmienionych plików z 13 dodań i 21 usunięć
  1. 13
    21
      Marlin/src/gcode/bedlevel/G26.cpp

+ 13
- 21
Marlin/src/gcode/bedlevel/G26.cpp Wyświetl plik

@@ -768,6 +768,7 @@ void GcodeSuite::G26() {
768 768
       #if ENABLED(ARC_SUPPORT)
769 769
 
770 770
         #define ARC_LENGTH(quarters)  (INTERSECTION_CIRCLE_RADIUS * M_PI * (quarters) / 2)
771
+        #define INTERSECTION_CIRCLE_DIAM  ((INTERSECTION_CIRCLE_RADIUS) * 2)
771 772
         float sx = circle_x + INTERSECTION_CIRCLE_RADIUS,   // default to full circle
772 773
               ex = circle_x + INTERSECTION_CIRCLE_RADIUS,
773 774
               sy = circle_y, ey = circle_y,
@@ -775,14 +776,8 @@ void GcodeSuite::G26() {
775 776
 
776 777
         // Figure out where to start and end the arc - we always print counterclockwise
777 778
         if (xi == 0) {                             // left edge
778
-          if (!f) {
779
-            sx = circle_x;
780
-            sy -= (INTERSECTION_CIRCLE_RADIUS);
781
-          }
782
-          if (!b) {
783
-            ex = circle_x;
784
-            ey += INTERSECTION_CIRCLE_RADIUS;
785
-          }
779
+          if (!f) { sx = circle_x; sy -= INTERSECTION_CIRCLE_RADIUS; }
780
+          if (!b) { ex = circle_x; ey += INTERSECTION_CIRCLE_RADIUS; }
786 781
           arc_length = (f || b) ? ARC_LENGTH(1) : ARC_LENGTH(2);
787 782
         }
788 783
         else if (r) {                             // right edge
@@ -793,26 +788,23 @@ void GcodeSuite::G26() {
793 788
           arc_length = (f || b) ? ARC_LENGTH(1) : ARC_LENGTH(2);
794 789
         }
795 790
         else if (f) {
796
-          ex = circle_x - (INTERSECTION_CIRCLE_RADIUS);
791
+          ex -= INTERSECTION_CIRCLE_DIAM;
797 792
           arc_length = ARC_LENGTH(2);
798 793
         }
799 794
         else if (b) {
800
-          sx = circle_x - (INTERSECTION_CIRCLE_RADIUS);
795
+          sx -= INTERSECTION_CIRCLE_DIAM;
801 796
           arc_length = ARC_LENGTH(2);
802 797
         }
803
-        const float arc_offset[2] = {
804
-          circle_x - sx,
805
-          circle_y - sy
806
-        };
807 798
 
808
-        const float dx_s = current_position[X_AXIS] - sx,   // find our distance from the start of the actual circle
799
+        const float arc_offset[2] = { circle_x - sx, circle_y - sy },
800
+                    dx_s = current_position[X_AXIS] - sx,   // find our distance from the start of the actual circle
809 801
                     dy_s = current_position[Y_AXIS] - sy,
810
-                    dist_start = HYPOT2(dx_s, dy_s);
811
-        const float endpoint[XYZE] = {
812
-          ex, ey,
813
-          g26_layer_height,
814
-          current_position[E_AXIS] + (arc_length * g26_e_axis_feedrate * g26_extrusion_multiplier)
815
-        };
802
+                    dist_start = HYPOT2(dx_s, dy_s),
803
+                    endpoint[XYZE] = {
804
+                      ex, ey,
805
+                      g26_layer_height,
806
+                      current_position[E_AXIS] + (arc_length * g26_e_axis_feedrate * g26_extrusion_multiplier)
807
+                    };
816 808
 
817 809
         if (dist_start > 2.0) {
818 810
           retract_filament(destination);

Ładowanie…
Anuluj
Zapisz