Просмотр исходного кода

Adding upto 7*7 probe grids

- adding Cn 5, 6 and 7
LVD-AC 8 лет назад
Родитель
Сommit
76ec7a0f80
1 измененных файлов: 26 добавлений и 18 удалений
  1. 26
    18
      Marlin/Marlin_main.cpp

+ 26
- 18
Marlin/Marlin_main.cpp Просмотреть файл

@@ -5009,7 +5009,7 @@ inline void gcode_G28() {
5009 5009
       #endif
5010 5010
 
5011 5011
       const int8_t pp = code_seen('C') ? code_value_int() : DELTA_CALIBRATION_DEFAULT_POINTS,
5012
-                   probe_points = (WITHIN(pp, 1, 4) || pp == -2) ? pp : DELTA_CALIBRATION_DEFAULT_POINTS;
5012
+                   probe_points = (WITHIN(pp, 1, 7) || pp == -2) ? pp : DELTA_CALIBRATION_DEFAULT_POINTS;
5013 5013
 
5014 5014
       int8_t verbose_level = code_seen('V') ? code_value_byte() : 1;
5015 5015
 
@@ -5066,39 +5066,47 @@ inline void gcode_G28() {
5066 5066
 
5067 5067
         int16_t center_points = 0;
5068 5068
 
5069
-        if (probe_points != 3) {
5069
+        if (probe_points != 3 &&  probe_points != 6) {                                 // probe centre
5070 5070
           z_at_pt[0] += probe_pt(0.0, 0.0 , true, 1);
5071 5071
           center_points = 1;
5072 5072
         }
5073 5073
 
5074
-        int16_t step_axis = 4;
5075
-        if (probe_points >= 3) {
5076
-          for (int8_t axis = 9; axis > 0; axis -= step_axis) { // uint8_t starts endless loop
5074
+        int16_t step_axis = (probe_points > 4) ? 2 : 4;                                              
5075
+        if (probe_points >= 3) {                                                       // probe extra 3 or 6 centre points
5076
+          for (int8_t axis = (probe_points > 4) ? 11 : 9; axis > 0; axis -= step_axis) {              
5077 5077
             z_at_pt[0] += probe_pt(
5078
-              0.1 * cos(RADIANS(180 + 30 * axis)) * (delta_calibration_radius),
5079
-              0.1 * sin(RADIANS(180 + 30 * axis)) * (delta_calibration_radius), true, 1);
5078
+              cos(RADIANS(180 + 30 * axis)) * (0.1 * delta_calibration_radius),
5079
+              sin(RADIANS(180 + 30 * axis)) * (0.1 * delta_calibration_radius), true, 1);
5080 5080
           }
5081
-          center_points += 3;
5081
+          center_points += (probe_points > 4) ? 6 : 3;                                  // average centre points
5082 5082
           z_at_pt[0] /= center_points;
5083 5083
         }
5084 5084
 
5085 5085
         float S1 = z_at_pt[0], S2 = sq(S1);
5086 5086
 
5087 5087
         int16_t N = 1, start = (probe_points == -2) ? 3 : 1;
5088
-        step_axis = (abs(probe_points) == 2) ? 4 : (probe_points == 3) ? 2 : 1;
5088
+        step_axis = (abs(probe_points) == 2) ? 4 : (probe_points == 4 || probe_points > 5) ? 1 : 2;
5089
+        float start_circles = (probe_points > 6) ? -1.5 : (probe_points > 4) ? -1 : 0,  // one or multi radius points
5090
+              end_circles = (probe_points > 6) ? 1.5 : (probe_points > 4) ? 1 : 0;      // one or multi radius points
5091
+        int8_t zig_zag = 1;
5089 5092
 
5090 5093
         if (probe_points != 1) {
5091
-          for (uint8_t axis = start; axis < 13; axis += step_axis)
5092
-            z_at_pt[axis] += probe_pt(
5093
-              cos(RADIANS(180 + 30 * axis)) * (delta_calibration_radius),
5094
-              sin(RADIANS(180 + 30 * axis)) * (delta_calibration_radius), true, 1
5095
-            );
5096
-
5097
-          if (probe_points == 4) step_axis = 2;
5094
+          for (uint8_t axis = start; axis < 13; axis += step_axis) { // probes 3, 6 or 12 points on the calibration radius
5095
+            for (float circles = start_circles ; circles <= end_circles; circles++)     // one or multi radius points
5096
+              z_at_pt[axis] += probe_pt(
5097
+                cos(RADIANS(180 + 30 * axis)) * ((1 + circles * 0.1 * zig_zag) * delta_calibration_radius), 
5098
+                sin(RADIANS(180 + 30 * axis)) * ((1 + circles * 0.1 * zig_zag) * delta_calibration_radius), true, 1);
5099
+
5100
+            if (probe_points > 5) start_circles += (zig_zag == 1) ? +0.5 : -0.5;        // opposite one radius point less
5101
+            if (probe_points > 5) end_circles += (zig_zag == 1) ? -0.5 : +0.5;
5102
+            zig_zag = -zig_zag;
5103
+            if (probe_points > 4) z_at_pt[axis] /= (zig_zag == 1) ? 3.0 : 2.0;          // average between radius points
5104
+          }
5098 5105
         }
5106
+        if (probe_points == 4 || probe_points > 5) step_axis = 2;
5099 5107
 
5100
-        for (uint8_t axis = start; axis < 13; axis += step_axis) {
5101
-          if (probe_points == 4)
5108
+        for (uint8_t axis = start; axis < 13; axis += step_axis) {                      // average half intermediates to tower and opposite
5109
+          if (probe_points == 4 || probe_points > 5)
5102 5110
             z_at_pt[axis] = (z_at_pt[axis] + (z_at_pt[axis + 1] + z_at_pt[(axis + 10) % 12 + 1]) / 2.0) / 2.0;
5103 5111
 
5104 5112
           S1 += z_at_pt[axis];

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