diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 21b07105e..aedead153 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -10072,7 +10072,7 @@ void quickstop_stepper() { #if ENABLED(AUTO_BED_LEVELING_UBL) set_bed_leveling_enabled(false); - ubl.adjust_mesh_to_mean(cval); + ubl.adjust_mesh_to_mean(true, cval); #else diff --git a/Marlin/ubl.h b/Marlin/ubl.h index a293ee5ce..90d6cd26a 100644 --- a/Marlin/ubl.h +++ b/Marlin/ubl.h @@ -118,7 +118,7 @@ class unified_bed_leveling { static void reset(); static void invalidate(); static void set_all_mesh_points_to_value(const float value); - static void adjust_mesh_to_mean(const float value); + static void adjust_mesh_to_mean(const bool cflag, const float value); static bool sanity_check(); static void G29() _O0; // O0 for no optimization diff --git a/Marlin/ubl_G29.cpp b/Marlin/ubl_G29.cpp index 494cbdf13..e351fb1ba 100644 --- a/Marlin/ubl_G29.cpp +++ b/Marlin/ubl_G29.cpp @@ -539,7 +539,7 @@ #endif break; - case 5: adjust_mesh_to_mean(g29_constant); break; + case 5: adjust_mesh_to_mean(g29_c_flag, g29_constant); break; case 6: shift_mesh_height(); break; } @@ -629,7 +629,7 @@ return; } - void unified_bed_leveling::adjust_mesh_to_mean(const float value) { + void unified_bed_leveling::adjust_mesh_to_mean(const bool cflag, const float value) { float sum = 0.0; int n = 0; for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) @@ -660,7 +660,7 @@ SERIAL_ECHO_F(sigma, 6); SERIAL_EOL(); - if (g29_c_flag) + if (cflag) 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])) @@ -1076,7 +1076,7 @@ SERIAL_EOL(); #endif - adjust_mesh_to_mean(g29_constant); + adjust_mesh_to_mean(g29_c_flag, g29_constant); #if HAS_BED_PROBE SERIAL_PROTOCOLPGM("zprobe_zoffset: ");