From 76a65ffe7417eaa15e16bde825d36ac11a5ea56b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mika=20Nor=C3=A9n?=
 <33817034+SysGh-st@users.noreply.github.com>
Date: Sat, 16 May 2020 04:11:28 +0200
Subject: [PATCH] Vertex nano with board K8600 (#17736)

---
 Marlin/src/core/boards.h           |  99 +++++++++++-----------
 Marlin/src/pins/pins.h             |   2 +
 Marlin/src/pins/ramps/pins_K8600.h | 127 +++++++++++++++++++++++++++++
 3 files changed, 179 insertions(+), 49 deletions(-)
 create mode 100644 Marlin/src/pins/ramps/pins_K8600.h

diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h
index 826dc51d79a..aa6c7162cf4 100644
--- a/Marlin/src/core/boards.h
+++ b/Marlin/src/core/boards.h
@@ -56,55 +56,56 @@
 #define BOARD_3DRAG                   1100  // 3Drag Controller
 #define BOARD_K8200                   1101  // Velleman K8200 Controller (derived from 3Drag Controller)
 #define BOARD_K8400                   1102  // Velleman K8400 Controller (derived from 3Drag Controller)
-#define BOARD_BAM_DICE                1103  // 2PrintBeta BAM&DICE with STK drivers
-#define BOARD_BAM_DICE_DUE            1104  // 2PrintBeta BAM&DICE Due with STK drivers
-#define BOARD_MKS_BASE                1105  // MKS BASE v1.0
-#define BOARD_MKS_BASE_14             1106  // MKS BASE v1.4 with Allegro A4982 stepper drivers
-#define BOARD_MKS_BASE_15             1107  // MKS BASE v1.5 with Allegro A4982 stepper drivers
-#define BOARD_MKS_BASE_16             1108  // MKS BASE v1.6 with Allegro A4982 stepper drivers
-#define BOARD_MKS_BASE_HEROIC         1109  // MKS BASE 1.0 with Heroic HR4982 stepper drivers
-#define BOARD_MKS_GEN_13              1110  // MKS GEN v1.3 or 1.4
-#define BOARD_MKS_GEN_L               1111  // MKS GEN L
-#define BOARD_KFB_2                   1112  // BigTreeTech or BIQU KFB2.0
-#define BOARD_ZRIB_V20                1113  // zrib V2.0 control board (Chinese knock off RAMPS replica)
-#define BOARD_FELIX2                  1114  // Felix 2.0+ Electronics Board (RAMPS like)
-#define BOARD_RIGIDBOARD              1115  // Invent-A-Part RigidBoard
-#define BOARD_RIGIDBOARD_V2           1116  // Invent-A-Part RigidBoard V2
-#define BOARD_SAINSMART_2IN1          1117  // Sainsmart 2-in-1 board
-#define BOARD_ULTIMAKER               1118  // Ultimaker
-#define BOARD_ULTIMAKER_OLD           1119  // Ultimaker (Older electronics. Pre 1.5.4. This is rare)
-#define BOARD_AZTEEG_X3               1120  // Azteeg X3
-#define BOARD_AZTEEG_X3_PRO           1121  // Azteeg X3 Pro
-#define BOARD_ULTIMAIN_2              1122  // Ultimainboard 2.x (Uses TEMP_SENSOR 20)
-#define BOARD_RUMBA                   1123  // Rumba
-#define BOARD_RUMBA_RAISE3D           1124  // Raise3D N series Rumba derivative
-#define BOARD_RL200                   1125  // Rapide Lite 200 (v1, low-cost RUMBA clone with drv)
-#define BOARD_FORMBOT_TREX2PLUS       1126  // Formbot T-Rex 2 Plus
-#define BOARD_FORMBOT_TREX3           1127  // Formbot T-Rex 3
-#define BOARD_FORMBOT_RAPTOR          1128  // Formbot Raptor
-#define BOARD_FORMBOT_RAPTOR2         1129  // Formbot Raptor 2
-#define BOARD_BQ_ZUM_MEGA_3D          1130  // bq ZUM Mega 3D
-#define BOARD_MAKEBOARD_MINI          1131  // MakeBoard Mini v2.1.2 is a control board sold by MicroMake
-#define BOARD_TRIGORILLA_13           1132  // TriGorilla Anycubic version 1.3-based on RAMPS EFB
-#define BOARD_TRIGORILLA_14           1133  //   ... Ver 1.4
-#define BOARD_TRIGORILLA_14_11        1134  //   ... Rev 1.1 (new servo pin order)
-#define BOARD_RAMPS_ENDER_4           1135  // Creality: Ender-4, CR-8
-#define BOARD_RAMPS_CREALITY          1136  // Creality: CR10S, CR20, CR-X
-#define BOARD_RAMPS_DAGOMA            1137  // Dagoma F5
-#define BOARD_FYSETC_F6_13            1138  // FYSETC F6 1.3
-#define BOARD_FYSETC_F6_14            1139  // FYSETC F6 1.4
-#define BOARD_DUPLICATOR_I3_PLUS      1140  // Wanhao Duplicator i3 Plus
-#define BOARD_VORON                   1141  // VORON Design
-#define BOARD_TRONXY_V3_1_0           1142  // Tronxy TRONXY-V3-1.0
-#define BOARD_Z_BOLT_X_SERIES         1143  // Z-Bolt X Series
-#define BOARD_TT_OSCAR                1144  // TT OSCAR
-#define BOARD_OVERLORD                1145  // Overlord/Overlord Pro
-#define BOARD_HJC2560C_REV1           1146  // ADIMLab Gantry v1
-#define BOARD_HJC2560C_REV2           1147  // ADIMLab Gantry v2
-#define BOARD_TANGO                   1148  // BIQU Tango V1
-#define BOARD_MKS_GEN_L_V2            1149  // MKS GEN L V2
-#define BOARD_COPYMASTER_3D           1150  // Copymaster 3D
-#define BOARD_ORTUR_4                 1151  // Ortur 4
+#define BOARD_K8600                   1103  // Velleman K8600 Controller (Vertex Nano)
+#define BOARD_BAM_DICE                1104  // 2PrintBeta BAM&DICE with STK drivers
+#define BOARD_BAM_DICE_DUE            1105  // 2PrintBeta BAM&DICE Due with STK drivers
+#define BOARD_MKS_BASE                1106  // MKS BASE v1.0
+#define BOARD_MKS_BASE_14             1107  // MKS BASE v1.4 with Allegro A4982 stepper drivers
+#define BOARD_MKS_BASE_15             1108  // MKS BASE v1.5 with Allegro A4982 stepper drivers
+#define BOARD_MKS_BASE_16             1109  // MKS BASE v1.6 with Allegro A4982 stepper drivers
+#define BOARD_MKS_BASE_HEROIC         1110  // MKS BASE 1.0 with Heroic HR4982 stepper drivers
+#define BOARD_MKS_GEN_13              1111  // MKS GEN v1.3 or 1.4
+#define BOARD_MKS_GEN_L               1112  // MKS GEN L
+#define BOARD_KFB_2                   1113  // BigTreeTech or BIQU KFB2.0
+#define BOARD_ZRIB_V20                1114  // zrib V2.0 control board (Chinese knock off RAMPS replica)
+#define BOARD_FELIX2                  1115  // Felix 2.0+ Electronics Board (RAMPS like)
+#define BOARD_RIGIDBOARD              1116  // Invent-A-Part RigidBoard
+#define BOARD_RIGIDBOARD_V2           1117  // Invent-A-Part RigidBoard V2
+#define BOARD_SAINSMART_2IN1          1118  // Sainsmart 2-in-1 board
+#define BOARD_ULTIMAKER               1119  // Ultimaker
+#define BOARD_ULTIMAKER_OLD           1120  // Ultimaker (Older electronics. Pre 1.5.4. This is rare)
+#define BOARD_AZTEEG_X3               1121  // Azteeg X3
+#define BOARD_AZTEEG_X3_PRO           1122  // Azteeg X3 Pro
+#define BOARD_ULTIMAIN_2              1123  // Ultimainboard 2.x (Uses TEMP_SENSOR 20)
+#define BOARD_RUMBA                   1124  // Rumba
+#define BOARD_RUMBA_RAISE3D           1125  // Raise3D N series Rumba derivative
+#define BOARD_RL200                   1126  // Rapide Lite 200 (v1, low-cost RUMBA clone with drv)
+#define BOARD_FORMBOT_TREX2PLUS       1127  // Formbot T-Rex 2 Plus
+#define BOARD_FORMBOT_TREX3           1128  // Formbot T-Rex 3
+#define BOARD_FORMBOT_RAPTOR          1129  // Formbot Raptor
+#define BOARD_FORMBOT_RAPTOR2         1130  // Formbot Raptor 2
+#define BOARD_BQ_ZUM_MEGA_3D          1131  // bq ZUM Mega 3D
+#define BOARD_MAKEBOARD_MINI          1132  // MakeBoard Mini v2.1.2 is a control board sold by MicroMake
+#define BOARD_TRIGORILLA_13           1133  // TriGorilla Anycubic version 1.3-based on RAMPS EFB
+#define BOARD_TRIGORILLA_14           1134  //   ... Ver 1.4
+#define BOARD_TRIGORILLA_14_11        1135  //   ... Rev 1.1 (new servo pin order)
+#define BOARD_RAMPS_ENDER_4           1136  // Creality: Ender-4, CR-8
+#define BOARD_RAMPS_CREALITY          1137  // Creality: CR10S, CR20, CR-X
+#define BOARD_RAMPS_DAGOMA            1138  // Dagoma F5
+#define BOARD_FYSETC_F6_13            1139  // FYSETC F6 1.3
+#define BOARD_FYSETC_F6_14            1140  // FYSETC F6 1.4
+#define BOARD_DUPLICATOR_I3_PLUS      1141  // Wanhao Duplicator i3 Plus
+#define BOARD_VORON                   1142  // VORON Design
+#define BOARD_TRONXY_V3_1_0           1143  // Tronxy TRONXY-V3-1.0
+#define BOARD_Z_BOLT_X_SERIES         1144  // Z-Bolt X Series
+#define BOARD_TT_OSCAR                1145  // TT OSCAR
+#define BOARD_OVERLORD                1146  // Overlord/Overlord Pro
+#define BOARD_HJC2560C_REV1           1147  // ADIMLab Gantry v1
+#define BOARD_HJC2560C_REV2           1148  // ADIMLab Gantry v2
+#define BOARD_TANGO                   1149  // BIQU Tango V1
+#define BOARD_MKS_GEN_L_V2            1150  // MKS GEN L V2
+#define BOARD_COPYMASTER_3D           1151  // Copymaster 3D
+#define BOARD_ORTUR_4                 1152  // Ortur 4
 
 //
 // RAMBo and derivatives
diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h
index 3ce761c6cff..3dc7a675930 100644
--- a/Marlin/src/pins/pins.h
+++ b/Marlin/src/pins/pins.h
@@ -98,6 +98,8 @@
   #include "ramps/pins_K8200.h"                 // ATmega1280, ATmega2560                 env:mega1280 env:mega2560 (3DRAG)
 #elif MB(K8400)
   #include "ramps/pins_K8400.h"                 // ATmega1280, ATmega2560                 env:mega1280 env:mega2560 (3DRAG)
+#elif MB(K8600)
+  #include "ramps/pins_K8600.h"                 // ATmega1280, ATmega2560                 env:mega1280 env:mega2560
 #elif MB(K8800)
   #include "ramps/pins_K8800.h"                 // ATmega1280, ATmega2560                 env:mega1280 env:mega2560 (3DRAG)
 #elif MB(BAM_DICE)
diff --git a/Marlin/src/pins/ramps/pins_K8600.h b/Marlin/src/pins/ramps/pins_K8600.h
new file mode 100644
index 00000000000..17c230fe32a
--- /dev/null
+++ b/Marlin/src/pins/ramps/pins_K8600.h
@@ -0,0 +1,127 @@
+/**
+ * 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/>.
+ *
+ */
+
+/**
+ * VERTEX NANO Arduino Mega with RAMPS EFB v1.4 pin assignments.
+ */
+
+#if HOTENDS > 1
+  #error "Only 1 hotend is supported for Vertex Nano."
+#endif
+
+#define BOARD_INFO_NAME      "K8600"
+#define DEFAULT_MACHINE_NAME "Vertex Nano"
+
+//
+// Limit Switches
+//
+#define X_MIN_PIN                              3
+#define Y_MAX_PIN                             14
+#define Z_MAX_PIN                             18
+#define Z_MIN_PIN                             -1
+
+//
+// Heaters / Fans
+//
+#define FAN_PIN                                8
+
+//
+// Misc. Functions
+//
+#define CASE_LIGHT_PIN                         7
+
+//
+// Other RAMPS pins
+//
+#define IS_RAMPS_EFB                              // Override autodetection. Bed will be undefined.
+#include "pins_RAMPS.h"
+
+//
+// Steppers
+//
+#undef X_STEP_PIN
+#undef X_DIR_PIN
+#undef X_ENABLE_PIN
+#define X_STEP_PIN                            54
+#define X_DIR_PIN                             55
+#define X_ENABLE_PIN                          38
+
+#undef Y_STEP_PIN
+#undef Y_DIR_PIN
+#undef Y_ENABLE_PIN
+#define Y_STEP_PIN                            60
+#define Y_DIR_PIN                             61
+#define Y_ENABLE_PIN                          56
+
+#undef Z_ENABLE_PIN
+#define Z_ENABLE_PIN                          63
+
+#undef E0_STEP_PIN
+#undef E0_DIR_PIN
+#undef E0_ENABLE_PIN
+#define E0_STEP_PIN                           26
+#define E0_DIR_PIN                            28
+#define E0_ENABLE_PIN                         24
+
+//
+// Heaters / Fans
+//
+#undef HEATER_BED_PIN
+
+//
+// Misc. Functions
+//
+#undef SDSS
+#define SDSS                                  25  // 53
+
+//
+// LCD / Controller
+//
+#if BOTH(ULTRA_LCD, NEWPANEL)
+  #undef BEEPER_PIN
+
+  #undef LCD_PINS_RS
+  #undef LCD_PINS_ENABLE
+  #undef LCD_PINS_D4
+  #undef LCD_PINS_D5
+  #undef LCD_PINS_D6
+  #undef LCD_PINS_D7
+  #define LCD_PINS_RS                         27
+  #define LCD_PINS_ENABLE                     29
+  #define LCD_PINS_D4                         37
+  #define LCD_PINS_D5                         35
+  #define LCD_PINS_D6                         33
+  #define LCD_PINS_D7                         31
+
+  // Buttons
+  #undef BTN_EN1
+  #undef BTN_EN2
+  #undef BTN_ENC
+  #define BTN_EN1                             17
+  #define BTN_EN2                             16
+  #define BTN_ENC                             23
+
+#else
+
+  #define BEEPER_PIN                          33
+
+#endif