Browse Source

Add calculation of difference between auto-correct bed level plane, and measured topo map.

brian 10 years ago
parent
commit
62302ceb9e
1 changed files with 37 additions and 3 deletions
  1. 37
    3
      Marlin/Marlin_main.cpp

+ 37
- 3
Marlin/Marlin_main.cpp View File

2773
           }
2773
           }
2774
         }
2774
         }
2775
 
2775
 
2776
+        if (!dryrun) set_bed_level_equation_lsq(plane_equation_coefficients);
2777
+        free(plane_equation_coefficients);
2778
+
2776
         // Show the Topography map if enabled
2779
         // Show the Topography map if enabled
2777
         if (do_topography_map) {
2780
         if (do_topography_map) {
2778
 
2781
 
2783
           SERIAL_PROTOCOLPGM("|...Front...|\n");
2786
           SERIAL_PROTOCOLPGM("|...Front...|\n");
2784
           SERIAL_PROTOCOLPGM("+-----------+\n");
2787
           SERIAL_PROTOCOLPGM("+-----------+\n");
2785
 
2788
 
2789
+	  float min_diff = 999;
2790
+
2786
           for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) {
2791
           for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) {
2787
             for (int xx = 0; xx < auto_bed_leveling_grid_points; xx++) {
2792
             for (int xx = 0; xx < auto_bed_leveling_grid_points; xx++) {
2788
               int ind = yy * auto_bed_leveling_grid_points + xx;
2793
               int ind = yy * auto_bed_leveling_grid_points + xx;
2789
               float diff = eqnBVector[ind] - mean;
2794
               float diff = eqnBVector[ind] - mean;
2795
+
2796
+	      float x_tmp = eqnAMatrix[ind + 0 * abl2],
2797
+                y_tmp = eqnAMatrix[ind + 1 * abl2],
2798
+                z_tmp = 0;
2799
+
2800
+	      apply_rotation_xyz(plan_bed_level_matrix,x_tmp,y_tmp,z_tmp);
2801
+
2802
+	      if (eqnBVector[ind] - z_tmp < min_diff)
2803
+                min_diff = eqnBVector[ind] - z_tmp;
2804
+
2790
               if (diff >= 0.0)
2805
               if (diff >= 0.0)
2791
                 SERIAL_PROTOCOLPGM(" +");   // Include + for column alignment
2806
                 SERIAL_PROTOCOLPGM(" +");   // Include + for column alignment
2792
               else
2807
               else
2797
           } // yy
2812
           } // yy
2798
           SERIAL_EOL;
2813
           SERIAL_EOL;
2799
 
2814
 
2800
-        } //do_topography_map
2815
+	  SERIAL_PROTOCOLPGM(" \nCorrected Bed Height vs. Bed Topology: \n");
2801
 
2816
 
2817
+          for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) {
2818
+            for (int xx = 0; xx < auto_bed_leveling_grid_points; xx++) {
2819
+              int ind = yy * auto_bed_leveling_grid_points + xx;
2820
+              float x_tmp = eqnAMatrix[ind + 0 * abl2],
2821
+                y_tmp = eqnAMatrix[ind + 1 * abl2],
2822
+                z_tmp = 0;
2802
 
2823
 
2803
-        if (!dryrun) set_bed_level_equation_lsq(plane_equation_coefficients);
2804
-        free(plane_equation_coefficients);
2824
+              apply_rotation_xyz(plan_bed_level_matrix,x_tmp,y_tmp,z_tmp);
2825
+
2826
+              float diff = eqnBVector[ind] - z_tmp - min_diff;
2827
+              if (diff >= 0.0)
2828
+                SERIAL_PROTOCOLPGM(" +");
2829
+              // Include + for column alignment
2830
+              else
2831
+                SERIAL_PROTOCOLCHAR(' ');
2832
+              SERIAL_PROTOCOL_F(diff, 5);
2833
+            } // xx
2834
+            SERIAL_EOL;
2835
+          } // yy
2836
+          SERIAL_EOL;
2837
+
2838
+        } //do_topography_map
2805
 
2839
 
2806
       #endif //!DELTA
2840
       #endif //!DELTA
2807
 
2841
 

Loading…
Cancel
Save