From f59a7e8b0747b4b1a336f7766ee4cd6f3eab071d Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Thu, 1 Aug 2019 21:11:26 -0400 Subject: [PATCH] Print/display ABL current probe point (#14788) --- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 18 +++++++------ Marlin/src/gcode/bedlevel/abl/G29.cpp | 30 ++++++++++++++++----- Marlin/src/lcd/language/language_de.h | 2 +- Marlin/src/lcd/language/language_en.h | 6 ++--- Marlin/src/lcd/language/language_fr.h | 2 +- Marlin/src/lcd/language/language_it.h | 2 +- Marlin/src/lcd/language/language_sk.h | 2 +- 7 files changed, 40 insertions(+), 22 deletions(-) diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index c5b4500196..568f766150 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -752,17 +752,19 @@ save_ubl_active_state_and_disable(); // No bed level correction so only raw data is obtained DEPLOY_PROBE(); - uint16_t count = GRID_MAX_POINTS, current = 1; + uint8_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)); + SERIAL_ECHOLNPAIR("\nProbing mesh point ", int(current), "/", int(GRID_MAX_POINTS), ".\n"); + #if HAS_DISPLAY + ui.status_printf_P(0, PSTR(MSG_PROBING_MESH " %i/%i"), int(current), int(GRID_MAX_POINTS)); + #endif + #if HAS_LCD_MENU if (ui.button_pressed()) { ui.quick_feedback(false); // Preserve button state for click-and-hold SERIAL_ECHOLNPGM("\nMesh only partially populated.\n"); @@ -1405,7 +1407,7 @@ if (do_3_pt_leveling) { SERIAL_ECHOLNPGM("Tilting mesh (1/3)"); - #if HAS_LCD_MENU + #if HAS_DISPLAY ui.status_printf_P(0, PSTR(MSG_LCD_TILTING_MESH " 1/3")); #endif @@ -1424,7 +1426,7 @@ if (!abort_flag) { SERIAL_ECHOLNPGM("Tilting mesh (2/3)"); - #if HAS_LCD_MENU + #if HAS_DISPLAY ui.status_printf_P(0, PSTR(MSG_LCD_TILTING_MESH " 2/3")); #endif @@ -1444,7 +1446,7 @@ if (!abort_flag) { SERIAL_ECHOLNPGM("Tilting mesh (3/3)"); - #if HAS_LCD_MENU + #if HAS_DISPLAY ui.status_printf_P(0, PSTR(MSG_LCD_TILTING_MESH " 3/3")); #endif @@ -1485,7 +1487,7 @@ if (!abort_flag) { SERIAL_ECHOLNPAIR("Tilting mesh point ", current, "/", total_points, "\n"); - #if HAS_LCD_MENU + #if HAS_DISPLAY ui.status_printf_P(0, PSTR(MSG_LCD_TILTING_MESH " %i/%i"), current, total_points); #endif diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index b7927b4fa2..667bf3e9fc 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -36,7 +36,7 @@ #include "../../../module/probe.h" #include "../../queue.h" -#if BOTH(LCD_BED_LEVELING, PROBE_MANUALLY) +#if HAS_DISPLAY #include "../../../lcd/ultralcd.h" #endif @@ -254,8 +254,8 @@ G29_TYPE GcodeSuite::G29() { ABL_VAR int indexIntoAB[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; - ABL_VAR float eqnAMatrix[GRID_MAX_POINTS * 3], // "A" matrix of the linear system of equations - eqnBVector[GRID_MAX_POINTS], // "B" vector of Z points + ABL_VAR float eqnAMatrix[(GRID_MAX_POINTS) * 3], // "A" matrix of the linear system of equations + eqnBVector[GRID_MAX_POINTS], // "B" vector of Z points mean; #endif @@ -311,8 +311,7 @@ G29_TYPE GcodeSuite::G29() { const float rx = RAW_X_POSITION(parser.linearval('X', NAN)), ry = RAW_Y_POSITION(parser.linearval('Y', NAN)); - int8_t i = parser.byteval('I', -1), - j = parser.byteval('J', -1); + int8_t i = parser.byteval('I', -1), j = parser.byteval('J', -1); if (!isnan(rx) && !isnan(ry)) { // Get nearest i / j from rx / ry @@ -689,8 +688,11 @@ G29_TYPE GcodeSuite::G29() { zig ^= true; // zag + // An index to print current state + uint8_t pt_index = (PR_OUTER_VAR) * (PR_INNER_END) + 1; + // Inner loop is Y with PROBE_Y_FIRST enabled - for (int8_t PR_INNER_VAR = inStart; PR_INNER_VAR != inStop; PR_INNER_VAR += inInc) { + for (int8_t PR_INNER_VAR = inStart; PR_INNER_VAR != inStop; pt_index++, PR_INNER_VAR += inInc) { const float xBase = left_probe_bed_position + xGridSpacing * xCount, yBase = front_probe_bed_position + yGridSpacing * yCount; @@ -707,11 +709,16 @@ G29_TYPE GcodeSuite::G29() { if (!position_is_reachable_by_probe(xProbe, yProbe)) continue; #endif + if (verbose_level) SERIAL_ECHOLNPAIR("Probing mesh point ", int(pt_index), "/", int(GRID_MAX_POINTS), "."); + #if HAS_DISPLAY + ui.status_printf_P(0, PSTR(MSG_PROBING_MESH " %i/%i"), int(pt_index), int(GRID_MAX_POINTS)); + #endif + measured_z = faux ? 0.001 * random(-100, 101) : probe_pt(xProbe, yProbe, raise_after, verbose_level); if (isnan(measured_z)) { set_bed_leveling_enabled(abl_should_enable); - break; + break; // Breaks out of both loops } #if ENABLED(AUTO_BED_LEVELING_LINEAR) @@ -744,6 +751,11 @@ G29_TYPE GcodeSuite::G29() { // Probe at 3 arbitrary points for (uint8_t i = 0; i < 3; ++i) { + if (verbose_level) SERIAL_ECHOLNPAIR("Probing point ", int(i), "/3."); + #if HAS_DISPLAY + ui.status_printf_P(0, PSTR(MSG_PROBING_MESH " %i/3"), int(i)); + #endif + // Retain the last probe position xProbe = points[i].x; yProbe = points[i].y; @@ -770,6 +782,10 @@ G29_TYPE GcodeSuite::G29() { #endif // AUTO_BED_LEVELING_3POINT + #if HAS_DISPLAY + ui.reset_status(); + #endif + // Stow the probe. No raise for FIX_MOUNTED_PROBE. if (STOW_PROBE()) { set_bed_leveling_enabled(abl_should_enable); diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index 5e01a24267..c5ec63eee5 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -95,6 +95,7 @@ #define MSG_LEVEL_CORNERS _UxGT("Ecken nivellieren") #define MSG_NEXT_CORNER _UxGT("Nächste Ecke") #define MSG_EDITING_STOPPED _UxGT("Netzbearb. angeh.") +#define MSG_PROBING_MESH _UxGT("Messpunkt") #define MSG_MESH_X _UxGT("Index X") #define MSG_MESH_Y _UxGT("Index Y") #define MSG_MESH_EDIT_Z _UxGT("Z-Wert") @@ -103,7 +104,6 @@ #define MSG_UBL_UNHOMED _UxGT("Home XYZ zuerst") #define MSG_UBL_TOOLS _UxGT("UBL-Werkzeuge") #define MSG_UBL_LEVEL_BED _UxGT("Unified Bed Leveling") -#define MSG_LCD_PROBING_MESH _UxGT("Messpunkt") #define MSG_LCD_TILTING_MESH _UxGT("Berührungspunkt") #define MSG_IDEX_MENU _UxGT("IDEX-Modus") #define MSG_OFFSETS_MENU _UxGT("Werkzeugversätze") diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index a54318c8ba..7b5f779006 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -235,6 +235,9 @@ #ifndef MSG_EDITING_STOPPED #define MSG_EDITING_STOPPED _UxGT("Mesh Editing Stopped") #endif +#ifndef MSG_PROBING_MESH + #define MSG_PROBING_MESH _UxGT("Probing point") +#endif #ifndef MSG_MESH_X #define MSG_MESH_X _UxGT("Index X") #endif @@ -259,9 +262,6 @@ #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 diff --git a/Marlin/src/lcd/language/language_fr.h b/Marlin/src/lcd/language/language_fr.h index a933956532..13ff8a319b 100644 --- a/Marlin/src/lcd/language/language_fr.h +++ b/Marlin/src/lcd/language/language_fr.h @@ -90,6 +90,7 @@ #define MSG_LEVEL_CORNERS _UxGT("Niveau coins") #define MSG_NEXT_CORNER _UxGT("Coin suivant") #define MSG_EDITING_STOPPED _UxGT("Arrêt édit. maillage") +#define MSG_PROBING_MESH _UxGT("Mesure point") #define MSG_MESH_X _UxGT("Index X") #define MSG_MESH_Y _UxGT("Index Y") #define MSG_MESH_EDIT_Z _UxGT("Valeur Z") @@ -99,7 +100,6 @@ #define MSG_UBL_UNHOMED _UxGT("Origine XYZ requise") #define MSG_UBL_TOOLS _UxGT("Outils UBL") #define MSG_UBL_LEVEL_BED _UxGT("Niveau lit unifié") -#define MSG_LCD_PROBING_MESH _UxGT("Mesure point") #define MSG_LCD_TILTING_MESH _UxGT("Touche point") #define MSG_M48_TEST _UxGT("Ecart sonde Z M48") #define MSG_M48_DEVIATION _UxGT("Ecart") diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index e1a7f0afb4..22abdd9784 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -93,6 +93,7 @@ #define MSG_LEVEL_CORNERS _UxGT("Livella spigoli") #define MSG_NEXT_CORNER _UxGT("Prossimo spigolo") #define MSG_EDITING_STOPPED _UxGT("Modif. Mesh Fermata") +#define MSG_PROBING_MESH _UxGT("Punto sondato") #define MSG_MESH_X _UxGT("Indice X") #define MSG_MESH_Y _UxGT("Indice Y") #define MSG_MESH_EDIT_Z _UxGT("Valore di Z") @@ -101,7 +102,6 @@ #define MSG_UBL_UNHOMED _UxGT("Home XYZ prima") #define MSG_UBL_TOOLS _UxGT("Strumenti UBL") #define MSG_UBL_LEVEL_BED _UxGT("Unified Bed Leveling") -#define MSG_LCD_PROBING_MESH _UxGT("Punto sondato") #define MSG_LCD_TILTING_MESH _UxGT("Punto inclinaz.") #define MSG_M48_TEST _UxGT("Test sonda M48") #define MSG_M48_DEVIATION _UxGT("Deviazione") diff --git a/Marlin/src/lcd/language/language_sk.h b/Marlin/src/lcd/language/language_sk.h index df20a068dd..0b59137035 100644 --- a/Marlin/src/lcd/language/language_sk.h +++ b/Marlin/src/lcd/language/language_sk.h @@ -101,6 +101,7 @@ #define MSG_LEVEL_CORNERS _UxGT("Vyrovnať rohy") #define MSG_NEXT_CORNER _UxGT("Ďalší roh") #define MSG_EDITING_STOPPED _UxGT("Koniec úprav siete") +#define MSG_PROBING_MESH _UxGT("Skúšam bod") #define MSG_MESH_X _UxGT("Index X") #define MSG_MESH_Y _UxGT("Index Y") #define MSG_MESH_EDIT_Z _UxGT("Hodnota Z") @@ -110,7 +111,6 @@ #define MSG_UBL_UNHOMED _UxGT("Prejdite domov") #define MSG_UBL_TOOLS _UxGT("Nástroje UBL") #define MSG_UBL_LEVEL_BED _UxGT("UBL rovnanie") -#define MSG_LCD_PROBING_MESH _UxGT("Skúšam bod") #define MSG_LCD_TILTING_MESH _UxGT("Vyrovnávam bod") #define MSG_IDEX_MENU _UxGT("IDEX režim") #define MSG_OFFSETS_MENU _UxGT("Ofset nástrojov")