Browse Source

Fixes for G33

LVD-AC 7 years ago
parent
commit
355cba4aa7
1 changed files with 24 additions and 23 deletions
  1. 24
    23
      Marlin/Marlin_main.cpp

+ 24
- 23
Marlin/Marlin_main.cpp View File

5377
       SERIAL_PROTOCOL_F(f, 2);
5377
       SERIAL_PROTOCOL_F(f, 2);
5378
     }
5378
     }
5379
 
5379
 
5380
-    inline void print_G33_settings(const bool end_stops, const bool tower_angles){
5380
+    void print_G33_settings(const bool end_stops, const bool tower_angles) {
5381
       SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]);
5381
       SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]);
5382
       if (end_stops) {
5382
       if (end_stops) {
5383
         print_signed_float(PSTR("  Ex"), endstop_adj[A_AXIS]);
5383
         print_signed_float(PSTR("  Ex"), endstop_adj[A_AXIS]);
5517
 
5517
 
5518
       print_G33_settings(!_1p_calibration, _7p_calibration && towers_set);
5518
       print_G33_settings(!_1p_calibration, _7p_calibration && towers_set);
5519
 
5519
 
5520
-      #if DISABLED(PROBE_MANUALLY)
5521
-        if (!_0p_calibration) {
5522
-          const float measured_z = probe_pt(dx, dy, stow_after_each, 1, false); // 1st probe to set height
5523
-          if (isnan(measured_z)) return G33_CLEANUP();
5524
-          home_offset[Z_AXIS] -= measured_z;
5525
-        }
5526
-      #endif
5527
-
5528
       do {
5520
       do {
5529
 
5521
 
5530
         float z_at_pt[13] = { 0.0 };
5522
         float z_at_pt[13] = { 0.0 };
5531
 
5523
 
5532
         test_precision = zero_std_dev_old != 999.0 ? (zero_std_dev + zero_std_dev_old) / 2 : zero_std_dev;
5524
         test_precision = zero_std_dev_old != 999.0 ? (zero_std_dev + zero_std_dev_old) / 2 : zero_std_dev;
5533
-        if (_0p_calibration) test_precision = 0.00;
5534
         iterations++;
5525
         iterations++;
5535
 
5526
 
5536
         // Probe the points
5527
         // Probe the points
5598
 
5589
 
5599
         // Solve matrices
5590
         // Solve matrices
5600
 
5591
 
5601
-        if ((zero_std_dev < test_precision && zero_std_dev > calibration_precision) || iterations <= force_iterations) {
5592
+        if ((zero_std_dev < test_precision || iterations <= force_iterations) && zero_std_dev > calibration_precision) {
5602
           if (zero_std_dev < zero_std_dev_min) {
5593
           if (zero_std_dev < zero_std_dev_min) {
5603
             COPY(e_old, endstop_adj);
5594
             COPY(e_old, endstop_adj);
5604
             dr_old = delta_radius;
5595
             dr_old = delta_radius;
5607
           }
5598
           }
5608
 
5599
 
5609
           float e_delta[ABC] = { 0.0 }, r_delta = 0.0, t_delta[ABC] = { 0.0 };
5600
           float e_delta[ABC] = { 0.0 }, r_delta = 0.0, t_delta[ABC] = { 0.0 };
5610
-          float r_diff = delta_radius - delta_calibration_radius,
5611
-                h_factor = 1.00 + r_diff * 0.001,                            //1.02 for r_diff = 20mm
5612
-                r_factor = -(1.75 + 0.005 * r_diff + 0.001 * sq(r_diff)),    //2.25 for r_diff = 20mm
5613
-                a_factor = 66.66 / delta_calibration_radius;                 //0.83 for cal_rd = 80mm
5601
+
5602
+          const float r_diff = delta_radius - delta_calibration_radius,
5603
+                      h_factor = (1.00 + r_diff * 0.001) / 6.0,                                       // 1.02 for r_diff = 20mm
5604
+                      r_factor = (-(1.75 + 0.005 * r_diff + 0.001 * sq(r_diff))) / 6.0,               // 2.25 for r_diff = 20mm
5605
+                      a_factor = (66.66 / delta_calibration_radius) / (iterations == 1 ? 16.0 : 2.0); // 0.83 for cal_rd = 80mm  (Slow down on 1st iteration)
5614
 
5606
 
5615
           #define ZP(N,I) ((N) * z_at_pt[I])
5607
           #define ZP(N,I) ((N) * z_at_pt[I])
5616
           #define Z6(I) ZP(6, I)
5608
           #define Z6(I) ZP(6, I)
5617
           #define Z4(I) ZP(4, I)
5609
           #define Z4(I) ZP(4, I)
5618
           #define Z2(I) ZP(2, I)
5610
           #define Z2(I) ZP(2, I)
5619
           #define Z1(I) ZP(1, I)
5611
           #define Z1(I) ZP(1, I)
5620
-          h_factor /= 6.00;
5621
-          r_factor /= 6.00;
5622
 
5612
 
5623
           #if ENABLED(PROBE_MANUALLY)
5613
           #if ENABLED(PROBE_MANUALLY)
5624
             test_precision = 0.00; // forced end
5614
             test_precision = 0.00; // forced end
5625
           #endif
5615
           #endif
5626
 
5616
 
5627
           switch (probe_points) {
5617
           switch (probe_points) {
5618
+            case 0:
5619
+              #if DISABLED(PROBE_MANUALLY)
5620
+                test_precision = 0.00; // forced end
5621
+              #endif
5622
+              break;
5623
+
5628
             case 1:
5624
             case 1:
5629
-              test_precision = 0.00; // forced end
5625
+              #if DISABLED(PROBE_MANUALLY)
5626
+                test_precision = 0.00; // forced end
5627
+              #endif
5630
               LOOP_XYZ(axis) e_delta[axis] = Z1(0);
5628
               LOOP_XYZ(axis) e_delta[axis] = Z1(0);
5631
               break;
5629
               break;
5632
 
5630
 
5652
               r_delta         = (Z6(0) - Z1(1) - Z1(5) - Z1(9) - Z1(7) - Z1(11) - Z1(3)) * r_factor;
5650
               r_delta         = (Z6(0) - Z1(1) - Z1(5) - Z1(9) - Z1(7) - Z1(11) - Z1(3)) * r_factor;
5653
 
5651
 
5654
               if (towers_set) {
5652
               if (towers_set) {
5655
-                t_delta[A_AXIS] = (       - Z2(5) + Z1(9)         - Z2(11) + Z1(3)) * a_factor;
5656
-                t_delta[B_AXIS] = ( Z2(1)         - Z1(9) + Z2(7)          - Z1(3)) * a_factor;
5657
-                t_delta[C_AXIS] = (-Z2(1) + Z1(5)         - Z2(7) + Z1(11)        ) * a_factor;
5653
+                t_delta[A_AXIS] = (       - Z2(5) + Z2(9)         - Z2(11) + Z2(3)) * a_factor;
5654
+                t_delta[B_AXIS] = ( Z2(1)         - Z2(9) + Z2(7)          - Z2(3)) * a_factor;
5655
+                t_delta[C_AXIS] = (-Z2(1) + Z2(5)         - Z2(7) + Z2(11)        ) * a_factor;
5656
+                e_delta[A_AXIS] += (t_delta[B_AXIS] - t_delta[C_AXIS]) / 4.5;
5657
+                e_delta[B_AXIS] += (t_delta[C_AXIS] - t_delta[A_AXIS]) / 4.5;
5658
+                e_delta[C_AXIS] += (t_delta[A_AXIS] - t_delta[B_AXIS]) / 4.5;
5658
               }
5659
               }
5659
               break;
5660
               break;
5660
           }
5661
           }
5707
           }
5708
           }
5708
         }
5709
         }
5709
         if (verbose_level != 0) {                                    // !dry run
5710
         if (verbose_level != 0) {                                    // !dry run
5710
-          if ((zero_std_dev >= test_precision || zero_std_dev <= calibration_precision) && iterations > force_iterations) {  // end iterations
5711
+          if ((zero_std_dev >= test_precision && iterations > force_iterations) || zero_std_dev <= calibration_precision) {  // end iterations
5711
             SERIAL_PROTOCOLPGM("Calibration OK");
5712
             SERIAL_PROTOCOLPGM("Calibration OK");
5712
             SERIAL_PROTOCOL_SP(36);
5713
             SERIAL_PROTOCOL_SP(36);
5713
             #if DISABLED(PROBE_MANUALLY)
5714
             #if DISABLED(PROBE_MANUALLY)
5769
         endstops.not_homing();
5770
         endstops.not_homing();
5770
 
5771
 
5771
       }
5772
       }
5772
-      while ((zero_std_dev < test_precision && zero_std_dev > calibration_precision && iterations < 31) || iterations <= force_iterations);
5773
+      while (((zero_std_dev < test_precision && iterations < 31) || iterations <= force_iterations) && zero_std_dev > calibration_precision);
5773
 
5774
 
5774
       G33_CLEANUP();
5775
       G33_CLEANUP();
5775
     }
5776
     }

Loading…
Cancel
Save