From dec721c52ba1eb7e06626bb18cd1adb5564d3512 Mon Sep 17 00:00:00 2001
From: InsanityAutomation
 <38436470+InsanityAutomation@users.noreply.github.com>
Date: Sun, 25 Nov 2018 20:56:06 -0500
Subject: [PATCH] Add Formbot Raptor2 and Raise3D pins (#12532)

* Add Formbot Raptor2 board
* Add Raise3D Rumba board
---
 Marlin/Makefile                        |  4 ++
 Marlin/src/core/boards.h               |  2 +
 Marlin/src/pins/pins.h                 |  4 ++
 Marlin/src/pins/pins_FORMBOT_RAPTOR.h  | 19 ++++---
 Marlin/src/pins/pins_FORMBOT_RAPTOR2.h | 70 ++++++++++++++++++++++++++
 Marlin/src/pins/pins_RUMBA.h           | 40 +++++++++------
 Marlin/src/pins/pins_RUMBA_RAISE3D.h   | 30 +++++++++++
 7 files changed, 147 insertions(+), 22 deletions(-)
 create mode 100644 Marlin/src/pins/pins_FORMBOT_RAPTOR2.h
 create mode 100644 Marlin/src/pins/pins_RUMBA_RAISE3D.h

diff --git a/Marlin/Makefile b/Marlin/Makefile
index 16b80d25ee..864ee949d1 100644
--- a/Marlin/Makefile
+++ b/Marlin/Makefile
@@ -204,12 +204,16 @@ else ifeq ($(HARDWARE_MOTHERBOARD),68)
 else ifeq ($(HARDWARE_MOTHERBOARD),72)
 # Rumba
 else ifeq ($(HARDWARE_MOTHERBOARD),80)
+# Raise3D Rumba
+else ifeq ($(HARDWARE_MOTHERBOARD),333)
 # Formbot T-Rex 2 Plus
 else ifeq ($(HARDWARE_MOTHERBOARD),95)
 # Formbot T-Rex 3
 else ifeq ($(HARDWARE_MOTHERBOARD),96)
 # Formbot Raptor
 else ifeq ($(HARDWARE_MOTHERBOARD),97)
+# Formbot Raptor 2
+else ifeq ($(HARDWARE_MOTHERBOARD),98)
 # bq ZUM Mega 3D
 else ifeq ($(HARDWARE_MOTHERBOARD),503)
 # MakeBoard Mini v2.1.2 is a control board sold by MicroMake
diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h
index c1ad882d12..575bf26539 100644
--- a/Marlin/src/core/boards.h
+++ b/Marlin/src/core/boards.h
@@ -73,9 +73,11 @@
 #define BOARD_AZTEEG_X3_PRO     68    // Azteeg X3 Pro
 #define BOARD_ULTIMAIN_2        72    // Ultimainboard 2.x (Uses TEMP_SENSOR 20)
 #define BOARD_RUMBA             80    // Rumba
+#define BOARD_RUMBA_RAISE3D     333   // Raise3D N series Rumba derivative
 #define BOARD_FORMBOT_TREX2PLUS 95    // Formbot T-Rex 2 Plus
 #define BOARD_FORMBOT_TREX3     96    // Formbot T-Rex 3
 #define BOARD_FORMBOT_RAPTOR    97    // Formbot Raptor
+#define BOARD_FORMBOT_RAPTOR2   98    // Formbot Raptor 2
 #define BOARD_BQ_ZUM_MEGA_3D    503   // bq ZUM Mega 3D
 #define BOARD_MAKEBOARD_MINI    431   // MakeBoard Mini v2.1.2 is a control board sold by MicroMake
 #define BOARD_TRIGORILLA_13     343   // TriGorilla Anycubic version 1.3 based on RAMPS EFB
diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h
index 9160b135f9..da1b0cd435 100644
--- a/Marlin/src/pins/pins.h
+++ b/Marlin/src/pins/pins.h
@@ -132,12 +132,16 @@
   #include "pins_ULTIMAIN_2.h"        // ATmega2560                                 env:megaatmega2560
 #elif MB(FORMBOT_RAPTOR)
   #include "pins_FORMBOT_RAPTOR.h"    // ATmega2560                                 env:megaatmega2560
+#elif MB(FORMBOT_RAPTOR2)
+  #include "pins_FORMBOT_RAPTOR2.h"   // ATmega2560                                 env:megaatmega2560
 #elif MB(FORMBOT_TREX2PLUS)
   #include "pins_FORMBOT_TREX2PLUS.h" // ATmega2560                                 env:megaatmega2560
 #elif MB(FORMBOT_TREX3)
   #include "pins_FORMBOT_TREX3.h"     // ATmega2560                                 env:megaatmega2560
 #elif MB(RUMBA)
   #include "pins_RUMBA.h"             // ATmega2560                                 env:megaatmega2560
+#elif MB(RUMBA_RAISE3D)
+  #include "pins_RUMBA_RAISE3D.h"     // ATmega2560                                 env:megaatmega2560
 #elif MB(BQ_ZUM_MEGA_3D)
   #include "pins_BQ_ZUM_MEGA_3D.h"    // ATmega2560                                 env:megaatmega2560
 #elif MB(MAKEBOARD_MINI)
diff --git a/Marlin/src/pins/pins_FORMBOT_RAPTOR.h b/Marlin/src/pins/pins_FORMBOT_RAPTOR.h
index 5ec11b0b95..7178b267d4 100644
--- a/Marlin/src/pins/pins_FORMBOT_RAPTOR.h
+++ b/Marlin/src/pins/pins_FORMBOT_RAPTOR.h
@@ -21,7 +21,7 @@
  */
 
 /**
- * Formbot pin assignments
+ * Formbot Raptor pin assignments
  */
 
 #ifndef __AVR_ATmega2560__
@@ -32,8 +32,12 @@
   #error "Formbot supports up to 3 hotends / E-steppers. Comment this line to keep going."
 #endif
 
-#define DEFAULT_MACHINE_NAME "Formbot Raptor"
-#define BOARD_NAME           "Formbot Raptor"
+#ifndef DEFAULT_MACHINE_NAME
+  #define DEFAULT_MACHINE_NAME "Formbot Raptor"
+#endif
+#ifndef BOARD_NAME
+  #define BOARD_NAME           "Formbot Raptor"
+#endif
 
 //
 // Servos
@@ -41,7 +45,6 @@
 #define SERVO0_PIN         11
 #define SERVO1_PIN          6
 #define SERVO2_PIN          5
-#define SERVO3_PIN         -1
 
 //
 // Limit Switches
@@ -142,7 +145,9 @@
 #define HEATER_1_PIN        7
 #define HEATER_BED_PIN      8
 
-#define FAN_PIN             9
+#ifndef FAN_PIN
+  #define FAN_PIN           9
+#endif
 
 #if DISABLED(FILAMENT_RUNOUT_SENSOR)
   #define FAN1_PIN          4
@@ -151,7 +156,9 @@
 //
 // Misc. Functions
 //
-#define SDSS               53
+#ifndef SDSS
+  #define SDSS             53
+#endif
 #define LED_PIN            13
 #define LED4_PIN            5
 
diff --git a/Marlin/src/pins/pins_FORMBOT_RAPTOR2.h b/Marlin/src/pins/pins_FORMBOT_RAPTOR2.h
new file mode 100644
index 0000000000..5bd356428e
--- /dev/null
+++ b/Marlin/src/pins/pins_FORMBOT_RAPTOR2.h
@@ -0,0 +1,70 @@
+/**
+ * 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/>.
+ *
+ */
+
+/**
+ * Formbot Raptor 2 pin assignments
+ */
+
+#define DEFAULT_MACHINE_NAME "Formbot Raptor2"
+#define BOARD_NAME           "Formbot Raptor2"
+
+#define FAN_PIN             6
+#define SDSS                5
+
+#include "pins_FORMBOT_RAPTOR.h"
+
+#ifndef FIL_RUNOUT_PIN
+  #define FIL_RUNOUT_PIN   22
+#endif
+
+#define GREEDY_PANEL (   ENABLED(PANEL_ONE) || ENABLED(VIKI2)     \
+                      || ENABLED(miniVIKI)  || ENABLED(MINIPANEL) \
+                      || ENABLED(REPRAPWORLD_KEYPAD) )
+
+//
+// M3/M4/M5 - Spindle/Laser Control
+//
+#if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENABLE)
+  #if !NUM_SERVOS                       // Try to use servo connector first
+    #define SPINDLE_LASER_ENABLE_PIN  6 // Pin should have a pullup/pulldown!
+    #define SPINDLE_LASER_PWM_PIN     4 // MUST BE HARDWARE PWM
+    #define SPINDLE_DIR_PIN           5
+  #elif !GREEDY_PANEL                   // Try to use AUX2
+    #define SPINDLE_LASER_ENABLE_PIN 40 // Pin should have a pullup/pulldown!
+    #define SPINDLE_LASER_PWM_PIN    44 // MUST BE HARDWARE PWM
+    #define SPINDLE_DIR_PIN          65
+  #endif
+#endif
+
+#if ENABLED(CASE_LIGHT_ENABLE) && !PIN_EXISTS(CASE_LIGHT)
+  #if NUM_SERVOS <= 1                   // Try to use servo connector first
+    #define CASE_LIGHT_PIN  6           // MUST BE HARDWARE PWM
+  #elif !GREEDY_PANEL                   // Try to use AUX2
+    #define CASE_LIGHT_PIN 44           // MUST BE HARDWARE PWM
+  #endif
+#endif
+
+#undef GREEDY_PANEL
+
+#if ENABLED(CASE_LIGHT_ENABLE) && PIN_EXISTS(CASE_LIGHT) && (CASE_LIGHT_PIN == SPINDLE_LASER_ENABLE_PIN || CASE_LIGHT_PIN == SPINDLE_LASER_PWM_PIN)
+  #error "CASE_LIGHT_PIN conflicts with a Spindle / Laser pin."
+#endif
diff --git a/Marlin/src/pins/pins_RUMBA.h b/Marlin/src/pins/pins_RUMBA.h
index b2869f1205..e40f165779 100644
--- a/Marlin/src/pins/pins_RUMBA.h
+++ b/Marlin/src/pins/pins_RUMBA.h
@@ -32,13 +32,17 @@
   #error "RUMBA supports up to 3 hotends / E-steppers. Comment out this line to continue."
 #endif
 
-#define DEFAULT_MACHINE_NAME "Rumba"
-#define BOARD_NAME           "Rumba"
+#ifndef DEFAULT_MACHINE_NAME
+  #define DEFAULT_MACHINE_NAME "Rumba"
+#endif
+#ifndef BOARD_NAME
+  #define BOARD_NAME "Rumba"
+#endif
 
 //
 // Servos
 //
-#define SERVO0_PIN         5
+#define SERVO0_PIN          5
 
 //
 // Limit Switches
@@ -87,16 +91,20 @@
 //
 // Temperature Sensors
 //
-#if TEMP_SENSOR_0 == -1
-  #define TEMP_0_PIN        6   // Analog Input (connector *K1* on RUMBA thermocouple ADD ON is used)
-#else
-  #define TEMP_0_PIN       15   // Analog Input (default connector for thermistor *T0* on rumba board is used)
+#ifndef TEMP_0_PIN
+  #if TEMP_SENSOR_0 == -1
+    #define TEMP_0_PIN      6   // Analog Input (connector *K1* on RUMBA thermocouple ADD ON is used)
+  #else
+    #define TEMP_0_PIN     15   // Analog Input (default connector for thermistor *T0* on rumba board is used)
+  #endif
 #endif
 
-#if TEMP_SENSOR_1 == -1
-  #define TEMP_1_PIN        5   // Analog Input (connector *K2* on RUMBA thermocouple ADD ON is used)
-#else
-  #define TEMP_1_PIN       14   // Analog Input (default connector for thermistor *T1* on rumba board is used)
+#ifndef TEMP_1_PIN
+  #if TEMP_SENSOR_1 == -1
+    #define TEMP_1_PIN      5   // Analog Input (connector *K2* on RUMBA thermocouple ADD ON is used)
+  #else
+    #define TEMP_1_PIN     14   // Analog Input (default connector for thermistor *T1* on rumba board is used)
+  #endif
 #endif
 
 #if TEMP_SENSOR_2 == -1
@@ -105,7 +113,7 @@
   #define TEMP_2_PIN       13   // Analog Input (default connector for thermistor *T2* on rumba board is used)
 #endif
 
-// optional for extruder 4 or chamber:
+// Optional for extruder 4 or chamber:
 //#define TEMP_X_PIN         12   // Analog Input (default connector for thermistor *T3* on rumba board is used)
 //#define TEMP_CHAMBER_PIN   12   // Analog Input (default connector for thermistor *T3* on rumba board is used)
 
@@ -142,13 +150,13 @@
 // M3/M4/M5 - Spindle/Laser Control
 //
 #ifndef SPINDLE_LASER_PWM_PIN
-  #define SPINDLE_LASER_PWM_PIN     4   // MUST BE HARDWARE PWM. Pin 4 interrupts OC0* and OC1* always in use?
+  #define SPINDLE_LASER_PWM_PIN 4   // MUST BE HARDWARE PWM. Pin 4 interrupts OC0* and OC1* always in use?
 #endif
 #ifndef SPINDLE_LASER_ENABLE_PIN
   #define SPINDLE_LASER_ENABLE_PIN 14   // Pin should have a pullup!
 #endif
 #ifndef SPINDLE_DIR_PIN
-  #define SPINDLE_DIR_PIN          15
+  #define SPINDLE_DIR_PIN  15
 #endif
 
 //
@@ -162,8 +170,8 @@
 #define BTN_ENC            43
 
 #if ENABLED(MKS_12864OLED) || ENABLED(MKS_12864OLED_SSD1306)
-  #define LCD_PINS_DC      38 // Set as output on init
-  #define LCD_PINS_RS      41 // Pull low for 1s to init
+  #define LCD_PINS_DC      38   // Set as output on init
+  #define LCD_PINS_RS      41   // Pull low for 1s to init
   // DOGM SPI LCD Support
   #define DOGLCD_CS        19
   #define DOGLCD_MOSI      42
diff --git a/Marlin/src/pins/pins_RUMBA_RAISE3D.h b/Marlin/src/pins/pins_RUMBA_RAISE3D.h
new file mode 100644
index 0000000000..80d7c76ed7
--- /dev/null
+++ b/Marlin/src/pins/pins_RUMBA_RAISE3D.h
@@ -0,0 +1,30 @@
+/**
+ * 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/>.
+ *
+ */
+
+#define DEFAULT_MACHINE_NAME "Raise3D N Series"
+#define BOARD_NAME           "Raise3D Rumba"
+
+// Raise3D uses thermocouples on the standard input pins
+#define TEMP_0_PIN         15   // Analog Input
+#define TEMP_1_PIN         14   // Analog Input
+
+#include "pins_RUMBA.h"
-- 
GitLab