From 4a9d380117312e707723aba6e49e870c5b18cf3f Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Sun, 11 Aug 2024 13:45:37 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20MKS=20Gen-L=20V1=20PWM=20p?= =?UTF-8?q?ins=20(#26974)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h | 10 +++---- Marlin/src/pins/pins.h | 22 +++++++------- Marlin/src/pins/ramps/pins_MKS_GEN_L.h | 33 +++++++++++++++++---- Marlin/src/pins/ramps/pins_RAMPS.h | 30 ++++++++++++------- Marlin/src/pins/ramps/pins_XTLW_MFF_V1.h | 2 +- 5 files changed, 64 insertions(+), 33 deletions(-) diff --git a/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h b/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h index 14d6178a1a..6ee1f11659 100644 --- a/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h +++ b/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h @@ -187,14 +187,14 @@ #define HEATER_0_PIN MOSFET_A_PIN -#if FET_ORDER_EFB // Hotend, Fan, Bed +#if ENABLED(FET_ORDER_EFB) // Hotend, Fan, Bed #define HEATER_BED_PIN MOSFET_C_PIN -#elif FET_ORDER_EEF // Hotend, Hotend, Fan +#elif ENABLED(FET_ORDER_EEF) // Hotend, Hotend, Fan #define HEATER_1_PIN MOSFET_B_PIN -#elif FET_ORDER_EEB // Hotend, Hotend, Bed +#elif ENABLED(FET_ORDER_EEB) // Hotend, Hotend, Bed #define HEATER_1_PIN MOSFET_B_PIN #define HEATER_BED_PIN MOSFET_C_PIN -#elif FET_ORDER_EFF // Hotend, Fan, Fan +#elif ENABLED(FET_ORDER_EFF) // Hotend, Fan, Fan #define FAN1_PIN MOSFET_C_PIN #elif DISABLED(FET_ORDER_SF) // Not Spindle, Fan (i.e., "EFBF" or "EFBE") #define HEATER_BED_PIN MOSFET_C_PIN @@ -210,7 +210,7 @@ #define FAN0_PIN MOSFET_B_PIN #elif ANY(FET_ORDER_EEF, FET_ORDER_SF) // Hotend, Hotend, Fan or Spindle, Fan #define FAN0_PIN MOSFET_C_PIN - #elif FET_ORDER_EEB // Hotend, Hotend, Bed + #elif ENABLED(FET_ORDER_EEB) // Hotend, Hotend, Bed #define FAN0_PIN P1_18 // (4) IO pin. Buffer needed #else // Non-specific are "EFB" (i.e., "EFBF" or "EFBE") #define FAN0_PIN MOSFET_B_PIN diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 443e5fbd23..f7dc20d252 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -39,25 +39,25 @@ #if NONE(FET_ORDER_EEF, FET_ORDER_EEB, FET_ORDER_EFF, FET_ORDER_EFB, FET_ORDER_SF) #if MB(RAMPS_13_EFB, RAMPS_14_EFB, RAMPS_PLUS_EFB, RAMPS_14_RE_ARM_EFB, RAMPS_SMART_EFB, RAMPS_DUO_EFB, RAMPS4DUE_EFB, RAMPS_BTT_16_PLUS_EFB) - #define FET_ORDER_EFB 1 + #define FET_ORDER_EFB #elif MB(RAMPS_13_EEB, RAMPS_14_EEB, RAMPS_PLUS_EEB, RAMPS_14_RE_ARM_EEB, RAMPS_SMART_EEB, RAMPS_DUO_EEB, RAMPS4DUE_EEB, RAMPS_BTT_16_PLUS_EEB) - #define FET_ORDER_EEB 1 + #define FET_ORDER_EEB #elif MB(RAMPS_13_EFF, RAMPS_14_EFF, RAMPS_PLUS_EFF, RAMPS_14_RE_ARM_EFF, RAMPS_SMART_EFF, RAMPS_DUO_EFF, RAMPS4DUE_EFF, RAMPS_BTT_16_PLUS_EFF) - #define FET_ORDER_EFF 1 + #define FET_ORDER_EFF #elif MB(RAMPS_13_EEF, RAMPS_14_EEF, RAMPS_PLUS_EEF, RAMPS_14_RE_ARM_EEF, RAMPS_SMART_EEF, RAMPS_DUO_EEF, RAMPS4DUE_EEF, RAMPS_BTT_16_PLUS_EEF) - #define FET_ORDER_EEF 1 + #define FET_ORDER_EEF #elif MB(RAMPS_13_SF, RAMPS_14_SF, RAMPS_PLUS_SF, RAMPS_14_RE_ARM_SF, RAMPS_SMART_SF, RAMPS_DUO_SF, RAMPS4DUE_SF, RAMPS_BTT_16_PLUS_SF) - #define FET_ORDER_SF 1 - #elif HAS_MULTI_HOTEND || (HAS_EXTRUDERS && HAS_CUTTER) + #define FET_ORDER_SF + #elif ANY(HAS_MULTI_HOTEND, HEATERS_PARALLEL) || ALL(HAS_EXTRUDERS, HAS_CUTTER) #if TEMP_SENSOR_BED - #define FET_ORDER_EEB 1 + #define FET_ORDER_EEB #else - #define FET_ORDER_EEF 1 + #define FET_ORDER_EEF #endif #elif TEMP_SENSOR_BED - #define FET_ORDER_EFB 1 + #define FET_ORDER_EFB #else - #define FET_ORDER_EFF 1 + #define FET_ORDER_EFF #endif #endif @@ -175,7 +175,7 @@ #elif MB(MKS_GEN_13) #include "ramps/pins_MKS_GEN_13.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(MKS_GEN_L) - #include "ramps/pins_MKS_GEN_L.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "ramps/pins_MKS_GEN_L.h" // ATmega2560 env:mega2560 #elif MB(KFB_2) #include "ramps/pins_BIQU_KFB_2.h" // ATmega2560 env:mega2560 #elif MB(ZRIB_V20) diff --git a/Marlin/src/pins/ramps/pins_MKS_GEN_L.h b/Marlin/src/pins/ramps/pins_MKS_GEN_L.h index dfd8736c81..4c0702f309 100644 --- a/Marlin/src/pins/ramps/pins_MKS_GEN_L.h +++ b/Marlin/src/pins/ramps/pins_MKS_GEN_L.h @@ -24,7 +24,9 @@ /** * MKS GEN L – Arduino Mega2560 with RAMPS v1.4 pin assignments * Schematic: https://github.com/makerbase-mks/MKS-GEN_L/blob/master/hardware/MKS%20Gen_L%20V1.0_008/MKS%20Gen_L%20V1.0_008%20SCH.pdf - * ATmega2560, ATmega1280 + * Pin Diagram: https://github.com/makerbase-mks/MKS-GEN_L/blob/master/hardware/MKS%20Gen_L%20V1.0_008/MKS%20Gen_L%20V1.0_008%20PIN.pdf + * Note: Schematic contains pin & connector errors, correct pin mappings are found on the pin diagram + * ATmega2560 */ #if HOTENDS > 2 || E_STEPPERS > 2 @@ -37,10 +39,30 @@ // Heaters / Fans // -#define MOSFET_A_PIN 10 // HE0 -#define MOSFET_B_PIN 7 // HE1 or FAN Hotend Cooling -#define MOSFET_C_PIN 8 // HBED -#define FAN0_PIN 9 // FAN Part Cooling +#ifndef MOSFET_A_PIN + #define MOSFET_A_PIN 10 // HE0 +#endif +#ifndef MOSFET_B_PIN + #define MOSFET_B_PIN 7 // HE1 or FAN Hotend Cooling +#endif +#ifndef MOSFET_C_PIN + #define MOSFET_C_PIN 8 // H-BED +#endif +#ifndef MOSFET_D_PIN + #define MOSFET_D_PIN 9 // FAN Part Cooling +#endif + +// Always assign these to their labeled counterparts +#define HEATER_0_PIN MOSFET_A_PIN +#if ANY(FET_ORDER_EEF, FET_ORDER_EEB) + #define HEATER_1_PIN MOSFET_B_PIN +#endif +#define HEATER_BED_PIN MOSFET_C_PIN + +#define FAN0_PIN MOSFET_D_PIN +#if ENABLED(FET_ORDER_EFF) + #define FAN1_PIN MOSFET_B_PIN +#endif // // CS Pins wired to avoid conflict with the LCD @@ -50,7 +72,6 @@ #ifndef X_CS_PIN #define X_CS_PIN 59 #endif - #ifndef Y_CS_PIN #define Y_CS_PIN 63 #endif diff --git a/Marlin/src/pins/ramps/pins_RAMPS.h b/Marlin/src/pins/ramps/pins_RAMPS.h index 1fc1dac6ad..2d82b36f77 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS.h +++ b/Marlin/src/pins/ramps/pins_RAMPS.h @@ -231,20 +231,26 @@ #define MOSFET_D_PIN -1 #endif -#define HEATER_0_PIN MOSFET_A_PIN +#ifndef HEATER_0_PIN + #define HEATER_0_PIN MOSFET_A_PIN +#endif -#if FET_ORDER_EFB // Hotend, Fan, Bed +#if ENABLED(FET_ORDER_EFB) // Hotend, Fan, Bed #ifndef HEATER_BED_PIN #define HEATER_BED_PIN MOSFET_C_PIN #endif -#elif FET_ORDER_EEF // Hotend, Hotend, Fan - #define HEATER_1_PIN MOSFET_B_PIN -#elif FET_ORDER_EEB // Hotend, Hotend, Bed - #define HEATER_1_PIN MOSFET_B_PIN +#elif ENABLED(FET_ORDER_EEF) // Hotend, Hotend, Fan + #ifndef HEATER_1_PIN + #define HEATER_1_PIN MOSFET_B_PIN + #endif +#elif ENABLED(FET_ORDER_EEB) // Hotend, Hotend, Bed + #ifndef HEATER_1_PIN + #define HEATER_1_PIN MOSFET_B_PIN + #endif #ifndef HEATER_BED_PIN #define HEATER_BED_PIN MOSFET_C_PIN #endif -#elif FET_ORDER_EFF // Hotend, Fan, Fan +#elif ENABLED(FET_ORDER_EFF) // Hotend, Fan, Fan #ifndef FAN1_PIN #define FAN1_PIN MOSFET_C_PIN #endif @@ -253,9 +259,13 @@ #define HEATER_BED_PIN MOSFET_C_PIN #endif #if ANY(HAS_MULTI_HOTEND, HEATERS_PARALLEL) - #define HEATER_1_PIN MOSFET_D_PIN + #ifndef HEATER_1_PIN + #define HEATER_1_PIN MOSFET_D_PIN + #endif #else - #define FAN1_PIN MOSFET_D_PIN + #ifndef FAN1_PIN + #define FAN1_PIN MOSFET_D_PIN + #endif #endif #endif @@ -264,7 +274,7 @@ #define FAN0_PIN MOSFET_B_PIN #elif ANY(FET_ORDER_EEF, FET_ORDER_SF) // Hotend, Hotend, Fan or Spindle, Fan #define FAN0_PIN MOSFET_C_PIN - #elif FET_ORDER_EEB // Hotend, Hotend, Bed + #elif ENABLED(FET_ORDER_EEB) // Hotend, Hotend, Bed #define FAN0_PIN 4 // IO pin. Buffer needed #else // Non-specific are "EFB" (i.e., "EFBF" or "EFBE") #define FAN0_PIN MOSFET_B_PIN diff --git a/Marlin/src/pins/ramps/pins_XTLW_MFF_V1.h b/Marlin/src/pins/ramps/pins_XTLW_MFF_V1.h index c53727b5ef..f8735e096d 100644 --- a/Marlin/src/pins/ramps/pins_XTLW_MFF_V1.h +++ b/Marlin/src/pins/ramps/pins_XTLW_MFF_V1.h @@ -48,7 +48,7 @@ // Heaters / Fans // -#define FET_ORDER_EFB 1 +#define FET_ORDER_EFB //#define HEATER_0_PIN 10 #define MOSFET_D_PIN 7 //#define HEATER_BED_PIN 8