UBL: Log and display G29 progress (#14036)

This commit is contained in:
GUEST.it 2019-05-18 02:02:21 +02:00 committed by Scott Lahteine
parent 7907eec04c
commit 62ef54cb81
2 changed files with 39 additions and 3 deletions

View file

@ -411,7 +411,6 @@
restore_ubl_active_state_and_leave(); restore_ubl_active_state_and_leave();
} }
else { // grid_size == 0 : A 3-Point leveling has been requested else { // grid_size == 0 : A 3-Point leveling has been requested
save_ubl_active_state_and_disable(); save_ubl_active_state_and_disable();
tilt_mesh_based_on_probed_grid(true /* true says to do 3-Point leveling */ ); tilt_mesh_based_on_probed_grid(true /* true says to do 3-Point leveling */ );
restore_ubl_active_state_and_leave(); 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 save_ubl_active_state_and_disable(); // No bed level correction so only raw data is obtained
DEPLOY_PROBE(); DEPLOY_PROBE();
uint16_t count = GRID_MAX_POINTS; uint16_t count = GRID_MAX_POINTS, current = 1;
do { do {
current = (GRID_MAX_POINTS) - count + 1;
if (do_ubl_mesh_map) display_map(g29_map_type); if (do_ubl_mesh_map) display_map(g29_map_type);
SERIAL_ECHOLNPAIR("\nProbing mesh point ", current, "/", GRID_MAX_POINTS, ".\n");
#if HAS_LCD_MENU #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()) { if (ui.button_pressed()) {
ui.quick_feedback(false); // Preserve button state for click-and-hold ui.quick_feedback(false); // Preserve button state for click-and-hold
SERIAL_ECHOLNPGM("\nMesh only partially populated.\n"); SERIAL_ECHOLNPGM("\nMesh only partially populated.\n");
@ -771,6 +775,7 @@
#endif #endif
} }
SERIAL_FLUSH(); // Prevent host M105 buffer overrun. SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
} while (location.x_index >= 0 && --count); } while (location.x_index >= 0 && --count);
STOW_PROBE(); STOW_PROBE();
@ -1401,6 +1406,11 @@
incremental_LSF_reset(&lsf_results); incremental_LSF_reset(&lsf_results);
if (do_3_pt_leveling) { 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); measured_z = probe_pt(PROBE_PT_1_X, PROBE_PT_1_Y, PROBE_PT_RAISE, g29_verbose_level);
if (isnan(measured_z)) if (isnan(measured_z))
abort_flag = true; abort_flag = true;
@ -1415,6 +1425,11 @@
} }
if (!abort_flag) { 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); measured_z = probe_pt(PROBE_PT_2_X, PROBE_PT_2_Y, PROBE_PT_RAISE, g29_verbose_level);
//z2 = measured_z; //z2 = measured_z;
if (isnan(measured_z)) if (isnan(measured_z))
@ -1430,6 +1445,11 @@
} }
if (!abort_flag) { 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); measured_z = probe_pt(PROBE_PT_3_X, PROBE_PT_3_Y, PROBE_PT_STOW, g29_verbose_level);
//z3 = measured_z; //z3 = measured_z;
if (isnan(measured_z)) if (isnan(measured_z))
@ -1457,12 +1477,20 @@
else { // !do_3_pt_leveling else { // !do_3_pt_leveling
bool zig_zag = false; 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++) { for (uint8_t ix = 0; ix < g29_grid_size; ix++) {
const float rx = float(x_min) + ix * dx; const float rx = float(x_min) + ix * dx;
for (int8_t iy = 0; iy < g29_grid_size; iy++) { 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); const float ry = float(y_min) + dy * (zig_zag ? g29_grid_size - 1 - iy : iy);
if (!abort_flag) { 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 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); abort_flag = isnan(measured_z);
@ -1491,6 +1519,8 @@
} }
incremental_LSF(&lsf_results, rx, ry, measured_z); incremental_LSF(&lsf_results, rx, ry, measured_z);
} }
current++;
} }
zig_zag ^= true; zig_zag ^= true;

View file

@ -247,6 +247,12 @@
#ifndef MSG_UBL_LEVEL_BED #ifndef MSG_UBL_LEVEL_BED
#define MSG_UBL_LEVEL_BED _UxGT("Unified Bed Leveling") #define MSG_UBL_LEVEL_BED _UxGT("Unified Bed Leveling")
#endif #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 #ifndef MSG_IDEX_MENU
#define MSG_IDEX_MENU _UxGT("IDEX Mode") #define MSG_IDEX_MENU _UxGT("IDEX Mode")
#endif #endif