From f7127c44f88ea7917050b0149f204b8bf0d9bad3 Mon Sep 17 00:00:00 2001
From: Ludy <Ludy87@users.noreply.github.com>
Date: Fri, 21 Dec 2018 00:30:36 +0100
Subject: [PATCH]  Wanhao Duplicator i3 Plus pins create (#12701)

---
 Marlin/src/core/boards.h                  |   2 +
 Marlin/src/pins/pins.h                    |   4 +-
 Marlin/src/pins/pins_DUPLICATOR_I3_PLUS.h | 183 ++++++++++++++++++++++
 Marlin/src/pins/pins_MEGATRONICS_3.h      |   8 +-
 4 files changed, 193 insertions(+), 4 deletions(-)
 create mode 100644 Marlin/src/pins/pins_DUPLICATOR_I3_PLUS.h

diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h
index a01e463b41..a2f5c5d595 100644
--- a/Marlin/src/core/boards.h
+++ b/Marlin/src/core/boards.h
@@ -85,6 +85,7 @@
 #define BOARD_RAMPS_ENDER_4     243   // Creality: Ender-4, CR-8
 #define BOARD_RAMPS_CREALITY    244   // Creality: CR10S, CR20, CR-X
 #define BOARD_FYSETC_F6_13      541   // Fysetc F6
+#define BOARD_DUPLICATOR_I3_PLUS 31   // Wanhao Duplicator i3 Plus
 
 //
 // Other ATmega1280, ATmega2560
@@ -99,6 +100,7 @@
 #define BOARD_MEGATRONICS_2     701   // Megatronics v2.0
 #define BOARD_MEGATRONICS_3     703   // Megatronics v3.0
 #define BOARD_MEGATRONICS_31    704   // Megatronics v3.1
+#define BOARD_MEGATRONICS_32    705   // Megatronics v3.2
 #define BOARD_RAMBO             301   // Rambo
 #define BOARD_MINIRAMBO         302   // Mini-Rambo
 #define BOARD_MINIRAMBO_10A     303   // Mini-Rambo 1.0a
diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h
index 75f5e7bf12..bdc0d34d1e 100644
--- a/Marlin/src/pins/pins.h
+++ b/Marlin/src/pins/pins.h
@@ -156,6 +156,8 @@
   #include "pins_RAMPS_CREALITY.h"    // ATmega2560                                 env:megaatmega2560
 #elif MB(FYSETC_F6_13)
   #include "pins_FYSETC_F6_13.h"      // ATmega2560                                 env:megaatmega2560
+#elif MB(DUPLICATOR_I3_PLUS)
+  #include "pins_DUPLICATOR_I3_PLUS.h" // ATmega2560                                 env:megaatmega2560
 
 //
 // Other ATmega1280, ATmega2560
@@ -175,7 +177,7 @@
   #include "pins_MEGATRONICS.h"       // ATmega2560                                 env:megaatmega2560
 #elif MB(MEGATRONICS_2)
   #include "pins_MEGATRONICS_2.h"     // ATmega2560                                 env:megaatmega2560
-#elif MB(MEGATRONICS_3) || MB(MEGATRONICS_31)
+#elif MB(MEGATRONICS_3) || MB(MEGATRONICS_31) || MB(MEGATRONICS_32)
   #include "pins_MEGATRONICS_3.h"     // ATmega2560                                 env:megaatmega2560
 #elif MB(RAMBO)
   #include "pins_RAMBO.h"             // ATmega2560                                 env:rambo
diff --git a/Marlin/src/pins/pins_DUPLICATOR_I3_PLUS.h b/Marlin/src/pins/pins_DUPLICATOR_I3_PLUS.h
new file mode 100644
index 0000000000..db22944646
--- /dev/null
+++ b/Marlin/src/pins/pins_DUPLICATOR_I3_PLUS.h
@@ -0,0 +1,183 @@
+/**
+ * Marlin 3D Printer Firmware
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ *
+ * Based on Sprinter and grbl.
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/**
+ * Wanhao Duplicator i3 Plus pin assignments
+ */
+
+#ifndef __AVR_ATmega2560__
+  #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'"
+#endif
+
+#define BOARD_NAME         "Duplicator i3 Plus"
+
+//
+// Limit Switches
+//
+#define X_STOP_PIN         54   // PF0 / A0
+#define Y_STOP_PIN         24   // PA2 / AD2
+#define Z_MIN_PIN          23   // PA1 / AD1
+#define Z_MAX_PIN          25   // PA3 / AD3
+#define SERVO0_PIN         40   // PG1 / !RD
+
+//
+// Steppers
+//
+#define X_STEP_PIN         61   // PF7 / A7
+#define X_DIR_PIN          62   // PK0 / A8
+#define X_ENABLE_PIN       60   // PF6 / A6
+
+#define Y_STEP_PIN         64   // PK2 / A10
+#define Y_DIR_PIN          65   // PK3 / A11
+#define Y_ENABLE_PIN       63   // PK1 / A9
+
+#define Z_STEP_PIN         67   // PK5 / A13
+#define Z_DIR_PIN          69   // PK7 / A15
+#define Z_ENABLE_PIN       66   // PK4 / A12
+#define Z_MIN_PROBE_PIN    25   // PA3 / AD3
+
+#define E0_STEP_PIN        58   // PF4 / A4
+#define E0_DIR_PIN         59   // PF5 / A5
+#define E0_ENABLE_PIN      57   // PF3 / A3
+
+//
+// Temperature Sensors
+//
+#define TEMP_0_PIN          1   // PF1 / A1   Analog
+#define TEMP_BED_PIN       14   // PK6 / A14  Analog
+
+//
+// Heaters / Fans
+//
+#define HEATER_0_PIN        4   // PG5 / PWM4
+#define HEATER_BED_PIN      3   // PE5 / PWM3
+
+#define FAN_PIN             5   // PE3 / PWM5
+
+//
+// Misc. Functions
+//
+#define SDSS               53   // PB0 / SS
+#define LED_PIN            13   // PB7 / PWM13
+
+#define MISO_PIN           50   // PB3
+#define MOSI_PIN           51   // PB2
+#define SCK_PIN            52   // PB1
+
+//
+// LCDs and Controllers
+//
+#if ENABLED(ULTRA_LCD)
+  #if ENABLED(ZONESTAR_LCD)
+    #define LCD_PINS_RS        2
+    #define LCD_PINS_ENABLE   36
+    #define LCD_PINS_D4       37
+    #define LCD_PINS_D5       34
+    #define LCD_PINS_D6       35
+    #define LCD_PINS_D7       32
+    #define ADC_KEYPAD_PIN    12   // Analog
+  #endif
+#endif
+
+/**
+ *  == EXT connector ==
+ *
+ *         2  4  6  8  10
+ *       #---------------#
+ *  #2   | °  °  °  °  ° |
+ *  #1   | °  °  °  °  ° |
+ *       #---------------#
+ *         1  3  5  7  9
+ *
+ * ##################################
+ * # Pin | ATMEGA2560 Pin | Arduino #
+ * ##################################
+ * #  1  | 52 / PG1 (!RD) |    40   #
+ * #  2  | 95 / PF2 (A2)  |     2   #
+ * #  3  | 54 / PC1 (A9)  |    36   #
+ * #  4  | 53 / PC0 (A8)  |    37   #
+ * #  5  | 56 / PC3 (A11) |    34   #
+ * #  6  | 55 / PC2 (A10) |    35   #
+ * #  7  | 58 / PC5 (A13) |    32   #
+ * #  8  | 57 / PC4 (A12) |    33   #
+ * #  9  |       GND      |     -   #
+ * # 10  |       VCC      |     +   #
+ * ##################################
+ *
+ * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+ *
+ *  == Z-probe connector ==
+ *
+ *          1  2  3
+ *        #---------#
+ *        | °  °  ° |
+ *        #---------#
+ *
+ * ##################################
+ * # Pin | ATMEGA2560 Pin | Arduino #
+ * ##################################
+ * #  1  |    24V or 5V   |     +   #
+ * #  2  | 75 / PA3 (AD3) |    25   #
+ * #  3  |       GND      |     -   #
+ * ##################################
+ *
+ * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+ * 
+ *  == Y-endstop ==                            == Z-endstop ==                 == Bed temperature ==
+ *
+ *        1  2                                       1  2                               1  2
+ *      #------#                                   #------#                           #------#
+ *      | °  ° |                                   | °  ° |                           | °  ° |
+ *      #------#                                   #------#                           #------#
+ *
+ * ############### Y ################ ############### Z ################ ############## BED ###############
+ * # Pin | ATMEGA2560 Pin | Arduino # # Pin | ATMEGA2560 Pin | Arduino # # Pin | ATMEGA2560 Pin | Arduino #
+ * ################################## ################################## ##################################
+ * #  1  |       GND      |     -   # #  1  |       GND      |     -   # #  1  |       GND      |     -   #
+ * #  2  | 76 / PA2 (AD2) |    24   # #  2  | 77 / PA1 (AD1) |    23   # #  2  |83 / PK6 (ADC14)|    14   #
+ * ################################## ################################## ##################################
+ *
+ * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+ *
+ *  == SPI connector ==
+ *
+ *        5  3  1
+ *      #---------#
+ *      | °  °  ° |
+ *      | °  °  ° |
+ *      #---------#
+ *        6  4  2
+ *
+ * ##################################
+ * # Pin | ATMEGA2560 Pin | Arduino #
+ * ##################################
+ * #  1  | 22 / PB3 (MISO)|    50   #
+ * #  2  |       VCC      |     +   #
+ * #  3  | 20 / PB1 (SCK) |    52   #
+ * #  4  | 21 / PB2 (MOSI)|    51   #
+ * #  5  | 30 / !RESET    |  RESET  #
+ * #  6  |       GND      |     -   #
+ * ##################################
+ *
+ * Pictogram by Ludy https://github.com/Ludy87
+ * See: https://sebastien.andrivet.com/en/posts/wanhao-duplicator-i3-plus-3d-printer/
+ */
diff --git a/Marlin/src/pins/pins_MEGATRONICS_3.h b/Marlin/src/pins/pins_MEGATRONICS_3.h
index 51c5c6a878..5a5b901413 100644
--- a/Marlin/src/pins/pins_MEGATRONICS_3.h
+++ b/Marlin/src/pins/pins_MEGATRONICS_3.h
@@ -21,14 +21,16 @@
  */
 
 /**
- * MegaTronics v3.0 / v3.1 pin assignments
+ * MegaTronics v3.0 / v3.1 / v3.2 pin assignments
  */
 
 #ifndef __AVR_ATmega2560__
   #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'"
 #endif
 
-#if MB(MEGATRONICS_31)
+#if MB(MEGATRONICS_32)
+  #define BOARD_NAME "Megatronics v3.2"
+#elif MB(MEGATRONICS_31)
   #define BOARD_NAME "Megatronics v3.1"
 #else
   #define BOARD_NAME "Megatronics v3.0"
@@ -161,7 +163,7 @@
   #define SHIFT_OUT        34
   #define SHIFT_EN         44
 
-  #if MB(MEGATRONICS_31)
+  #if MB(MEGATRONICS_31) || MB(MEGATRONICS_32)
     #define SD_DETECT_PIN  56
   #endif
 
-- 
GitLab