From 59548410b8e76c5a2f18565c9f37338e4f2a4be6 Mon Sep 17 00:00:00 2001
From: Scott Lahteine <github@thinkyhead.com>
Date: Thu, 10 Feb 2022 13:58:50 -0600
Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Wrap=20MMU1?=
 =?UTF-8?q?=20pins?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Marlin/src/pins/linux/pins_RAMPS_LINUX.h      | 18 +++++++++--------
 Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h   | 10 ++++++----
 Marlin/src/pins/rambo/pins_EINSY_RAMBO.h      |  8 +++++---
 Marlin/src/pins/rambo/pins_EINSY_RETRO.h      |  8 +++++---
 Marlin/src/pins/rambo/pins_MINIRAMBO.h        | 10 ++++++----
 Marlin/src/pins/rambo/pins_RAMBO.h            |  8 +++++---
 Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h |  4 +++-
 Marlin/src/pins/ramps/pins_RAMPS.h            | 18 +++++++++--------
 Marlin/src/pins/ramps/pins_RAMPS_S_12.h       | 18 +++++++++--------
 Marlin/src/pins/ramps/pins_TT_OSCAR.h         | 20 ++++++++++---------
 Marlin/src/pins/stm32f4/pins_LERDGE_S.h       |  6 ++++--
 Marlin/src/pins/stm32f4/pins_VAKE403D.h       |  6 ++++--
 12 files changed, 79 insertions(+), 55 deletions(-)

diff --git a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h
index 372f967652..e2efdfa492 100644
--- a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h
+++ b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h
@@ -234,14 +234,16 @@
 //
 // Průša i3 MK2 Multiplexer Support
 //
-#ifndef E_MUX0_PIN
-  #define E_MUX0_PIN                          40  // Z_CS_PIN
-#endif
-#ifndef E_MUX1_PIN
-  #define E_MUX1_PIN                          42  // E0_CS_PIN
-#endif
-#ifndef E_MUX2_PIN
-  #define E_MUX2_PIN                          44  // E1_CS_PIN
+#if HAS_PRUSA_MMU1
+  #ifndef E_MUX0_PIN
+    #define E_MUX0_PIN                        40  // Z_CS_PIN
+  #endif
+  #ifndef E_MUX1_PIN
+    #define E_MUX1_PIN                        42  // E0_CS_PIN
+  #endif
+  #ifndef E_MUX2_PIN
+    #define E_MUX2_PIN                        44  // E1_CS_PIN
+  #endif
 #endif
 
 /**
diff --git a/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h b/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h
index ee9d0e8c7a..b08ac536b3 100644
--- a/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h
+++ b/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h
@@ -258,11 +258,13 @@
 //
 // Průša i3 MK2 Multiplexer Support
 //
-#if SERIAL_PORT != 0 && SERIAL_PORT_2 != 0
-  #define E_MUX0_PIN                       P0_03  // ( 0) Z_CS_PIN
-  #define E_MUX1_PIN                       P0_02  // ( 1) E0_CS_PIN
+#if HAS_PRUSA_MMU1
+  #if SERIAL_PORT != 0 && SERIAL_PORT_2 != 0
+    #define E_MUX0_PIN                     P0_03  // ( 0) Z_CS_PIN
+    #define E_MUX1_PIN                     P0_02  // ( 1) E0_CS_PIN
+  #endif
+  #define E_MUX2_PIN                       P0_26  // (63) E1_CS_PIN
 #endif
-#define E_MUX2_PIN                         P0_26  // (63) E1_CS_PIN
 
 /**
  * LCD / Controller
diff --git a/Marlin/src/pins/rambo/pins_EINSY_RAMBO.h b/Marlin/src/pins/rambo/pins_EINSY_RAMBO.h
index a7d1a62820..9150bf1365 100644
--- a/Marlin/src/pins/rambo/pins_EINSY_RAMBO.h
+++ b/Marlin/src/pins/rambo/pins_EINSY_RAMBO.h
@@ -163,9 +163,11 @@
 //
 // Průša i3 MK2 Multiplexer Support
 //
-#define E_MUX0_PIN                            17
-#define E_MUX1_PIN                            16
-#define E_MUX2_PIN                            78  // 84 in MK2 Firmware, with BEEPER as 78
+#if HAS_PRUSA_MMU1
+  #define E_MUX0_PIN                          17
+  #define E_MUX1_PIN                          16
+  #define E_MUX2_PIN                          78  // 84 in MK2 Firmware, with BEEPER as 78
+#endif
 
 //
 // LCD / Controller
diff --git a/Marlin/src/pins/rambo/pins_EINSY_RETRO.h b/Marlin/src/pins/rambo/pins_EINSY_RETRO.h
index 165475dae8..8bc0a90c05 100644
--- a/Marlin/src/pins/rambo/pins_EINSY_RETRO.h
+++ b/Marlin/src/pins/rambo/pins_EINSY_RETRO.h
@@ -157,9 +157,11 @@
 //
 // Průša i3 MK2 Multiplexer Support
 //
-#define E_MUX0_PIN                            17
-#define E_MUX1_PIN                            16
-#define E_MUX2_PIN                            78  // 84 in MK2 Firmware, with BEEPER as 78
+#if HAS_PRUSA_MMU1
+  #define E_MUX0_PIN                          17
+  #define E_MUX1_PIN                          16
+  #define E_MUX2_PIN                          78  // 84 in MK2 Firmware, with BEEPER as 78
+#endif
 
 //
 // LCD / Controller
diff --git a/Marlin/src/pins/rambo/pins_MINIRAMBO.h b/Marlin/src/pins/rambo/pins_MINIRAMBO.h
index ab25e2e692..31d44f2b34 100644
--- a/Marlin/src/pins/rambo/pins_MINIRAMBO.h
+++ b/Marlin/src/pins/rambo/pins_MINIRAMBO.h
@@ -130,10 +130,12 @@
 //
 // Průša i3 MK2 Multiplexer Support
 //
-#define E_MUX0_PIN                            17
-#define E_MUX1_PIN                            16
-#if !MB(MINIRAMBO_10A)
-  #define E_MUX2_PIN                          78  // 84 in MK2 Firmware, with BEEPER as 78
+#if HAS_PRUSA_MMU1
+  #define E_MUX0_PIN                          17
+  #define E_MUX1_PIN                          16
+  #if !MB(MINIRAMBO_10A)
+    #define E_MUX2_PIN                        78  // 84 in MK2 Firmware, with BEEPER as 78
+  #endif
 #endif
 
 //
diff --git a/Marlin/src/pins/rambo/pins_RAMBO.h b/Marlin/src/pins/rambo/pins_RAMBO.h
index f27bced623..5484b193b9 100644
--- a/Marlin/src/pins/rambo/pins_RAMBO.h
+++ b/Marlin/src/pins/rambo/pins_RAMBO.h
@@ -186,9 +186,11 @@
 //
 // Průša i3 MK2 Multiplexer Support
 //
-#define E_MUX0_PIN                            17
-#define E_MUX1_PIN                            16
-#define E_MUX2_PIN                            84  // 84 in MK2 Firmware
+#if HAS_PRUSA_MMU1
+  #define E_MUX0_PIN                          17
+  #define E_MUX1_PIN                          16
+  #define E_MUX2_PIN                          84  // 84 in MK2 Firmware
+#endif
 
 //
 // LCD / Controller
diff --git a/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h b/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h
index 729a82b9c6..a7817c6f3a 100644
--- a/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h
+++ b/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h
@@ -105,7 +105,9 @@
 //
 // Průša i3 MK2 Multiplexer Support
 //
-#define E_MUX2_PIN                            -1
+#if HAS_PRUSA_MMU1
+  #define E_MUX2_PIN                          -1
+#endif
 
 //
 // Misc. Functions
diff --git a/Marlin/src/pins/ramps/pins_RAMPS.h b/Marlin/src/pins/ramps/pins_RAMPS.h
index 70da23af73..29caaf0533 100644
--- a/Marlin/src/pins/ramps/pins_RAMPS.h
+++ b/Marlin/src/pins/ramps/pins_RAMPS.h
@@ -412,14 +412,16 @@
 //
 // Průša i3 MK2 Multiplexer Support
 //
-#ifndef E_MUX0_PIN
-  #define E_MUX0_PIN                          40  // Z_CS_PIN
-#endif
-#ifndef E_MUX1_PIN
-  #define E_MUX1_PIN                          42  // E0_CS_PIN
-#endif
-#ifndef E_MUX2_PIN
-  #define E_MUX2_PIN                          44  // E1_CS_PIN
+#if HAS_PRUSA_MMU1
+  #ifndef E_MUX0_PIN
+    #define E_MUX0_PIN                        40  // Z_CS_PIN
+  #endif
+  #ifndef E_MUX1_PIN
+    #define E_MUX1_PIN                        42  // E0_CS_PIN
+  #endif
+  #ifndef E_MUX2_PIN
+    #define E_MUX2_PIN                        44  // E1_CS_PIN
+  #endif
 #endif
 
 //
diff --git a/Marlin/src/pins/ramps/pins_RAMPS_S_12.h b/Marlin/src/pins/ramps/pins_RAMPS_S_12.h
index e1ba91cde8..f41573b527 100644
--- a/Marlin/src/pins/ramps/pins_RAMPS_S_12.h
+++ b/Marlin/src/pins/ramps/pins_RAMPS_S_12.h
@@ -233,14 +233,16 @@
 //
 // Průša i3 MK2 Multiplexer Support
 //
-#ifndef E_MUX0_PIN
-  #define E_MUX0_PIN                          29  // E2_STEP_PIN
-#endif
-#ifndef E_MUX1_PIN
-  #define E_MUX1_PIN                          28  // E2_DIR_PIN
-#endif
-#ifndef E_MUX2_PIN
-  #define E_MUX2_PIN                          39  // E2_ENABLE_PIN
+#if HAS_PRUSA_MMU1
+  #ifndef E_MUX0_PIN
+    #define E_MUX0_PIN                        29  // E2_STEP_PIN
+  #endif
+  #ifndef E_MUX1_PIN
+    #define E_MUX1_PIN                        28  // E2_DIR_PIN
+  #endif
+  #ifndef E_MUX2_PIN
+    #define E_MUX2_PIN                        39  // E2_ENABLE_PIN
+  #endif
 #endif
 
 //////////////////////////
diff --git a/Marlin/src/pins/ramps/pins_TT_OSCAR.h b/Marlin/src/pins/ramps/pins_TT_OSCAR.h
index 277b1af2de..9d844ebcdc 100644
--- a/Marlin/src/pins/ramps/pins_TT_OSCAR.h
+++ b/Marlin/src/pins/ramps/pins_TT_OSCAR.h
@@ -252,15 +252,17 @@
 //
 // Průša i3 MK2 Multiplexer Support
 //
-//#ifndef E_MUX0_PIN
-//  #define E_MUX0_PIN       58   // Y_CS_PIN
-//#endif
-//#ifndef E_MUX1_PIN
-//  #define E_MUX1_PIN       53   // Z_CS_PIN
-//#endif
-//#ifndef E_MUX2_PIN
-//  #define E_MUX2_PIN       49   // En_CS_PIN
-//#endif
+#if 0 && HAS_PRUSA_MMU1
+  #ifndef E_MUX0_PIN
+    #define E_MUX0_PIN                        58  // Y_CS_PIN
+  #endif
+  #ifndef E_MUX1_PIN
+    #define E_MUX1_PIN                        53  // Z_CS_PIN
+  #endif
+  #ifndef E_MUX2_PIN
+    #define E_MUX2_PIN                        49  // En_CS_PIN
+  #endif
+#endif
 
 //////////////////////////
 // LCDs and Controllers //
diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h
index c904d57a1f..e4fc97170c 100644
--- a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h
+++ b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h
@@ -133,8 +133,10 @@
 //
 // Průša i3 MK2 Multi Material Multiplexer Support
 //
-//#define E_MUX0_PIN                        -1
-//#define E_MUX1_PIN                        -1
+#if HAS_PRUSA_MMU1
+  //#define E_MUX0_PIN                      -1
+  //#define E_MUX1_PIN                      -1
+#endif
 
 //
 // LED / Lighting
diff --git a/Marlin/src/pins/stm32f4/pins_VAKE403D.h b/Marlin/src/pins/stm32f4/pins_VAKE403D.h
index bb5507b29a..c6b24f9eca 100644
--- a/Marlin/src/pins/stm32f4/pins_VAKE403D.h
+++ b/Marlin/src/pins/stm32f4/pins_VAKE403D.h
@@ -150,8 +150,10 @@
 //
 // Průša i3 MK2 Multi Material Multiplexer Support
 //
-//#define E_MUX0_PIN                        PG3
-//#define E_MUX1_PIN                        PG4
+#if HAS_PRUSA_MMU1
+  //#define E_MUX0_PIN                      PG3
+  //#define E_MUX1_PIN                      PG4
+#endif
 
 #define LED_PIN                             PB14  // Alive
 #define PS_ON_PIN                           PE0