From b47fd31c376d1d38a4200b8dc63cb5b817978c83 Mon Sep 17 00:00:00 2001
From: Scott Lahteine <sourcetree@thinkyhead.com>
Date: Sat, 1 Apr 2017 20:06:12 -0500
Subject: [PATCH] Revert some changes to UBL

---
 Marlin/G26_Mesh_Validation_Tool.cpp           | 23 +++++++++++--------
 Marlin/SanityCheck.h                          |  2 ++
 Marlin/UBL_G29.cpp                            |  6 ++---
 .../TinyBoy2/Configuration.h                  |  2 +-
 4 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/Marlin/G26_Mesh_Validation_Tool.cpp b/Marlin/G26_Mesh_Validation_Tool.cpp
index 8d250de4854..b67b080ceac 100644
--- a/Marlin/G26_Mesh_Validation_Tool.cpp
+++ b/Marlin/G26_Mesh_Validation_Tool.cpp
@@ -36,24 +36,27 @@
   #include "UBL.h"
   #include "ultralcd.h"
 
-  #define EXTRUSION_MULTIPLIER 1.0    // This is too much clutter for the main Configuration.h file  But
-  #define RETRACTION_MULTIPLIER 1.0   // some user have expressed an interest in being able to customize
-  #define NOZZLE 0.3                  // these numbers for their printer so they don't need to type all
-  #define FILAMENT 1.75               // the options every time they do a Mesh Validation Print.
+  #define EXTRUSION_MULTIPLIER 1.0
+  #define RETRACTION_MULTIPLIER 1.0
+  #define NOZZLE 0.3
+  #define FILAMENT 1.75
   #define LAYER_HEIGHT 0.2
-  #define PRIME_LENGTH 10.0           // So, we put these number in an easy to find and change place.
+  #define PRIME_LENGTH 10.0
   #define BED_TEMP 60.0
   #define HOTEND_TEMP 205.0
   #define OOZE_AMOUNT 0.3
 
   #define SIZE_OF_INTERSECTION_CIRCLES 5
-  #define SIZE_OF_CROSSHAIRS 3 // crosshairs inside the circle.  This number should be
-                               // less than SIZE_OR_INTERSECTION_CIRCLES
+  #define SIZE_OF_CROSSHAIRS 3
+
+  #if SIZE_OF_CROSSHAIRS >= SIZE_OF_INTERSECTION_CIRCLES
+    #error "SIZE_OF_CROSSHAIRS must be less than SIZE_OF_INTERSECTION_CIRCLES."
+  #endif
 
   /**
-   *   Roxy's G26 Mesh Validation Tool
+   *   G26 Mesh Validation Tool
    *
-   *   G26 Is a Mesh Validation Tool intended to provide support for the Marlin Unified Bed Leveling System.
+   *   G26 is a Mesh Validation Tool intended to provide support for the Marlin Unified Bed Leveling System.
    *   In order to fully utilize and benefit from the Marlin Unified Bed Leveling System an accurate Mesh must
    *   be defined.  G29 is designed to allow the user to quickly validate the correctness of her Mesh.  It will
    *   first heat the bed and nozzle. It will then print lines and circles along the Mesh Cell boundaries and
@@ -118,7 +121,7 @@
   //#if ENABLED(ULTRA_LCD)
     extern char lcd_status_message[];
   //#endif
-  extern float destination[];
+  extern float destination[XYZE];
   extern void set_destination_to_current();
   extern void set_current_to_destination();
   extern float code_value_float();
diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h
index 5ab7181c689..002d423a565 100644
--- a/Marlin/SanityCheck.h
+++ b/Marlin/SanityCheck.h
@@ -150,6 +150,8 @@
   #error "ABL_GRID_POINTS is now ABL_GRID_MAX_POINTS_X and ABL_GRID_MAX_POINTS_Y. Please update your configuration."
 #elif defined(ABL_GRID_POINTS_X) || defined(ABL_GRID_POINTS_Y)
   #error "ABL_GRID_POINTS_[XY] is now ABL_GRID_MAX_POINTS_[XY]. Please update your configuration."
+#elif defined(UBL_MESH_EDIT_ENABLED)
+  #error "UBL_MESH_EDIT_ENABLED is now UBL_G26_MESH_EDITING. Please update your configuration."
 #elif defined(BEEPER)
   #error "BEEPER is now BEEPER_PIN. Please update your pins definitions."
 #elif defined(SDCARDDETECT)
diff --git a/Marlin/UBL_G29.cpp b/Marlin/UBL_G29.cpp
index faf1790e463..9b7ccadd9ed 100644
--- a/Marlin/UBL_G29.cpp
+++ b/Marlin/UBL_G29.cpp
@@ -22,7 +22,7 @@
 
 #include "MarlinConfig.h"
 
-#if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(UBL_G26_MESH_EDITING)
+#if ENABLED(AUTO_BED_LEVELING_UBL)
   //#include "vector_3.h"
   //#include "qr_solve.h"
 
@@ -1048,7 +1048,7 @@
 
     /*
     if (code_seen('M')) {     // Check if a map type was specified
-      map_type = code_has_value() ? code_value_int() : 0; 
+      map_type = code_has_value() ? code_value_int() : 0;
       if (!WITHIN(map_type, 0, 1)) {
         SERIAL_PROTOCOLLNPGM("Invalid map type.\n");
         return UBL_ERR;
@@ -1371,7 +1371,7 @@
       do_blocking_move_to_xy(LOGICAL_X_POSITION(rawx), LOGICAL_Y_POSITION(rawy));
 
       float new_z = ubl.z_values[location.x_index][location.y_index];
-      
+
       round_off = (int32_t)(new_z * 1000.0);    // we chop off the last digits just to be clean. We are rounding to the
       new_z = float(round_off) / 1000.0;
 
diff --git a/Marlin/example_configurations/TinyBoy2/Configuration.h b/Marlin/example_configurations/TinyBoy2/Configuration.h
index ebf0c9dc16a..7e2cf0eacf0 100644
--- a/Marlin/example_configurations/TinyBoy2/Configuration.h
+++ b/Marlin/example_configurations/TinyBoy2/Configuration.h
@@ -918,7 +918,7 @@
   #define UBL_PROBE_PT_2_Y 20
   #define UBL_PROBE_PT_3_X 180
   #define UBL_PROBE_PT_3_Y 20
-  #define UBL_MESH_EDIT_ENABLED     // Enable G26 mesh editing
+  #define UBL_G26_MESH_EDITING     // Enable G26 mesh editing
 
 #elif ENABLED(MESH_BED_LEVELING)