Przeglądaj źródła

Merge Bed leveling residuals (PR#2444)

Richard Wackerbarth 10 lat temu
rodzic
commit
2cbb85fe88
1 zmienionych plików z 39 dodań i 6 usunięć
  1. 39
    6
      Marlin/Marlin_main.cpp

+ 39
- 6
Marlin/Marlin_main.cpp Wyświetl plik

@@ -2773,6 +2773,9 @@ inline void gcode_G28() {
2773 2773
           }
2774 2774
         }
2775 2775
 
2776
+        if (!dryrun) set_bed_level_equation_lsq(plane_equation_coefficients);
2777
+        free(plane_equation_coefficients);
2778
+
2776 2779
         // Show the Topography map if enabled
2777 2780
         if (do_topography_map) {
2778 2781
 
@@ -2783,10 +2786,22 @@ inline void gcode_G28() {
2783 2786
           SERIAL_PROTOCOLPGM("|...Front...|\n");
2784 2787
           SERIAL_PROTOCOLPGM("+-----------+\n");
2785 2788
 
2789
+          float min_diff = 999;
2790
+
2786 2791
           for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) {
2787 2792
             for (int xx = 0; xx < auto_bed_leveling_grid_points; xx++) {
2788 2793
               int ind = yy * auto_bed_leveling_grid_points + xx;
2789 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 2805
               if (diff >= 0.0)
2791 2806
                 SERIAL_PROTOCOLPGM(" +");   // Include + for column alignment
2792 2807
               else
@@ -2796,13 +2811,31 @@ inline void gcode_G28() {
2796 2811
             SERIAL_EOL;
2797 2812
           } // yy
2798 2813
           SERIAL_EOL;
2799
-
2814
+          if (verbose_level > 3) {
2815
+            SERIAL_PROTOCOLPGM(" \nCorrected Bed Height vs. Bed Topology: \n");
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;
2823
+
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
+          }
2800 2838
         } //do_topography_map
2801
-
2802
-
2803
-        if (!dryrun) set_bed_level_equation_lsq(plane_equation_coefficients);
2804
-        free(plane_equation_coefficients);
2805
-
2806 2839
       #endif //!DELTA
2807 2840
 
2808 2841
     #else // !AUTO_BED_LEVELING_GRID

Ładowanie…
Anuluj
Zapisz