diff --git a/Marlin/Conditionals_post.h b/Marlin/Conditionals_post.h index 4bbc5d771..95054af1e 100644 --- a/Marlin/Conditionals_post.h +++ b/Marlin/Conditionals_post.h @@ -428,20 +428,20 @@ #define HAS_HEATER_2 (PIN_EXISTS(HEATER_2)) #define HAS_HEATER_3 (PIN_EXISTS(HEATER_3)) #define HAS_HEATER_BED (PIN_EXISTS(HEATER_BED)) - #define HAS_AUTO_FAN_0 (PIN_EXISTS(EXTRUDER_0_AUTO_FAN)) - #define HAS_AUTO_FAN_1 (PIN_EXISTS(EXTRUDER_1_AUTO_FAN)) - #define HAS_AUTO_FAN_2 (PIN_EXISTS(EXTRUDER_2_AUTO_FAN)) - #define HAS_AUTO_FAN_3 (PIN_EXISTS(EXTRUDER_3_AUTO_FAN)) - #define AUTO_1_IS_0 (EXTRUDER_1_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN) - #define AUTO_2_IS_0 (EXTRUDER_2_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN) - #define AUTO_2_IS_1 (EXTRUDER_2_AUTO_FAN_PIN == EXTRUDER_1_AUTO_FAN_PIN) - #define AUTO_3_IS_0 (EXTRUDER_3_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN) - #define AUTO_3_IS_1 (EXTRUDER_3_AUTO_FAN_PIN == EXTRUDER_1_AUTO_FAN_PIN) - #define AUTO_3_IS_2 (EXTRUDER_3_AUTO_FAN_PIN == EXTRUDER_2_AUTO_FAN_PIN) + #define HAS_AUTO_FAN_0 (PIN_EXISTS(E0_AUTO_FAN)) + #define HAS_AUTO_FAN_1 (HOTENDS > 1 && PIN_EXISTS(E1_AUTO_FAN)) + #define HAS_AUTO_FAN_2 (HOTENDS > 2 && PIN_EXISTS(E2_AUTO_FAN)) + #define HAS_AUTO_FAN_3 (HOTENDS > 3 && PIN_EXISTS(E3_AUTO_FAN)) #define HAS_AUTO_FAN (HAS_AUTO_FAN_0 || HAS_AUTO_FAN_1 || HAS_AUTO_FAN_2 || HAS_AUTO_FAN_3) + #define AUTO_1_IS_0 (E1_AUTO_FAN_PIN == E0_AUTO_FAN_PIN) + #define AUTO_2_IS_0 (E2_AUTO_FAN_PIN == E0_AUTO_FAN_PIN) + #define AUTO_2_IS_1 (E2_AUTO_FAN_PIN == E1_AUTO_FAN_PIN) + #define AUTO_3_IS_0 (E3_AUTO_FAN_PIN == E0_AUTO_FAN_PIN) + #define AUTO_3_IS_1 (E3_AUTO_FAN_PIN == E1_AUTO_FAN_PIN) + #define AUTO_3_IS_2 (E3_AUTO_FAN_PIN == E2_AUTO_FAN_PIN) #define HAS_FAN0 (PIN_EXISTS(FAN)) - #define HAS_FAN1 (PIN_EXISTS(FAN1) && CONTROLLERFAN_PIN != FAN1_PIN && EXTRUDER_0_AUTO_FAN_PIN != FAN1_PIN && EXTRUDER_1_AUTO_FAN_PIN != FAN1_PIN && EXTRUDER_2_AUTO_FAN_PIN != FAN1_PIN && EXTRUDER_3_AUTO_FAN_PIN != FAN1_PIN) - #define HAS_FAN2 (PIN_EXISTS(FAN2) && CONTROLLERFAN_PIN != FAN2_PIN && EXTRUDER_0_AUTO_FAN_PIN != FAN2_PIN && EXTRUDER_1_AUTO_FAN_PIN != FAN2_PIN && EXTRUDER_2_AUTO_FAN_PIN != FAN2_PIN && EXTRUDER_3_AUTO_FAN_PIN != FAN2_PIN) + #define HAS_FAN1 (PIN_EXISTS(FAN1) && CONTROLLERFAN_PIN != FAN1_PIN && E0_AUTO_FAN_PIN != FAN1_PIN && E1_AUTO_FAN_PIN != FAN1_PIN && E2_AUTO_FAN_PIN != FAN1_PIN && E3_AUTO_FAN_PIN != FAN1_PIN) + #define HAS_FAN2 (PIN_EXISTS(FAN2) && CONTROLLERFAN_PIN != FAN2_PIN && E0_AUTO_FAN_PIN != FAN2_PIN && E1_AUTO_FAN_PIN != FAN2_PIN && E2_AUTO_FAN_PIN != FAN2_PIN && E3_AUTO_FAN_PIN != FAN2_PIN) #define HAS_CONTROLLERFAN (PIN_EXISTS(CONTROLLERFAN)) #define HAS_SERVOS (defined(NUM_SERVOS) && NUM_SERVOS > 0) #define HAS_SERVO_0 (PIN_EXISTS(SERVO0)) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index a0a65f9c2..067d86c48 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -205,15 +205,22 @@ // @section extruder -// Extruder cooling fans -// Configure fan pin outputs to automatically turn on/off when the associated -// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. -// Multiple extruders can be assigned to the same pin in which case -// the fan will turn on when any selected extruder is above the threshold. -#define EXTRUDER_0_AUTO_FAN_PIN -1 -#define EXTRUDER_1_AUTO_FAN_PIN -1 -#define EXTRUDER_2_AUTO_FAN_PIN -1 -#define EXTRUDER_3_AUTO_FAN_PIN -1 +/** + * Extruder cooling fans + * + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. + * + * Your board's pins file specifies the recommended pins. Override those here + * or set to -1 to disable completely. + * + * Multiple extruders can be assigned to the same pin in which case + * the fan will turn on when any selected extruder is above the threshold. + */ +#define E0_AUTO_FAN_PIN -1 +#define E1_AUTO_FAN_PIN -1 +#define E2_AUTO_FAN_PIN -1 +#define E3_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 10a7d6fc6..a21970156 100755 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -9248,8 +9248,14 @@ void prepare_move_to_destination() { bool new_led = (max_temp > 55.0) ? true : (max_temp < 54.0) ? false : red_led; if (new_led != red_led) { red_led = new_led; - WRITE(STAT_LED_RED_PIN, new_led ? HIGH : LOW); - WRITE(STAT_LED_BLUE_PIN, new_led ? LOW : HIGH); + #if PIN_EXISTS(STAT_LED_RED) + WRITE(STAT_LED_RED_PIN, new_led ? HIGH : LOW); + #if PIN_EXISTS(STAT_LED_BLUE) + WRITE(STAT_LED_BLUE_PIN, new_led ? LOW : HIGH); + #endif + #else + WRITE(STAT_LED_BLUE_PIN, new_led ? HIGH : LOW); + #endif } } } diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index cb3c8599a..3cd9adeb6 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -153,6 +153,8 @@ #error "LCD_PIN_BL is now LCD_BACKLIGHT_PIN. Please update your pins definitions." #elif defined(LCD_PIN_RESET) #error "LCD_PIN_RESET is now LCD_RESET_PIN. Please update your pins definitions." +#elif defined(EXTRUDER_0_AUTO_FAN_PIN) || defined(EXTRUDER_1_AUTO_FAN_PIN) || defined(EXTRUDER_2_AUTO_FAN_PIN) || defined(EXTRUDER_3_AUTO_FAN_PIN) + #error "EXTRUDER_[0123]_AUTO_FAN_PIN is now E[0123]_AUTO_FAN_PIN. Please update your Configuration_adv.h." #endif /** @@ -678,14 +680,14 @@ */ #if HAS_AUTO_FAN #if HAS_FAN0 - #if EXTRUDER_0_AUTO_FAN_PIN == FAN_PIN - #error "You cannot set EXTRUDER_0_AUTO_FAN_PIN equal to FAN_PIN." - #elif EXTRUDER_1_AUTO_FAN_PIN == FAN_PIN - #error "You cannot set EXTRUDER_1_AUTO_FAN_PIN equal to FAN_PIN." - #elif EXTRUDER_2_AUTO_FAN_PIN == FAN_PIN - #error "You cannot set EXTRUDER_2_AUTO_FAN_PIN equal to FAN_PIN." - #elif EXTRUDER_3_AUTO_FAN_PIN == FAN_PIN - #error "You cannot set EXTRUDER_3_AUTO_FAN_PIN equal to FAN_PIN." + #if E0_AUTO_FAN_PIN == FAN_PIN + #error "You cannot set E0_AUTO_FAN_PIN equal to FAN_PIN." + #elif E1_AUTO_FAN_PIN == FAN_PIN + #error "You cannot set E1_AUTO_FAN_PIN equal to FAN_PIN." + #elif E2_AUTO_FAN_PIN == FAN_PIN + #error "You cannot set E2_AUTO_FAN_PIN equal to FAN_PIN." + #elif E3_AUTO_FAN_PIN == FAN_PIN + #error "You cannot set E3_AUTO_FAN_PIN equal to FAN_PIN." #endif #endif #endif @@ -695,14 +697,14 @@ #endif #if HAS_CONTROLLERFAN - #if EXTRUDER_0_AUTO_FAN_PIN == CONTROLLERFAN_PIN - #error "You cannot set EXTRUDER_0_AUTO_FAN_PIN equal to CONTROLLERFAN_PIN." - #elif EXTRUDER_1_AUTO_FAN_PIN == CONTROLLERFAN_PIN - #error "You cannot set EXTRUDER_1_AUTO_FAN_PIN equal to CONTROLLERFAN_PIN." - #elif EXTRUDER_2_AUTO_FAN_PIN == CONTROLLERFAN_PIN - #error "You cannot set EXTRUDER_2_AUTO_FAN_PIN equal to CONTROLLERFAN_PIN." - #elif EXTRUDER_3_AUTO_FAN_PIN == CONTROLLERFAN_PIN - #error "You cannot set EXTRUDER_3_AUTO_FAN_PIN equal to CONTROLLERFAN_PIN." + #if E0_AUTO_FAN_PIN == CONTROLLERFAN_PIN + #error "You cannot set E0_AUTO_FAN_PIN equal to CONTROLLERFAN_PIN." + #elif E1_AUTO_FAN_PIN == CONTROLLERFAN_PIN + #error "You cannot set E1_AUTO_FAN_PIN equal to CONTROLLERFAN_PIN." + #elif E2_AUTO_FAN_PIN == CONTROLLERFAN_PIN + #error "You cannot set E2_AUTO_FAN_PIN equal to CONTROLLERFAN_PIN." + #elif E3_AUTO_FAN_PIN == CONTROLLERFAN_PIN + #error "You cannot set E3_AUTO_FAN_PIN equal to CONTROLLERFAN_PIN." #endif #endif @@ -770,8 +772,8 @@ /** * Temperature status LEDs */ -#if ENABLED(TEMP_STAT_LEDS) && !(PIN_EXISTS(STAT_LED_RED) && PIN_EXISTS(STAT_LED_BLUE)) - #error "TEMP_STAT_LEDS requires STAT_LED_RED_PIN and STAT_LED_BLUE_PIN." +#if ENABLED(TEMP_STAT_LEDS) && !PIN_EXISTS(STAT_LED_RED) && !PIN_EXISTS(STAT_LED_BLUE) + #error "TEMP_STAT_LEDS requires STAT_LED_RED_PIN or STAT_LED_BLUE_PIN, preferably both." #endif /** @@ -868,6 +870,23 @@ #endif #endif +/** + * Auto Fan check for PWM pins + */ +#if HAS_AUTO_FAN && EXTRUDER_AUTO_FAN_SPEED != 255 + #define AF_ERR_SUFF "_AUTO_FAN_PIN is not a PWM pin. Set EXTRUDER_AUTO_FAN_SPEED to 255." + #if HAS_AUTO_FAN_0 + static_assert(GET_TIMER(E0_AUTO_FAN_PIN), "E0" AF_ERR_SUFF); + #elif HAS_AUTO_FAN_1 + static_assert(GET_TIMER(E1_AUTO_FAN_PIN), "E1" AF_ERR_SUFF); + #elif HAS_AUTO_FAN_2 + static_assert(GET_TIMER(E2_AUTO_FAN_PIN), "E2" AF_ERR_SUFF); + #elif HAS_AUTO_FAN_3 + static_assert(GET_TIMER(E3_AUTO_FAN_PIN), "E3" AF_ERR_SUFF); + #endif +#endif + + /** * Make sure only one display is enabled * @@ -942,7 +961,7 @@ #else #define COUNT_LCD_13 COUNT_LCD_12 #endif -#if ENABLED(REPRAPWORLD_KEYPAD) +#if ENABLED(REPRAPWORLD_KEYPAD) && DISABLED(CARTESIO_UI) #define COUNT_LCD_14 INCREMENT(COUNT_LCD_13) #else #define COUNT_LCD_14 COUNT_LCD_13 diff --git a/Marlin/example_configurations/Cartesio/Configuration_adv.h b/Marlin/example_configurations/Cartesio/Configuration_adv.h index 98e491221..0cef74a09 100644 --- a/Marlin/example_configurations/Cartesio/Configuration_adv.h +++ b/Marlin/example_configurations/Cartesio/Configuration_adv.h @@ -205,15 +205,22 @@ // @section extruder -// Extruder cooling fans -// Configure fan pin outputs to automatically turn on/off when the associated -// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. -// Multiple extruders can be assigned to the same pin in which case -// the fan will turn on when any selected extruder is above the threshold. -#define EXTRUDER_0_AUTO_FAN_PIN 7 -#define EXTRUDER_1_AUTO_FAN_PIN 7 -#define EXTRUDER_2_AUTO_FAN_PIN -1 -#define EXTRUDER_3_AUTO_FAN_PIN -1 +/** + * Extruder cooling fans + * + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. + * + * Your board's pins file specifies the recommended pins. Override those here + * or set to -1 to disable completely. + * + * Multiple extruders can be assigned to the same pin in which case + * the fan will turn on when any selected extruder is above the threshold. + */ +//#define E0_AUTO_FAN_PIN -1 +//#define E1_AUTO_FAN_PIN -1 +#define E2_AUTO_FAN_PIN -1 +#define E3_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 35 #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index 4138656e2..7139ac135 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -205,15 +205,22 @@ // @section extruder -// Extruder cooling fans -// Configure fan pin outputs to automatically turn on/off when the associated -// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. -// Multiple extruders can be assigned to the same pin in which case -// the fan will turn on when any selected extruder is above the threshold. -#define EXTRUDER_0_AUTO_FAN_PIN -1 -#define EXTRUDER_1_AUTO_FAN_PIN -1 -#define EXTRUDER_2_AUTO_FAN_PIN -1 -#define EXTRUDER_3_AUTO_FAN_PIN -1 +/** + * Extruder cooling fans + * + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. + * + * Your board's pins file specifies the recommended pins. Override those here + * or set to -1 to disable completely. + * + * Multiple extruders can be assigned to the same pin in which case + * the fan will turn on when any selected extruder is above the threshold. + */ +#define E0_AUTO_FAN_PIN -1 +#define E1_AUTO_FAN_PIN -1 +#define E2_AUTO_FAN_PIN -1 +#define E3_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h index fb337fc77..8f04e5ea3 100644 --- a/Marlin/example_configurations/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h @@ -205,15 +205,22 @@ // @section extruder -// Extruder cooling fans -// Configure fan pin outputs to automatically turn on/off when the associated -// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. -// Multiple extruders can be assigned to the same pin in which case -// the fan will turn on when any selected extruder is above the threshold. -#define EXTRUDER_0_AUTO_FAN_PIN -1 -#define EXTRUDER_1_AUTO_FAN_PIN -1 -#define EXTRUDER_2_AUTO_FAN_PIN -1 -#define EXTRUDER_3_AUTO_FAN_PIN -1 +/** + * Extruder cooling fans + * + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. + * + * Your board's pins file specifies the recommended pins. Override those here + * or set to -1 to disable completely. + * + * Multiple extruders can be assigned to the same pin in which case + * the fan will turn on when any selected extruder is above the threshold. + */ +#define E0_AUTO_FAN_PIN -1 +#define E1_AUTO_FAN_PIN -1 +#define E2_AUTO_FAN_PIN -1 +#define E3_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed diff --git a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h index e5c46ae26..b221ab74c 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h @@ -205,15 +205,22 @@ // @section extruder -// Extruder cooling fans -// Configure fan pin outputs to automatically turn on/off when the associated -// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. -// Multiple extruders can be assigned to the same pin in which case -// the fan will turn on when any selected extruder is above the threshold. -#define EXTRUDER_0_AUTO_FAN_PIN 11 -#define EXTRUDER_1_AUTO_FAN_PIN 6 -#define EXTRUDER_2_AUTO_FAN_PIN -1 -#define EXTRUDER_3_AUTO_FAN_PIN -1 +/** + * Extruder cooling fans + * + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. + * + * Your board's pins file specifies the recommended pins. Override those here + * or set to -1 to disable completely. + * + * Multiple extruders can be assigned to the same pin in which case + * the fan will turn on when any selected extruder is above the threshold. + */ +//#define E0_AUTO_FAN_PIN -1 +//#define E1_AUTO_FAN_PIN -1 +#define E2_AUTO_FAN_PIN -1 +#define E3_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h index 0985448e1..8ea34fc92 100644 --- a/Marlin/example_configurations/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/K8200/Configuration_adv.h @@ -211,15 +211,22 @@ // @section extruder -// Extruder cooling fans -// Configure fan pin outputs to automatically turn on/off when the associated -// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. -// Multiple extruders can be assigned to the same pin in which case -// the fan will turn on when any selected extruder is above the threshold. -#define EXTRUDER_0_AUTO_FAN_PIN -1 -#define EXTRUDER_1_AUTO_FAN_PIN -1 -#define EXTRUDER_2_AUTO_FAN_PIN -1 -#define EXTRUDER_3_AUTO_FAN_PIN -1 +/** + * Extruder cooling fans + * + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. + * + * Your board's pins file specifies the recommended pins. Override those here + * or set to -1 to disable completely. + * + * Multiple extruders can be assigned to the same pin in which case + * the fan will turn on when any selected extruder is above the threshold. + */ +#define E0_AUTO_FAN_PIN -1 +#define E1_AUTO_FAN_PIN -1 +#define E2_AUTO_FAN_PIN -1 +#define E3_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed diff --git a/Marlin/example_configurations/K8400/Configuration_adv.h b/Marlin/example_configurations/K8400/Configuration_adv.h index ebb9e8371..3cc822cc4 100644 --- a/Marlin/example_configurations/K8400/Configuration_adv.h +++ b/Marlin/example_configurations/K8400/Configuration_adv.h @@ -205,15 +205,22 @@ // @section extruder -// Extruder cooling fans -// Configure fan pin outputs to automatically turn on/off when the associated -// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. -// Multiple extruders can be assigned to the same pin in which case -// the fan will turn on when any selected extruder is above the threshold. -#define EXTRUDER_0_AUTO_FAN_PIN -1 -#define EXTRUDER_1_AUTO_FAN_PIN -1 -#define EXTRUDER_2_AUTO_FAN_PIN -1 -#define EXTRUDER_3_AUTO_FAN_PIN -1 +/** + * Extruder cooling fans + * + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. + * + * Your board's pins file specifies the recommended pins. Override those here + * or set to -1 to disable completely. + * + * Multiple extruders can be assigned to the same pin in which case + * the fan will turn on when any selected extruder is above the threshold. + */ +#define E0_AUTO_FAN_PIN -1 +#define E1_AUTO_FAN_PIN -1 +#define E2_AUTO_FAN_PIN -1 +#define E3_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed diff --git a/Marlin/example_configurations/RigidBot/Configuration_adv.h b/Marlin/example_configurations/RigidBot/Configuration_adv.h index ad70111aa..71166d48d 100644 --- a/Marlin/example_configurations/RigidBot/Configuration_adv.h +++ b/Marlin/example_configurations/RigidBot/Configuration_adv.h @@ -205,15 +205,22 @@ // @section extruder -// Extruder cooling fans -// Configure fan pin outputs to automatically turn on/off when the associated -// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. -// Multiple extruders can be assigned to the same pin in which case -// the fan will turn on when any selected extruder is above the threshold. -#define EXTRUDER_0_AUTO_FAN_PIN -1 -#define EXTRUDER_1_AUTO_FAN_PIN -1 -#define EXTRUDER_2_AUTO_FAN_PIN -1 -#define EXTRUDER_3_AUTO_FAN_PIN -1 +/** + * Extruder cooling fans + * + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. + * + * Your board's pins file specifies the recommended pins. Override those here + * or set to -1 to disable completely. + * + * Multiple extruders can be assigned to the same pin in which case + * the fan will turn on when any selected extruder is above the threshold. + */ +#define E0_AUTO_FAN_PIN -1 +#define E1_AUTO_FAN_PIN -1 +#define E2_AUTO_FAN_PIN -1 +#define E3_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index 331234018..706f41270 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -205,15 +205,22 @@ // @section extruder -// Extruder cooling fans -// Configure fan pin outputs to automatically turn on/off when the associated -// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. -// Multiple extruders can be assigned to the same pin in which case -// the fan will turn on when any selected extruder is above the threshold. -#define EXTRUDER_0_AUTO_FAN_PIN -1 -#define EXTRUDER_1_AUTO_FAN_PIN -1 -#define EXTRUDER_2_AUTO_FAN_PIN -1 -#define EXTRUDER_3_AUTO_FAN_PIN -1 +/** + * Extruder cooling fans + * + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. + * + * Your board's pins file specifies the recommended pins. Override those here + * or set to -1 to disable completely. + * + * Multiple extruders can be assigned to the same pin in which case + * the fan will turn on when any selected extruder is above the threshold. + */ +#define E0_AUTO_FAN_PIN -1 +#define E1_AUTO_FAN_PIN -1 +#define E2_AUTO_FAN_PIN -1 +#define E3_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed diff --git a/Marlin/example_configurations/TAZ4/Configuration_adv.h b/Marlin/example_configurations/TAZ4/Configuration_adv.h index 28eab90c7..2a39074b7 100644 --- a/Marlin/example_configurations/TAZ4/Configuration_adv.h +++ b/Marlin/example_configurations/TAZ4/Configuration_adv.h @@ -213,15 +213,22 @@ // @section extruder -// Extruder cooling fans -// Configure fan pin outputs to automatically turn on/off when the associated -// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. -// Multiple extruders can be assigned to the same pin in which case -// the fan will turn on when any selected extruder is above the threshold. -#define EXTRUDER_0_AUTO_FAN_PIN -1 -#define EXTRUDER_1_AUTO_FAN_PIN -1 -#define EXTRUDER_2_AUTO_FAN_PIN -1 -#define EXTRUDER_3_AUTO_FAN_PIN -1 +/** + * Extruder cooling fans + * + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. + * + * Your board's pins file specifies the recommended pins. Override those here + * or set to -1 to disable completely. + * + * Multiple extruders can be assigned to the same pin in which case + * the fan will turn on when any selected extruder is above the threshold. + */ +#define E0_AUTO_FAN_PIN -1 +#define E1_AUTO_FAN_PIN -1 +#define E2_AUTO_FAN_PIN -1 +#define E3_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h index fb337fc77..8f04e5ea3 100644 --- a/Marlin/example_configurations/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h @@ -205,15 +205,22 @@ // @section extruder -// Extruder cooling fans -// Configure fan pin outputs to automatically turn on/off when the associated -// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. -// Multiple extruders can be assigned to the same pin in which case -// the fan will turn on when any selected extruder is above the threshold. -#define EXTRUDER_0_AUTO_FAN_PIN -1 -#define EXTRUDER_1_AUTO_FAN_PIN -1 -#define EXTRUDER_2_AUTO_FAN_PIN -1 -#define EXTRUDER_3_AUTO_FAN_PIN -1 +/** + * Extruder cooling fans + * + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. + * + * Your board's pins file specifies the recommended pins. Override those here + * or set to -1 to disable completely. + * + * Multiple extruders can be assigned to the same pin in which case + * the fan will turn on when any selected extruder is above the threshold. + */ +#define E0_AUTO_FAN_PIN -1 +#define E1_AUTO_FAN_PIN -1 +#define E2_AUTO_FAN_PIN -1 +#define E3_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h index e22c36ce7..0a0036972 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h @@ -205,15 +205,22 @@ // @section extruder -// Extruder cooling fans -// Configure fan pin outputs to automatically turn on/off when the associated -// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. -// Multiple extruders can be assigned to the same pin in which case -// the fan will turn on when any selected extruder is above the threshold. -#define EXTRUDER_0_AUTO_FAN_PIN -1 -#define EXTRUDER_1_AUTO_FAN_PIN -1 -#define EXTRUDER_2_AUTO_FAN_PIN -1 -#define EXTRUDER_3_AUTO_FAN_PIN -1 +/** + * Extruder cooling fans + * + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. + * + * Your board's pins file specifies the recommended pins. + * Override those here. Set to -1 to disable unused fans. + * + * Multiple extruders can be assigned to the same pin in which case + * the fan will turn on when any selected extruder is above the threshold. + */ +#define E0_AUTO_FAN_PIN -1 +#define E1_AUTO_FAN_PIN -1 +#define E2_AUTO_FAN_PIN -1 +#define E3_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index d8da99e48..009fad39a 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -205,15 +205,22 @@ // @section extruder -// Extruder cooling fans -// Configure fan pin outputs to automatically turn on/off when the associated -// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. -// Multiple extruders can be assigned to the same pin in which case -// the fan will turn on when any selected extruder is above the threshold. -#define EXTRUDER_0_AUTO_FAN_PIN -1 -#define EXTRUDER_1_AUTO_FAN_PIN -1 -#define EXTRUDER_2_AUTO_FAN_PIN -1 -#define EXTRUDER_3_AUTO_FAN_PIN -1 +/** + * Extruder cooling fans + * + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. + * + * Your board's pins file specifies the recommended pins. Override those here + * or set to -1 to disable completely. + * + * Multiple extruders can be assigned to the same pin in which case + * the fan will turn on when any selected extruder is above the threshold. + */ +#define E0_AUTO_FAN_PIN -1 +#define E1_AUTO_FAN_PIN -1 +#define E2_AUTO_FAN_PIN -1 +#define E3_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index d8da99e48..009fad39a 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -205,15 +205,22 @@ // @section extruder -// Extruder cooling fans -// Configure fan pin outputs to automatically turn on/off when the associated -// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. -// Multiple extruders can be assigned to the same pin in which case -// the fan will turn on when any selected extruder is above the threshold. -#define EXTRUDER_0_AUTO_FAN_PIN -1 -#define EXTRUDER_1_AUTO_FAN_PIN -1 -#define EXTRUDER_2_AUTO_FAN_PIN -1 -#define EXTRUDER_3_AUTO_FAN_PIN -1 +/** + * Extruder cooling fans + * + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. + * + * Your board's pins file specifies the recommended pins. Override those here + * or set to -1 to disable completely. + * + * Multiple extruders can be assigned to the same pin in which case + * the fan will turn on when any selected extruder is above the threshold. + */ +#define E0_AUTO_FAN_PIN -1 +#define E1_AUTO_FAN_PIN -1 +#define E2_AUTO_FAN_PIN -1 +#define E3_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h index 8f80d130c..33aed463b 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h @@ -210,15 +210,22 @@ // @section extruder -// Extruder cooling fans -// Configure fan pin outputs to automatically turn on/off when the associated -// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. -// Multiple extruders can be assigned to the same pin in which case -// the fan will turn on when any selected extruder is above the threshold. -#define EXTRUDER_0_AUTO_FAN_PIN -1 -#define EXTRUDER_1_AUTO_FAN_PIN -1 -#define EXTRUDER_2_AUTO_FAN_PIN -1 -#define EXTRUDER_3_AUTO_FAN_PIN -1 +/** + * Extruder cooling fans + * + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. + * + * Your board's pins file specifies the recommended pins. Override those here + * or set to -1 to disable completely. + * + * Multiple extruders can be assigned to the same pin in which case + * the fan will turn on when any selected extruder is above the threshold. + */ +#define E0_AUTO_FAN_PIN -1 +#define E1_AUTO_FAN_PIN -1 +#define E2_AUTO_FAN_PIN -1 +#define E3_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h index 698f9270b..70f035f3d 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h @@ -205,15 +205,22 @@ // @section extruder -// Extruder cooling fans -// Configure fan pin outputs to automatically turn on/off when the associated -// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. -// Multiple extruders can be assigned to the same pin in which case -// the fan will turn on when any selected extruder is above the threshold. -#define EXTRUDER_0_AUTO_FAN_PIN -1 -#define EXTRUDER_1_AUTO_FAN_PIN -1 -#define EXTRUDER_2_AUTO_FAN_PIN -1 -#define EXTRUDER_3_AUTO_FAN_PIN -1 +/** + * Extruder cooling fans + * + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. + * + * Your board's pins file specifies the recommended pins. Override those here + * or set to -1 to disable completely. + * + * Multiple extruders can be assigned to the same pin in which case + * the fan will turn on when any selected extruder is above the threshold. + */ +#define E0_AUTO_FAN_PIN -1 +#define E1_AUTO_FAN_PIN -1 +#define E2_AUTO_FAN_PIN -1 +#define E3_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index d1a0f66fa..279fa7e32 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -205,15 +205,22 @@ // @section extruder -// Extruder cooling fans -// Configure fan pin outputs to automatically turn on/off when the associated -// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. -// Multiple extruders can be assigned to the same pin in which case -// the fan will turn on when any selected extruder is above the threshold. -#define EXTRUDER_0_AUTO_FAN_PIN -1 -#define EXTRUDER_1_AUTO_FAN_PIN -1 -#define EXTRUDER_2_AUTO_FAN_PIN -1 -#define EXTRUDER_3_AUTO_FAN_PIN -1 +/** + * Extruder cooling fans + * + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. + * + * Your board's pins file specifies the recommended pins. Override those here + * or set to -1 to disable completely. + * + * Multiple extruders can be assigned to the same pin in which case + * the fan will turn on when any selected extruder is above the threshold. + */ +#define E0_AUTO_FAN_PIN -1 +#define E1_AUTO_FAN_PIN -1 +#define E2_AUTO_FAN_PIN -1 +#define E3_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index f68070341..bea6cd5dd 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -205,15 +205,22 @@ // @section extruder -// Extruder cooling fans -// Configure fan pin outputs to automatically turn on/off when the associated -// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE. -// Multiple extruders can be assigned to the same pin in which case -// the fan will turn on when any selected extruder is above the threshold. -#define EXTRUDER_0_AUTO_FAN_PIN -1 -#define EXTRUDER_1_AUTO_FAN_PIN -1 -#define EXTRUDER_2_AUTO_FAN_PIN -1 -#define EXTRUDER_3_AUTO_FAN_PIN -1 +/** + * Extruder cooling fans + * + * Extruder auto fans automatically turn on when their extruders' + * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. + * + * Your board's pins file specifies the recommended pins. Override those here + * or set to -1 to disable completely. + * + * Multiple extruders can be assigned to the same pin in which case + * the fan will turn on when any selected extruder is above the threshold. + */ +#define E0_AUTO_FAN_PIN -1 +#define E1_AUTO_FAN_PIN -1 +#define E2_AUTO_FAN_PIN -1 +#define E3_AUTO_FAN_PIN -1 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed diff --git a/Marlin/fastio.h b/Marlin/fastio.h index ed1da59b9..98724231f 100644 --- a/Marlin/fastio.h +++ b/Marlin/fastio.h @@ -79,7 +79,7 @@ #define _GET_OUTPUT(IO) ((DIO ## IO ## _DDR & MASK(DIO ## IO ## _PIN)) != 0) /// check if pin is an timer -#define _GET_TIMER(IO) ((DIO ## IO ## _PWM) +#define _GET_TIMER(IO) (DIO ## IO ## _PWM) // why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html @@ -93,6 +93,8 @@ /// set pin as input wrapper #define SET_INPUT(IO) _SET_INPUT(IO) +/// set pin as input with pullup wrapper +#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _WRITE(IO, HIGH); }while(0) /// set pin as output wrapper #define SET_OUTPUT(IO) _SET_OUTPUT(IO) diff --git a/Marlin/pins.h b/Marlin/pins.h index f0720d7bf..b2701ae28 100644 --- a/Marlin/pins.h +++ b/Marlin/pins.h @@ -282,6 +282,22 @@ // Marlin needs to account for pins that equal -1 #define marlinAnalogInputToDigitalPin(p) ((p) == -1 ? -1 : analogInputToDigitalPin(p)) +// +// Assign auto fan pins if needed +// +#if !defined(E0_AUTO_FAN_PIN) && defined(ORIG_E0_AUTO_FAN_PIN) + #define E0_AUTO_FAN_PIN ORIG_E0_AUTO_FAN_PIN +#endif +#if !defined(E1_AUTO_FAN_PIN) && defined(ORIG_E1_AUTO_FAN_PIN) + #define E1_AUTO_FAN_PIN ORIG_E1_AUTO_FAN_PIN +#endif +#if !defined(E2_AUTO_FAN_PIN) && defined(ORIG_E2_AUTO_FAN_PIN) + #define E2_AUTO_FAN_PIN ORIG_E2_AUTO_FAN_PIN +#endif +#if !defined(E3_AUTO_FAN_PIN) && defined(ORIG_E3_AUTO_FAN_PIN) + #define E3_AUTO_FAN_PIN ORIG_E3_AUTO_FAN_PIN +#endif + // List of pins which to ignore when asked to change by gcode, 0 and 1 are RX and TX, do not mess with those! #define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, E0_MS1_PIN, E0_MS2_PIN, #define _E1_PINS @@ -306,7 +322,7 @@ #endif #endif -#define _H0_PINS HEATER_0_PIN, EXTRUDER_0_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_0_PIN), +#define _H0_PINS HEATER_0_PIN, E0_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_0_PIN), #define _H1_PINS #define _H2_PINS #define _H3_PINS @@ -314,13 +330,13 @@ #if HOTENDS > 1 #undef _H1_PINS - #define _H1_PINS HEATER_1_PIN, EXTRUDER_1_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_1_PIN), + #define _H1_PINS HEATER_1_PIN, E1_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_1_PIN), #if HOTENDS > 2 #undef _H2_PINS - #define _H2_PINS HEATER_2_PIN, EXTRUDER_2_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_2_PIN), + #define _H2_PINS HEATER_2_PIN, E2_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_2_PIN), #if HOTENDS > 3 #undef _H3_PINS - #define _H3_PINS HEATER_3_PIN, EXTRUDER_3_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_3_PIN), + #define _H3_PINS HEATER_3_PIN, E3_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_3_PIN), #if HOTENDS > 4 #undef _H4_PINS #define _H4_PINS HEATER_4_PIN, marlinAnalogInputToDigitalPin(TEMP_4_PIN), diff --git a/Marlin/pinsDebug.h b/Marlin/pinsDebug.h index d0b43a479..c06eabbe6 100644 --- a/Marlin/pinsDebug.h +++ b/Marlin/pinsDebug.h @@ -234,17 +234,17 @@ static bool report_pin_name(int8_t pin) { #if PIN_EXISTS(CONTROLLERFAN) PIN_SAY(CONTROLLERFAN_PIN); #endif - #if PIN_EXISTS(EXTRUDER_0_AUTO_FAN) - PIN_SAY(EXTRUDER_0_AUTO_FAN_PIN); + #if PIN_EXISTS(E0_AUTO_FAN) + PIN_SAY(E0_AUTO_FAN_PIN); #endif - #if PIN_EXISTS(EXTRUDER_1_AUTO_FAN) - PIN_SAY(EXTRUDER_1_AUTO_FAN_PIN); + #if PIN_EXISTS(E1_AUTO_FAN) + PIN_SAY(E1_AUTO_FAN_PIN); #endif - #if PIN_EXISTS(EXTRUDER_2_AUTO_FAN) - PIN_SAY(EXTRUDER_2_AUTO_FAN_PIN); + #if PIN_EXISTS(E2_AUTO_FAN) + PIN_SAY(E2_AUTO_FAN_PIN); #endif - #if PIN_EXISTS(EXTRUDER_3_AUTO_FAN) - PIN_SAY(EXTRUDER_3_AUTO_FAN_PIN); + #if PIN_EXISTS(E3_AUTO_FAN) + PIN_SAY(E3_AUTO_FAN_PIN); #endif #if PIN_EXISTS(HEATER_0) PIN_SAY(HEATER_0_PIN); diff --git a/Marlin/pins_AZTEEG_X3_PRO.h b/Marlin/pins_AZTEEG_X3_PRO.h index 99720613a..06c293410 100644 --- a/Marlin/pins_AZTEEG_X3_PRO.h +++ b/Marlin/pins_AZTEEG_X3_PRO.h @@ -106,10 +106,10 @@ #define CONTROLLERFAN_PIN 4 // Pin used for the fan to cool motherboard (-1 to disable) // Fans/Water Pump to cool the hotend cool side. -#define EXTRUDER_0_AUTO_FAN_PIN 5 -#define EXTRUDER_1_AUTO_FAN_PIN 5 -#define EXTRUDER_2_AUTO_FAN_PIN 5 -#define EXTRUDER_3_AUTO_FAN_PIN 5 +#define ORIG_E0_AUTO_FAN_PIN 5 +#define ORIG_E1_AUTO_FAN_PIN 5 +#define ORIG_E2_AUTO_FAN_PIN 5 +#define ORIG_E3_AUTO_FAN_PIN 5 // // LCD / Controller diff --git a/Marlin/pins_BQ_ZUM_MEGA_3D.h b/Marlin/pins_BQ_ZUM_MEGA_3D.h index 8075265f0..dff48a452 100644 --- a/Marlin/pins_BQ_ZUM_MEGA_3D.h +++ b/Marlin/pins_BQ_ZUM_MEGA_3D.h @@ -38,6 +38,14 @@ #define RAMPS_D10_PIN 9 #define MOSFET_D_PIN 7 +// +// Auto fans +// +#define ORIG_E0_AUTO_FAN_PIN 11 +#define ORIG_E1_AUTO_FAN_PIN 6 +#define ORIG_E2_AUTO_FAN_PIN 6 +#define ORIG_E3_AUTO_FAN_PIN 6 + #include "pins_RAMPS_13.h" // diff --git a/Marlin/pins_CNCONTROLS_11.h b/Marlin/pins_CNCONTROLS_11.h index dfd4c19bd..fdf6c317e 100644 --- a/Marlin/pins_CNCONTROLS_11.h +++ b/Marlin/pins_CNCONTROLS_11.h @@ -69,6 +69,11 @@ //#define FAN_PIN 7 // common PWM pin for all tools +#define ORIG_E0_AUTO_FAN_PIN 7 +#define ORIG_E1_AUTO_FAN_PIN 7 +#define ORIG_E2_AUTO_FAN_PIN 7 +#define ORIG_E3_AUTO_FAN_PIN 7 + // // Misc. Functions // diff --git a/Marlin/pins_CNCONTROLS_12.h b/Marlin/pins_CNCONTROLS_12.h index aac4d8afc..809d1a6db 100644 --- a/Marlin/pins_CNCONTROLS_12.h +++ b/Marlin/pins_CNCONTROLS_12.h @@ -69,6 +69,11 @@ #define FAN_PIN 5 // 5 is PWMtool3 -> 7 is common PWM pin for all tools +#define ORIG_E0_AUTO_FAN_PIN 7 +#define ORIG_E1_AUTO_FAN_PIN 7 +#define ORIG_E2_AUTO_FAN_PIN 7 +#define ORIG_E3_AUTO_FAN_PIN 7 + // // Misc. Functions // diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 08c88e6f8..b1f97eb61 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -454,7 +454,7 @@ int Temperature::getHeaterPower(int heater) { #if HAS_AUTO_FAN void Temperature::checkExtruderAutoFans() { - const int8_t fanPin[] = { EXTRUDER_0_AUTO_FAN_PIN, EXTRUDER_1_AUTO_FAN_PIN, EXTRUDER_2_AUTO_FAN_PIN, EXTRUDER_3_AUTO_FAN_PIN }; + const int8_t fanPin[] = { E0_AUTO_FAN_PIN, E1_AUTO_FAN_PIN, E2_AUTO_FAN_PIN, E3_AUTO_FAN_PIN }; const int fanBit[] = { 0, AUTO_1_IS_0 ? 0 : 1, @@ -1043,43 +1043,43 @@ void Temperature::init() { #endif #if HAS_AUTO_FAN_0 - #if EXTRUDER_0_AUTO_FAN_PIN == FAN1_PIN - SET_OUTPUT(EXTRUDER_0_AUTO_FAN_PIN); + #if E0_AUTO_FAN_PIN == FAN1_PIN + SET_OUTPUT(E0_AUTO_FAN_PIN); #if ENABLED(FAST_PWM_FAN) - setPwmFrequency(EXTRUDER_0_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 + setPwmFrequency(E0_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 #endif #else - pinMode(EXTRUDER_0_AUTO_FAN_PIN, OUTPUT); + SET_OUTPUT(E0_AUTO_FAN_PIN); #endif #endif #if HAS_AUTO_FAN_1 && !AUTO_1_IS_0 - #if EXTRUDER_1_AUTO_FAN_PIN == FAN1_PIN - SET_OUTPUT(EXTRUDER_1_AUTO_FAN_PIN); + #if E1_AUTO_FAN_PIN == FAN1_PIN + SET_OUTPUT(E1_AUTO_FAN_PIN); #if ENABLED(FAST_PWM_FAN) - setPwmFrequency(EXTRUDER_1_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 + setPwmFrequency(E1_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 #endif #else - pinMode(EXTRUDER_1_AUTO_FAN_PIN, OUTPUT); + SET_OUTPUT(E1_AUTO_FAN_PIN); #endif #endif #if HAS_AUTO_FAN_2 && !AUTO_2_IS_0 && !AUTO_2_IS_1 - #if EXTRUDER_2_AUTO_FAN_PIN == FAN1_PIN - SET_OUTPUT(EXTRUDER_2_AUTO_FAN_PIN); + #if E2_AUTO_FAN_PIN == FAN1_PIN + SET_OUTPUT(E2_AUTO_FAN_PIN); #if ENABLED(FAST_PWM_FAN) - setPwmFrequency(EXTRUDER_2_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 + setPwmFrequency(E2_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 #endif #else - pinMode(EXTRUDER_2_AUTO_FAN_PIN, OUTPUT); + SET_OUTPUT(E2_AUTO_FAN_PIN); #endif #endif #if HAS_AUTO_FAN_3 && !AUTO_3_IS_0 && !AUTO_3_IS_1 && !AUTO_3_IS_2 - #if EXTRUDER_3_AUTO_FAN_PIN == FAN1_PIN - SET_OUTPUT(EXTRUDER_3_AUTO_FAN_PIN); + #if E3_AUTO_FAN_PIN == FAN1_PIN + SET_OUTPUT(E3_AUTO_FAN_PIN); #if ENABLED(FAST_PWM_FAN) - setPwmFrequency(EXTRUDER_3_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 + setPwmFrequency(E3_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 #endif #else - pinMode(EXTRUDER_3_AUTO_FAN_PIN, OUTPUT); + SET_OUTPUT(E3_AUTO_FAN_PIN); #endif #endif diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index fb697dd3e..2c42874f3 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -2390,6 +2390,7 @@ void kill_screen(const char* lcd_msg) { case X_AXIS: lcd_move_x(); break; case Y_AXIS: lcd_move_y(); break; case Z_AXIS: lcd_move_z(); + default: break; } } static void reprapworld_keypad_move_z_up() { _reprapworld_keypad_move(Z_AXIS, 1); } @@ -2490,11 +2491,9 @@ void lcd_init() { #endif #if ENABLED(REPRAPWORLD_KEYPAD) - pinMode(SHIFT_CLK, OUTPUT); - pinMode(SHIFT_LD, OUTPUT); - pinMode(SHIFT_OUT, INPUT); - WRITE(SHIFT_OUT, HIGH); - WRITE(SHIFT_LD, HIGH); + SET_OUTPUT(SHIFT_CLK); + OUT_WRITE(SHIFT_LD, HIGH); + SET_INPUT_PULLUP(SHIFT_OUT); #endif #if BUTTON_EXISTS(UP) @@ -2513,16 +2512,13 @@ void lcd_init() { #else // !NEWPANEL #if ENABLED(SR_LCD_2W_NL) // Non latching 2 wire shift register - pinMode(SR_DATA_PIN, OUTPUT); - pinMode(SR_CLK_PIN, OUTPUT); + SET_OUTPUT(SR_DATA_PIN); + SET_OUTPUT(SR_CLK_PIN); #elif defined(SHIFT_CLK) - pinMode(SHIFT_CLK, OUTPUT); - pinMode(SHIFT_LD, OUTPUT); - pinMode(SHIFT_EN, OUTPUT); - pinMode(SHIFT_OUT, INPUT); - WRITE(SHIFT_OUT, HIGH); - WRITE(SHIFT_LD, HIGH); - WRITE(SHIFT_EN, LOW); + SET_OUTPUT(SHIFT_CLK); + OUT_WRITE(SHIFT_LD, HIGH); + OUT_WRITE(SHIFT_EN, LOW); + SET_INPUT_PULLUP(SHIFT_OUT); #endif // SR_LCD_2W_NL #endif // !NEWPANEL