From 60471b75920f22868593f7268289ce34a15443fe Mon Sep 17 00:00:00 2001
From: Bob-the-Kuhn <bob.kuhn@att.net>
Date: Fri, 14 Apr 2017 23:47:11 -0500
Subject: [PATCH] minor improvements

Configuration_store.cpp - changed a couple of print statements so the
values were printed.  The old method resulted in the formula being
printed.

ubl_G29
1) added support for R option to P4.  Now probes all points unless R is
present and the number is greater than 0.

2) P2 - moved map print statement so it showed the point that was
currently being probed,  The old location did this only for the first
point.

3) P4 - Moved the map print for the same reason.

ultralcd.cpp - changed "Mesh Editor :" to "Mesh Editor" because the LCD
draw routine puts a ":" in automatically so you end up with an extra ":"
using the old message.
---
 Marlin/configuration_store.cpp |  4 ++--
 Marlin/ubl_G29.cpp             | 13 +++++++++----
 Marlin/ultralcd.cpp            |  4 ++--
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/Marlin/configuration_store.cpp b/Marlin/configuration_store.cpp
index d19296d2b89..5fb34f0087a 100644
--- a/Marlin/configuration_store.cpp
+++ b/Marlin/configuration_store.cpp
@@ -1339,8 +1339,8 @@ void MarlinSettings::reset() {
         SERIAL_ECHOLNPGM("UBL_MESH_MAX_X     " STRINGIFY(UBL_MESH_MAX_X));
         SERIAL_ECHOLNPGM("UBL_MESH_MAX_Y     " STRINGIFY(UBL_MESH_MAX_Y));
 
-        SERIAL_ECHOLNPGM("MESH_X_DIST        " STRINGIFY(MESH_X_DIST));
-        SERIAL_ECHOLNPGM("MESH_Y_DIST        " STRINGIFY(MESH_Y_DIST));
+        SERIAL_ECHOLNPAIR("MESH_X_DIST        ", MESH_X_DIST);
+        SERIAL_ECHOLNPAIR("MESH_Y_DIST        ", MESH_Y_DIST);
         SERIAL_EOL;
       }
 
diff --git a/Marlin/ubl_G29.cpp b/Marlin/ubl_G29.cpp
index c0b54fc1b29..c0a9af8078d 100644
--- a/Marlin/ubl_G29.cpp
+++ b/Marlin/ubl_G29.cpp
@@ -47,6 +47,7 @@
   extern float meshedit_done;
   extern long babysteps_done;
   extern float code_value_float();
+  extern uint8_t code_value_byte();
   extern bool code_value_bool();
   extern bool code_has_value();
   extern float probe_pt(float x, float y, bool, int);
@@ -920,8 +921,6 @@
     float last_x = -9999.99, last_y = -9999.99;
     mesh_index_pair location;
     do {
-      if (do_ubl_mesh_map) ubl.display_map(map_type);
-
       location = find_closest_mesh_point_of_type(INVALID, lx, ly, 0, NULL, false); // The '0' says we want to use the nozzle's position
       // It doesn't matter if the probe can't reach the NAN location. This is a manual probe.
       if (location.x_index < 0 && location.y_index < 0) continue;
@@ -955,6 +954,8 @@
       KEEPALIVE_STATE(PAUSED_FOR_USER);
       ubl.has_control_of_lcd_panel = true;
 
+      if (do_ubl_mesh_map) ubl.display_map(map_type);  // show user where we're probing
+
       while (!ubl_lcd_clicked()) {     // we need the loop to move the nozzle based on the encoder wheel here!
         idle();
         if (ubl.encoder_diff) {
@@ -1364,6 +1365,10 @@
   }
 
   void fine_tune_mesh(const float &lx, const float &ly, const bool do_ubl_mesh_map) {
+    // do all mesh points unless R option has a value of 1 or more
+    repetition_cnt = code_seen('R') && code_has_value() ? code_value_byte() : GRID_MAX_POINTS_X * GRID_MAX_POINTS_Y;
+    if (repetition_cnt == 0) repetition_cnt = GRID_MAX_POINTS_X * GRID_MAX_POINTS_Y;
+
     mesh_index_pair location;
     uint16_t not_done[16];
     int32_t round_off;
@@ -1376,8 +1381,6 @@
     do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
     do_blocking_move_to_xy(lx, ly);
     do {
-      if (do_ubl_mesh_map) ubl.display_map(map_type);
-
       location = find_closest_mesh_point_of_type(SET_IN_BITMAP, lx, ly, 0, not_done, false); // The '0' says we want to use the nozzle's position
                                                                                               // It doesn't matter if the probe can not reach this
                                                                                               // location. This is a manual edit of the Mesh Point.
@@ -1408,6 +1411,8 @@
       KEEPALIVE_STATE(PAUSED_FOR_USER);
       ubl.has_control_of_lcd_panel = true;
 
+      if (do_ubl_mesh_map) ubl.display_map(map_type);  // show the user which point is being adjusted
+
       lcd_implementation_clear();
       lcd_mesh_edit_setup(new_z);
 
diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp
index 97744deef38..91ffb9c87e2 100755
--- a/Marlin/ultralcd.cpp
+++ b/Marlin/ultralcd.cpp
@@ -915,12 +915,12 @@ void kill_screen(const char* lcd_msg) {
     }
 
     void _lcd_mesh_edit() {
-      _lcd_mesh_fine_tune(PSTR("Mesh Editor: "));
+      _lcd_mesh_fine_tune(PSTR("Mesh Editor"));
     }
 
     float lcd_mesh_edit() {
       lcd_goto_screen(_lcd_mesh_edit_NOP);
-      _lcd_mesh_fine_tune(PSTR("Mesh Editor: "));
+      _lcd_mesh_fine_tune(PSTR("Mesh Editor"));
       return mesh_edit_value;
     }