From dceaeeeaf9591f67135356d0485e4c2936c08f2f Mon Sep 17 00:00:00 2001
From: Timo <timo.birnschein@microforge.de>
Date: Sat, 29 May 2021 14:00:39 -0700
Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Malyan=20M180=20(#21992)?=
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_MALYAN_M180.h | 100 ++++++++++++++++++++++++
 Marlin/src/pins/pins.h                  |   2 +
 3 files changed, 103 insertions(+)
 create mode 100644 Marlin/src/pins/mega/pins_MALYAN_M180.h

diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h
index 20aeac654da..1f73f04d16a 100644
--- a/Marlin/src/core/boards.h
+++ b/Marlin/src/core/boards.h
@@ -159,6 +159,7 @@
 #define BOARD_PICA_REVB               1324  // PICA Shield (original version)
 #define BOARD_PICA                    1325  // PICA Shield (rev C or later)
 #define BOARD_INTAMSYS40              1326  // Intamsys 4.0 (Funmat HT)
+#define BOARD_MALYAN_M180             1327  // Malyan M180 Mainboard Version 2 (no display function, direct gcode only)
 
 //
 // ATmega1281, ATmega2561
diff --git a/Marlin/src/pins/mega/pins_MALYAN_M180.h b/Marlin/src/pins/mega/pins_MALYAN_M180.h
new file mode 100644
index 00000000000..e244d294f1c
--- /dev/null
+++ b/Marlin/src/pins/mega/pins_MALYAN_M180.h
@@ -0,0 +1,100 @@
+/**
+ * Marlin 3D Printer Firmware
+ * Copyright (c) 2021 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/>.
+ *
+ */
+#pragma once
+
+/**
+ * Malyan M180 pin assignments
+ * Contributed by Timo Birnschein (timo.birnschein@microforge.de)
+ */
+
+#include "env_validate.h"
+
+#define BOARD_INFO_NAME "Malyan M180 v.2"
+//
+// Limit Switches
+//
+#define X_STOP_PIN                            48
+#define Y_STOP_PIN                            46
+#define Z_STOP_PIN                            42
+
+//
+// Z Probe (when not Z_MIN_PIN)
+//
+#ifndef Z_MIN_PROBE_PIN
+  #define Z_MIN_PROBE_PIN                     -1
+#endif
+
+//
+// Steppers
+//
+#define X_STEP_PIN                            55
+#define X_DIR_PIN                             54
+#define X_ENABLE_PIN                          56
+
+#define Y_STEP_PIN                            59
+#define Y_DIR_PIN                             58
+#define Y_ENABLE_PIN                          60
+
+#define Z_STEP_PIN                            63
+#define Z_DIR_PIN                             62
+#define Z_ENABLE_PIN                          64
+
+#define E0_STEP_PIN                           25
+#define E0_DIR_PIN                            24
+#define E0_ENABLE_PIN                         26
+
+#define E1_STEP_PIN                           29
+#define E1_DIR_PIN                            28
+#define E1_ENABLE_PIN                         39
+
+//
+// Temperature Sensors
+//
+#define TEMP_BED_PIN                          15  // Analog Input
+
+// Extruder thermocouples 0 and 1 are read out by two separate ICs using
+// SPI for Max6675 Thermocouple
+// Uses a separate SPI bus
+#define THERMO_SCK_PIN                        78  // E2 - SCK
+#define THERMO_DO_PIN                          3  // E5 - DO
+#define THERMO_CS1_PIN                         5  // E3 - CS0
+#define THERMO_CS2_PIN                         2  // E4 - CS1
+
+#define MAX6675_SS_PIN            THERMO_CS1_PIN
+#define MAX6675_SS2_PIN           THERMO_CS2_PIN
+#define MAX6675_SCK_PIN           THERMO_SCK_PIN
+#define MAX6675_DO_PIN             THERMO_DO_PIN
+
+//
+// Heaters / Fans
+//
+#define HEATER_0_PIN                           6
+#define HEATER_1_PIN                          11
+#define HEATER_BED_PIN                        45
+
+#ifndef FAN_PIN
+  #define FAN_PIN                              7  // M106 Sxxx command supported and tested. M107 as well.
+#endif
+
+#ifndef FAN_PIN1
+  #define FAN_PIN1                            12  // Currently Unsupported by Marlin
+#endif
diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h
index a8ed35b0095..3176b5e8323 100644
--- a/Marlin/src/pins/pins.h
+++ b/Marlin/src/pins/pins.h
@@ -270,6 +270,8 @@
   #include "mega/pins_PICAOLD.h"                // ATmega2560                             env:mega2560
 #elif MB(INTAMSYS40)
   #include "mega/pins_INTAMSYS40.h"             // ATmega2560                             env:mega2560
+#elif MB(MALYAN_M180)
+  #include "mega/pins_MALYAN_M180.h"            // ATmega2560                             env:mega2560
 
 //
 // ATmega1281, ATmega2561