From 15d05748dfeee7573bfad03048714d9d38f64b36 Mon Sep 17 00:00:00 2001
From: Scott Lahteine <github@thinkyhead.com>
Date: Fri, 15 Dec 2017 19:05:57 -0600
Subject: [PATCH] Adding support for the Tronxy and Zonestar LCD

---
 Marlin/Configuration.h                 |  6 ++++--
 Marlin/src/inc/Conditionals_LCD.h      |  2 +-
 Marlin/src/inc/SanityCheck.h           |  6 ++++--
 Marlin/src/pins/pins_ANET_10.h         |  4 ++--
 Marlin/src/pins/pins_RAMPS.h           |  4 ++--
 Marlin/src/pins/pins_SANGUINOLOLU_11.h | 16 +++++++++++++++-
 6 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h
index 17a87ef322..c60aea5186 100644
--- a/Marlin/Configuration.h
+++ b/Marlin/Configuration.h
@@ -1516,11 +1516,13 @@
 //#define CARTESIO_UI
 
 //
-// ANET_10 Controller supported displays.
+// ANET and Tronxy Controller supported displays.
 //
-//#define ANET_KEYPAD_LCD         // Requires ADC_KEYPAD_PIN to be assigned to an analog pin.
+//#define ZONESTAR_LCD            // Requires ADC_KEYPAD_PIN to be assigned to an analog pin.
                                   // This LCD is known to be susceptible to electrical interference
                                   // which scrambles the display.  Pressing any button clears it up.
+                                  // This is a LCD2004 display with 5 analog buttons.
+
 //#define ANET_FULL_GRAPHICS_LCD  // Anet 128x64 full graphics lcd with rotary encoder as used on Anet A6
                                   // A clone of the RepRapDiscount full graphics display but with
                                   // different pins/wiring (see pins_ANET_10.h).
diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h
index 6be8a1a6f2..63d7e81948 100644
--- a/Marlin/src/inc/Conditionals_LCD.h
+++ b/Marlin/src/inc/Conditionals_LCD.h
@@ -42,7 +42,7 @@
 
   #define U8GLIB_ST7565_64128N
 
-#elif ENABLED(ANET_KEYPAD_LCD)
+#elif ENABLED(ZONESTAR_LCD)
 
   #define REPRAPWORLD_KEYPAD
   #define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0
diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h
index 279c73b9b0..b06bf49354 100644
--- a/Marlin/src/inc/SanityCheck.h
+++ b/Marlin/src/inc/SanityCheck.h
@@ -229,6 +229,8 @@
   #error "K1 is now PID_K1. Please update your configuration."
 #elif defined(PROBE_DOUBLE_TOUCH)
   #error "PROBE_DOUBLE_TOUCH is now MULTIPLE_PROBING. Please update your configuration."
+#elif defined(ANET_KEYPAD_LCD)
+  #error "ANET_KEYPAD_LCD is now ZONESTAR_LCD. Please update your configuration."
 #endif
 
 /**
@@ -1359,7 +1361,7 @@ static_assert(1 >= 0
   #endif
   #if ENABLED(REPRAPWORLD_KEYPAD) \
       && DISABLED(CARTESIO_UI) \
-      && DISABLED(ANET_KEYPAD_LCD)
+      && DISABLED(ZONESTAR_LCD)
     + 1
   #endif
   #if ENABLED(RIGIDBOT_PANEL)
@@ -1395,7 +1397,7 @@ static_assert(1 >= 0
   #if ENABLED(OLED_PANEL_TINYBOY2)
     + 1
   #endif
-  #if ENABLED(ANET_KEYPAD_LCD)
+  #if ENABLED(ZONESTAR_LCD)
     + 1
   #endif
   , "Please select no more than one LCD controller option."
diff --git a/Marlin/src/pins/pins_ANET_10.h b/Marlin/src/pins/pins_ANET_10.h
index 02c614c65b..91159cf892 100644
--- a/Marlin/src/pins/pins_ANET_10.h
+++ b/Marlin/src/pins/pins_ANET_10.h
@@ -145,7 +145,7 @@
  * LCD / Controller
  *
  * Only the following displays are supported:
- *  ANET_KEYPAD_LCD
+ *  ZONESTAR_LCD
  *  ANET_FULL_GRAPHICS_LCD
  *  REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
 */
@@ -209,7 +209,7 @@
  * ===================== LCD PINOUTS ==================================
  * ====================================================================
  *
- *   Anet V1.0 controller           | ANET_KEYPAD_LCD   | ANET_FULL_      | RepRapDiscount Full      | Thingiverse RepRap wiring
+ *   Anet V1.0 controller           | ZONESTAR_LCD      | ANET_FULL_      | RepRapDiscount Full      | Thingiverse RepRap wiring
  *   physical   logical   alt       |                   | GRAPHICS_LCD    | Graphics Display Wiring  | http://www.thingiverse
  *     pin        pin     functions |                   |                 |                          | .com/thing:2103748
  *------------------------------------------------------------------------------------------------------------------------
diff --git a/Marlin/src/pins/pins_RAMPS.h b/Marlin/src/pins/pins_RAMPS.h
index 1717ed8bfd..539cdd9fa0 100644
--- a/Marlin/src/pins/pins_RAMPS.h
+++ b/Marlin/src/pins/pins_RAMPS.h
@@ -538,7 +538,7 @@
 
 #endif // ULTRA_LCD
 
-#if ENABLED(ANET_KEYPAD_LCD)
+#if ENABLED(ZONESTAR_LCD)
   #define LCD_PINS_RS        64
   #define LCD_PINS_ENABLE    44
   #define LCD_PINS_D4        63
@@ -550,4 +550,4 @@
   #define BTN_EN2            -1
   #define BTN_ENC            -1
   // pin 29 N/C
-#endif // ANET_KEYPAD_LCD
+#endif // ZONESTAR_LCD
diff --git a/Marlin/src/pins/pins_SANGUINOLOLU_11.h b/Marlin/src/pins/pins_SANGUINOLOLU_11.h
index 13da81cffb..00c2c58426 100644
--- a/Marlin/src/pins/pins_SANGUINOLOLU_11.h
+++ b/Marlin/src/pins/pins_SANGUINOLOLU_11.h
@@ -243,7 +243,21 @@
       #define ST7920_DELAY_3 DELAY_0_NOP
     #endif
 
-  #else  // !LCD_I2C_PANELOLU2 && !LCD_FOR_MELZI
+  #elif ENABLED(ZONESTAR_LCD) // For the Tronxy Melzi boards
+
+    #define LCD_PINS_RS         28
+    #define LCD_PINS_ENABLE     29
+    #define LCD_PINS_D4         10
+    #define LCD_PINS_D5         11
+    #define LCD_PINS_D6         16
+    #define LCD_PINS_D7         17
+    #define ADC_KEYPAD_PIN       1
+
+    // Not used
+    #define BTN_EN1             -1
+    #define BTN_EN2             -1
+
+  #else  // !LCD_I2C_PANELOLU2 && !LCD_FOR_MELZI && !ZONESTAR_LCD
 
     #define BTN_ENC             16
     #define LCD_SDSS            28 // Smart Controller SD card reader rather than the Melzi
-- 
GitLab