From 62302ceb9e8f4a011985bdd894b6d7bf28dc9f6f Mon Sep 17 00:00:00 2001 From: brian Date: Mon, 4 May 2015 12:35:36 -0400 Subject: [PATCH 1/2] Add calculation of difference between auto-correct bed level plane, and measured topo map. --- Marlin/Marlin_main.cpp | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index b1b2b3483..fbefc3684 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -2773,6 +2773,9 @@ inline void gcode_G28() { } } + if (!dryrun) set_bed_level_equation_lsq(plane_equation_coefficients); + free(plane_equation_coefficients); + // Show the Topography map if enabled if (do_topography_map) { @@ -2783,10 +2786,22 @@ inline void gcode_G28() { SERIAL_PROTOCOLPGM("|...Front...|\n"); SERIAL_PROTOCOLPGM("+-----------+\n"); + float min_diff = 999; + for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) { for (int xx = 0; xx < auto_bed_leveling_grid_points; xx++) { int ind = yy * auto_bed_leveling_grid_points + xx; float diff = eqnBVector[ind] - mean; + + float x_tmp = eqnAMatrix[ind + 0 * abl2], + y_tmp = eqnAMatrix[ind + 1 * abl2], + z_tmp = 0; + + apply_rotation_xyz(plan_bed_level_matrix,x_tmp,y_tmp,z_tmp); + + if (eqnBVector[ind] - z_tmp < min_diff) + min_diff = eqnBVector[ind] - z_tmp; + if (diff >= 0.0) SERIAL_PROTOCOLPGM(" +"); // Include + for column alignment else @@ -2797,11 +2812,30 @@ inline void gcode_G28() { } // yy SERIAL_EOL; - } //do_topography_map + SERIAL_PROTOCOLPGM(" \nCorrected Bed Height vs. Bed Topology: \n"); + for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) { + for (int xx = 0; xx < auto_bed_leveling_grid_points; xx++) { + int ind = yy * auto_bed_leveling_grid_points + xx; + float x_tmp = eqnAMatrix[ind + 0 * abl2], + y_tmp = eqnAMatrix[ind + 1 * abl2], + z_tmp = 0; - if (!dryrun) set_bed_level_equation_lsq(plane_equation_coefficients); - free(plane_equation_coefficients); + apply_rotation_xyz(plan_bed_level_matrix,x_tmp,y_tmp,z_tmp); + + float diff = eqnBVector[ind] - z_tmp - min_diff; + if (diff >= 0.0) + SERIAL_PROTOCOLPGM(" +"); + // Include + for column alignment + else + SERIAL_PROTOCOLCHAR(' '); + SERIAL_PROTOCOL_F(diff, 5); + } // xx + SERIAL_EOL; + } // yy + SERIAL_EOL; + + } //do_topography_map #endif //!DELTA From ed6598adf5a1fbe3e5d74479446124b551342270 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Tue, 14 Jul 2015 19:44:28 +0200 Subject: [PATCH 2/2] Corrected Bed Height vs. Bed Topology for verbosity > 3 and cleaned out some tabs. Everything else is a rebased PR#2017 as proposed by @CptanPanic --- Marlin/Marlin_main.cpp | 55 +++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index fbefc3684..537fe9b03 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -2786,20 +2786,20 @@ inline void gcode_G28() { SERIAL_PROTOCOLPGM("|...Front...|\n"); SERIAL_PROTOCOLPGM("+-----------+\n"); - float min_diff = 999; + float min_diff = 999; for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) { for (int xx = 0; xx < auto_bed_leveling_grid_points; xx++) { int ind = yy * auto_bed_leveling_grid_points + xx; float diff = eqnBVector[ind] - mean; - float x_tmp = eqnAMatrix[ind + 0 * abl2], + float x_tmp = eqnAMatrix[ind + 0 * abl2], y_tmp = eqnAMatrix[ind + 1 * abl2], z_tmp = 0; - apply_rotation_xyz(plan_bed_level_matrix,x_tmp,y_tmp,z_tmp); + apply_rotation_xyz(plan_bed_level_matrix,x_tmp,y_tmp,z_tmp); - if (eqnBVector[ind] - z_tmp < min_diff) + if (eqnBVector[ind] - z_tmp < min_diff) min_diff = eqnBVector[ind] - z_tmp; if (diff >= 0.0) @@ -2811,32 +2811,31 @@ inline void gcode_G28() { SERIAL_EOL; } // yy SERIAL_EOL; - - SERIAL_PROTOCOLPGM(" \nCorrected Bed Height vs. Bed Topology: \n"); - - for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) { - for (int xx = 0; xx < auto_bed_leveling_grid_points; xx++) { - int ind = yy * auto_bed_leveling_grid_points + xx; - float x_tmp = eqnAMatrix[ind + 0 * abl2], - y_tmp = eqnAMatrix[ind + 1 * abl2], - z_tmp = 0; - - apply_rotation_xyz(plan_bed_level_matrix,x_tmp,y_tmp,z_tmp); - - float diff = eqnBVector[ind] - z_tmp - min_diff; - if (diff >= 0.0) - SERIAL_PROTOCOLPGM(" +"); - // Include + for column alignment - else - SERIAL_PROTOCOLCHAR(' '); - SERIAL_PROTOCOL_F(diff, 5); - } // xx + if (verbose_level > 3) { + SERIAL_PROTOCOLPGM(" \nCorrected Bed Height vs. Bed Topology: \n"); + + for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) { + for (int xx = 0; xx < auto_bed_leveling_grid_points; xx++) { + int ind = yy * auto_bed_leveling_grid_points + xx; + float x_tmp = eqnAMatrix[ind + 0 * abl2], + y_tmp = eqnAMatrix[ind + 1 * abl2], + z_tmp = 0; + + apply_rotation_xyz(plan_bed_level_matrix,x_tmp,y_tmp,z_tmp); + + float diff = eqnBVector[ind] - z_tmp - min_diff; + if (diff >= 0.0) + SERIAL_PROTOCOLPGM(" +"); + // Include + for column alignment + else + SERIAL_PROTOCOLCHAR(' '); + SERIAL_PROTOCOL_F(diff, 5); + } // xx + SERIAL_EOL; + } // yy SERIAL_EOL; - } // yy - SERIAL_EOL; - + } } //do_topography_map - #endif //!DELTA #else // !AUTO_BED_LEVELING_GRID