From 62ef54cb81846ef40b108ec483900eff54f204eb Mon Sep 17 00:00:00 2001 From: "GUEST.it" <3944655+guestisp@users.noreply.github.com> Date: Sat, 18 May 2019 02:02:21 +0200 Subject: [PATCH] UBL: Log and display G29 progress (#14036) --- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 36 +++++++++++++++++++-- Marlin/src/lcd/language/language_en.h | 6 ++++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index dfd16014b..09bb7a23e 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -411,7 +411,6 @@ restore_ubl_active_state_and_leave(); } else { // grid_size == 0 : A 3-Point leveling has been requested - save_ubl_active_state_and_disable(); tilt_mesh_based_on_probed_grid(true /* true says to do 3-Point leveling */ ); restore_ubl_active_state_and_leave(); @@ -738,12 +737,17 @@ save_ubl_active_state_and_disable(); // No bed level correction so only raw data is obtained DEPLOY_PROBE(); - uint16_t count = GRID_MAX_POINTS; + uint16_t count = GRID_MAX_POINTS, current = 1; do { + current = (GRID_MAX_POINTS) - count + 1; + if (do_ubl_mesh_map) display_map(g29_map_type); + SERIAL_ECHOLNPAIR("\nProbing mesh point ", current, "/", GRID_MAX_POINTS, ".\n"); #if HAS_LCD_MENU + ui.status_printf_P(0, PSTR(MSG_LCD_PROBING_MESH " %i/%i"), current, int(GRID_MAX_POINTS)); + if (ui.button_pressed()) { ui.quick_feedback(false); // Preserve button state for click-and-hold SERIAL_ECHOLNPGM("\nMesh only partially populated.\n"); @@ -771,6 +775,7 @@ #endif } SERIAL_FLUSH(); // Prevent host M105 buffer overrun. + } while (location.x_index >= 0 && --count); STOW_PROBE(); @@ -1401,6 +1406,11 @@ incremental_LSF_reset(&lsf_results); if (do_3_pt_leveling) { + SERIAL_ECHOLNPGM("Tilting mesh (1/3)"); + #if HAS_LCD_MENU + ui.status_printf_P(0, PSTR(MSG_LCD_TILTING_MESH " 1/3")); + #endif + measured_z = probe_pt(PROBE_PT_1_X, PROBE_PT_1_Y, PROBE_PT_RAISE, g29_verbose_level); if (isnan(measured_z)) abort_flag = true; @@ -1415,6 +1425,11 @@ } if (!abort_flag) { + SERIAL_ECHOLNPGM("Tilting mesh (2/3)"); + #if HAS_LCD_MENU + ui.status_printf_P(0, PSTR(MSG_LCD_TILTING_MESH " 2/3")); + #endif + measured_z = probe_pt(PROBE_PT_2_X, PROBE_PT_2_Y, PROBE_PT_RAISE, g29_verbose_level); //z2 = measured_z; if (isnan(measured_z)) @@ -1430,6 +1445,11 @@ } if (!abort_flag) { + SERIAL_ECHOLNPGM("Tilting mesh (3/3)"); + #if HAS_LCD_MENU + ui.status_printf_P(0, PSTR(MSG_LCD_TILTING_MESH " 3/3")); + #endif + measured_z = probe_pt(PROBE_PT_3_X, PROBE_PT_3_Y, PROBE_PT_STOW, g29_verbose_level); //z3 = measured_z; if (isnan(measured_z)) @@ -1450,19 +1470,27 @@ #endif if (abort_flag) { - SERIAL_ECHOLNPGM("?Error probing point. Aborting operation."); + SERIAL_ECHOLNPGM("?Error probing point. Aborting operation."); return; } } else { // !do_3_pt_leveling bool zig_zag = false; + + uint16_t total_points = g29_grid_size * g29_grid_size, current = 1; + for (uint8_t ix = 0; ix < g29_grid_size; ix++) { const float rx = float(x_min) + ix * dx; for (int8_t iy = 0; iy < g29_grid_size; iy++) { const float ry = float(y_min) + dy * (zig_zag ? g29_grid_size - 1 - iy : iy); if (!abort_flag) { + SERIAL_ECHOLNPAIR("Tilting mesh point ", current, "/", total_points, "\n"); + #if HAS_LCD_MENU + ui.status_printf_P(0, PSTR(MSG_LCD_TILTING_MESH " %i/%i"), current, total_points); + #endif + measured_z = probe_pt(rx, ry, parser.seen('E') ? PROBE_PT_STOW : PROBE_PT_RAISE, g29_verbose_level); // TODO: Needs error handling abort_flag = isnan(measured_z); @@ -1491,6 +1519,8 @@ } incremental_LSF(&lsf_results, rx, ry, measured_z); } + + current++; } zig_zag ^= true; diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 440177ab9..c361fb846 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -247,6 +247,12 @@ #ifndef MSG_UBL_LEVEL_BED #define MSG_UBL_LEVEL_BED _UxGT("Unified Bed Leveling") #endif +#ifndef MSG_LCD_PROBING_MESH + #define MSG_LCD_PROBING_MESH _UxGT("Probing point") +#endif +#ifndef MSG_LCD_TILTING_MESH + #define MSG_LCD_TILTING_MESH _UxGT("Tilting point") +#endif #ifndef MSG_IDEX_MENU #define MSG_IDEX_MENU _UxGT("IDEX Mode") #endif