From c9fe822920f8df22553373b8ad066a33b80030f3 Mon Sep 17 00:00:00 2001
From: Julien Staub <atsju2@yahoo.fr>
Date: Tue, 1 Mar 2022 23:42:20 +0100
Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Weedo=2062A=20Tina2=20/=20Monoprice?=
 =?UTF-8?q?=20Cadet=20(#23817)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Marlin/src/core/boards.h              |   1 +
 Marlin/src/pins/mega/pins_PICA.h      |   1 +
 Marlin/src/pins/mega/pins_WEEDO_62A.h | 106 ++++++++++++++++++++++++++
 Marlin/src/pins/pins.h                |   2 +
 4 files changed, 110 insertions(+)
 create mode 100644 Marlin/src/pins/mega/pins_WEEDO_62A.h

diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h
index 5ee99b533f6..3ec24e77602 100644
--- a/Marlin/src/core/boards.h
+++ b/Marlin/src/core/boards.h
@@ -164,6 +164,7 @@
 #define BOARD_MALYAN_M180             1327  // Malyan M180 Mainboard Version 2 (no display function, direct gcode only)
 #define BOARD_GT2560_V4_A20           1328  // Geeetech GT2560 Rev B for A20(M/T/D)
 #define BOARD_PROTONEER_CNC_SHIELD_V3 1329  // Mega controller & Protoneer CNC Shield V3.00
+#define BOARD_WEEDO_62A               1330  // WEEDO 62A board (TINA2, Monoprice Cadet, etc.)
 
 //
 // ATmega1281, ATmega2561
diff --git a/Marlin/src/pins/mega/pins_PICA.h b/Marlin/src/pins/mega/pins_PICA.h
index 47c101711c4..0e29d8dffe7 100644
--- a/Marlin/src/pins/mega/pins_PICA.h
+++ b/Marlin/src/pins/mega/pins_PICA.h
@@ -51,6 +51,7 @@
 #define SERVO0_PIN                             3
 #define SERVO1_PIN                             4
 #define SERVO2_PIN                             5
+
 //
 // Limit Switches
 //
diff --git a/Marlin/src/pins/mega/pins_WEEDO_62A.h b/Marlin/src/pins/mega/pins_WEEDO_62A.h
new file mode 100644
index 00000000000..4b3bf6a43be
--- /dev/null
+++ b/Marlin/src/pins/mega/pins_WEEDO_62A.h
@@ -0,0 +1,106 @@
+/**
+ * Marlin 3D Printer Firmware
+ * Copyright (c) 2022 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 <https://www.gnu.org/licenses/>.
+ *
+ */
+
+/**
+ * Based on WEEDO 62A pin configuration
+ * Copyright (c) 2019 WEEDO3D Perron
+ */
+
+#pragma once
+
+#include "env_validate.h"
+
+#ifndef BOARD_INFO_NAME
+  #define BOARD_INFO_NAME "WEEDO 62A"
+#endif
+
+//
+// Limit Switches
+//
+#define X_MIN_PIN                              3
+#define X_MAX_PIN                              2
+#define Y_MIN_PIN                             40
+#define Y_MAX_PIN                             41
+#define Z_MIN_PIN                             18
+#define Z_MAX_PIN                             19
+
+//
+// Steppers
+//
+#define X_STEP_PIN                            26
+#define X_DIR_PIN                             28
+#define X_ENABLE_PIN                          24
+
+#define Y_STEP_PIN                            60
+#define Y_DIR_PIN                             61
+#define Y_ENABLE_PIN                          56
+
+#define Z_STEP_PIN                            46
+#define Z_DIR_PIN                             48
+#define Z_ENABLE_PIN                          62
+
+#define E0_STEP_PIN                           54
+#define E0_DIR_PIN                            55
+#define E0_ENABLE_PIN                         38
+
+//
+// Temperature Sensors
+//
+#define TEMP_0_PIN                            13  // ANALOG NUMBERING
+#define TEMP_BED_PIN                          14  // ANALOG NUMBERING
+
+//
+// Heaters / Fans
+//
+#define HEATER_0_PIN                          10  // EXTRUDER 1
+#define HEATER_BED_PIN                         8  // BED
+#define FAN_PIN                                4  // IO pin. Buffer needed
+
+//
+// Misc. Functions
+//
+#define PS_ON_PIN                             12
+#define LED_PIN                               13
+
+//
+// SD Support
+//
+#if ENABLED(SDSUPPORT)
+  #define SDSS                                53
+  #define SD_DETECT_PIN                       49
+#endif
+
+//
+// LCD / Controller
+//
+#if HAS_WIRED_LCD
+  #define BEEPER_PIN                          37
+
+  #define DOGLCD_A0                           27
+  #define DOGLCD_CS                           29
+  #define LCD_RESET_PIN                       25
+  #define LCD_CONTRAST_INIT                  255
+
+  #define BTN_EN1                             33
+  #define BTN_EN2                             31
+  #define BTN_ENC                             35
+#endif
diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h
index 88e7946edc4..7f0eac8c88f 100644
--- a/Marlin/src/pins/pins.h
+++ b/Marlin/src/pins/pins.h
@@ -287,6 +287,8 @@
   #include "mega/pins_MALYAN_M180.h"            // ATmega2560                             env:mega2560
 #elif MB(PROTONEER_CNC_SHIELD_V3)
   #include "mega/pins_PROTONEER_CNC_SHIELD_V3.h"// ATmega2560                             env:mega2560
+#elif MB(WEEDO_62A)
+  #include "mega/pins_WEEDO_62A.h"              // ATmega2560                             env:mega2560
 
 //
 // ATmega1281, ATmega2561