Add M420 C to adjust the whole mesh (#10522)

This commit is contained in:
Scott Lahteine
2018-04-25 06:43:45 -05:00
committed by GitHub
parent c1e5ebbc1e
commit eef0248a1c
3 changed files with 84 additions and 15 deletions

View File

@ -89,7 +89,6 @@ class unified_bed_leveling {
#endif
static bool g29_parameter_parsing() _O0;
static void find_mean_mesh_height();
static void shift_mesh_height();
static void probe_entire_mesh(const float &rx, const float &ry, const bool do_ubl_mesh_map, const bool stow_probe, const bool do_furthest) _O0;
static void tilt_mesh_based_on_3pts(const float &z1, const float &z2, const float &z3);
@ -124,7 +123,8 @@ class unified_bed_leveling {
static mesh_index_pair find_furthest_invalid_mesh_point() _O0;
static void reset();
static void invalidate();
static void set_all_mesh_points_to_value(const float);
static void set_all_mesh_points_to_value(const float value);
static void adjust_mesh_to_mean(const float value);
static bool sanity_check();
static void G29() _O0; // O0 for no optimization

View File

@ -544,7 +544,7 @@
#endif
break;
case 5: find_mean_mesh_height(); break;
case 5: adjust_mesh_to_mean(g29_constant); break;
case 6: shift_mesh_height(); break;
}
@ -634,7 +634,7 @@
return;
}
void unified_bed_leveling::find_mean_mesh_height() {
void unified_bed_leveling::adjust_mesh_to_mean(const float value) {
float sum = 0.0;
int n = 0;
for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
@ -669,7 +669,7 @@
for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++)
if (!isnan(z_values[x][y]))
z_values[x][y] -= mean + g29_constant;
z_values[x][y] -= mean + value;
}
void unified_bed_leveling::shift_mesh_height() {
@ -1081,7 +1081,7 @@
SERIAL_EOL();
#endif
find_mean_mesh_height();
adjust_mesh_to_mean(g29_constant);
#if HAS_BED_PROBE
SERIAL_PROTOCOLPGM("zprobe_zoffset: ");