From bfd396c13ad65ac42898889dbfd104ac3e316f3d Mon Sep 17 00:00:00 2001
From: Scott Lahteine <github@thinkyhead.com>
Date: Fri, 28 Jul 2017 02:19:50 -0500
Subject: [PATCH] Patch to fix some compiler warnings

---
 Marlin/Marlin_main.cpp | 18 ++++++++++--------
 Marlin/pca9632.cpp     | 16 +++++++++-------
 Marlin/ultralcd.cpp    |  5 ++++-
 3 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp
index a415754b43..82cea9819e 100644
--- a/Marlin/Marlin_main.cpp
+++ b/Marlin/Marlin_main.cpp
@@ -1014,7 +1014,7 @@ void servo_init() {
     #if ENABLED(NEOPIXEL_RGBW_LED)
 
       const uint32_t color = pixels.Color(r, g, b, w);
-      static int nextLed = 0;
+      static uint16_t nextLed = 0;
 
       if (!isSequence)
         set_neopixel_color(color);
@@ -5602,12 +5602,14 @@ void home_all_axes() { gcode_G28(true); }
 
     bool G38_pass_fail = false;
 
-    // Get direction of move and retract
-    float retract_mm[XYZ];
-    LOOP_XYZ(i) {
-      float dist = destination[i] - current_position[i];
-      retract_mm[i] = FABS(dist) < G38_MINIMUM_MOVE ? 0 : home_bump_mm((AxisEnum)i) * (dist > 0 ? -1 : 1);
-    }
+    #if ENABLED(PROBE_DOUBLE_TOUCH)
+      // Get direction of move and retract
+      float retract_mm[XYZ];
+      LOOP_XYZ(i) {
+        float dist = destination[i] - current_position[i];
+        retract_mm[i] = FABS(dist) < G38_MINIMUM_MOVE ? 0 : home_bump_mm((AxisEnum)i) * (dist > 0 ? -1 : 1);
+      }
+    #endif
 
     stepper.synchronize();  // wait until the machine is idle
 
@@ -5671,7 +5673,7 @@ void home_all_axes() { gcode_G28(true); }
     // If any axis has enough movement, do the move
     LOOP_XYZ(i)
       if (FABS(destination[i] - current_position[i]) >= G38_MINIMUM_MOVE) {
-        if (!parser.seenval('F')) feedrate_mm_s = homing_feedrate(i);
+        if (!parser.seenval('F')) feedrate_mm_s = homing_feedrate((AxisEnum)i);
         // If G38.2 fails throw an error
         if (!G38_run_probe() && is_38_2) {
           SERIAL_ERROR_START();
diff --git a/Marlin/pca9632.cpp b/Marlin/pca9632.cpp
index d8853c4650..fe0647639d 100644
--- a/Marlin/pca9632.cpp
+++ b/Marlin/pca9632.cpp
@@ -88,13 +88,15 @@ static void PCA9632_WriteAllRegisters(const byte addr, const byte regadd, const
   Wire.endTransmission();
 }
 
-static byte PCA9632_ReadRegister(const byte addr, const byte regadd) {
-  Wire.beginTransmission(addr);
-  Wire.write(regadd);
-  const byte value = Wire.read();
-  Wire.endTransmission();
-  return value;
-}
+#if 0
+  static byte PCA9632_ReadRegister(const byte addr, const byte regadd) {
+    Wire.beginTransmission(addr);
+    Wire.write(regadd);
+    const byte value = Wire.read();
+    Wire.endTransmission();
+    return value;
+  }
+#endif
 
 void PCA9632_SetColor(const byte r, const byte g, const byte b) {
   if (!PCA_init) {
diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp
index 2acfd3d33a..2f894e1bce 100644
--- a/Marlin/ultralcd.cpp
+++ b/Marlin/ultralcd.cpp
@@ -1838,7 +1838,6 @@ void kill_screen(const char* lcd_msg) {
     void _lcd_ubl_level_bed();
 
     static int16_t ubl_storage_slot = 0,
-               custom_bed_temp = 50,
                custom_hotend_temp = 190,
                side_points = 3,
                ubl_fillin_amount = 5,
@@ -1847,6 +1846,10 @@ void kill_screen(const char* lcd_msg) {
                x_plot = 0,
                y_plot = 0;
 
+    #if HAS_TEMP_BED
+      static int16_t custom_bed_temp = 50;
+    #endif
+
     /**
      * UBL Build Custom Mesh Command
      */