From 4575978a1fc83853579ec85ebd1549fdeae0b03b Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Fri, 16 Aug 2019 16:42:24 -0700 Subject: [PATCH] Fix auto power for chamber fan (#14922) --- Marlin/src/inc/Conditionals_post.h | 14 ++++++++++++++ Marlin/src/module/temperature.cpp | 9 +-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 38e2ff59aa..f3d850aea1 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -1001,7 +1001,21 @@ #define HAS_AUTO_FAN_4 (HOTENDS > 4 && PIN_EXISTS(E4_AUTO_FAN)) #define HAS_AUTO_FAN_5 (HOTENDS > 5 && PIN_EXISTS(E5_AUTO_FAN)) #define HAS_AUTO_CHAMBER_FAN (HAS_TEMP_CHAMBER && PIN_EXISTS(CHAMBER_AUTO_FAN)) + #define HAS_AUTO_FAN (HAS_AUTO_FAN_0 || HAS_AUTO_FAN_1 || HAS_AUTO_FAN_2 || HAS_AUTO_FAN_3 || HAS_AUTO_FAN_4 || HAS_AUTO_FAN_5 || HAS_AUTO_CHAMBER_FAN) +#if HAS_AUTO_FAN + #define AUTO_CHAMBER_IS_0 (CHAMBER_AUTO_FAN_PIN == E0_AUTO_FAN_PIN) + #define AUTO_CHAMBER_IS_1 (CHAMBER_AUTO_FAN_PIN == E1_AUTO_FAN_PIN) + #define AUTO_CHAMBER_IS_2 (CHAMBER_AUTO_FAN_PIN == E2_AUTO_FAN_PIN) + #define AUTO_CHAMBER_IS_3 (CHAMBER_AUTO_FAN_PIN == E3_AUTO_FAN_PIN) + #define AUTO_CHAMBER_IS_4 (CHAMBER_AUTO_FAN_PIN == E4_AUTO_FAN_PIN) + #define AUTO_CHAMBER_IS_5 (CHAMBER_AUTO_FAN_PIN == E5_AUTO_FAN_PIN) + #define AUTO_CHAMBER_IS_E (AUTO_CHAMBER_IS_0 || AUTO_CHAMBER_IS_1 || AUTO_CHAMBER_IS_2 || AUTO_CHAMBER_IS_3 || AUTO_CHAMBER_IS_4 || AUTO_CHAMBER_IS_5) +#endif + +#if !HAS_AUTO_CHAMBER_FAN || AUTO_CHAMBER_IS_E + #undef AUTO_POWER_CHAMBER_FAN +#endif // Other fans #define HAS_FAN0 (PIN_EXISTS(FAN)) diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 1dd774d1ba..79f63b5315 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -654,13 +654,6 @@ int16_t Temperature::getHeaterPower(const heater_ind_t heater_id) { #define AUTO_5_IS_2 (E5_AUTO_FAN_PIN == E2_AUTO_FAN_PIN) #define AUTO_5_IS_3 (E5_AUTO_FAN_PIN == E3_AUTO_FAN_PIN) #define AUTO_5_IS_4 (E5_AUTO_FAN_PIN == E4_AUTO_FAN_PIN) - #define AUTO_CHAMBER_IS_0 (CHAMBER_AUTO_FAN_PIN == E0_AUTO_FAN_PIN) - #define AUTO_CHAMBER_IS_1 (CHAMBER_AUTO_FAN_PIN == E1_AUTO_FAN_PIN) - #define AUTO_CHAMBER_IS_2 (CHAMBER_AUTO_FAN_PIN == E2_AUTO_FAN_PIN) - #define AUTO_CHAMBER_IS_3 (CHAMBER_AUTO_FAN_PIN == E3_AUTO_FAN_PIN) - #define AUTO_CHAMBER_IS_4 (CHAMBER_AUTO_FAN_PIN == E4_AUTO_FAN_PIN) - #define AUTO_CHAMBER_IS_5 (CHAMBER_AUTO_FAN_PIN == E5_AUTO_FAN_PIN) - #define AUTO_CHAMBER_IS_E (AUTO_CHAMBER_IS_0 || AUTO_CHAMBER_IS_1 || AUTO_CHAMBER_IS_2 || AUTO_CHAMBER_IS_3 || AUTO_CHAMBER_IS_4 || AUTO_CHAMBER_IS_5) #define CHAMBER_FAN_INDEX HOTENDS void Temperature::checkExtruderAutoFans() { @@ -709,7 +702,7 @@ int16_t Temperature::getHeaterPower(const heater_ind_t heater_id) { if (TEST(fanDone, realFan)) continue; const bool fan_on = TEST(fanState, realFan); switch (f) { - #if HAS_AUTO_CHAMBER_FAN && !AUTO_CHAMBER_IS_E + #if ENABLED(AUTO_POWER_CHAMBER_FAN) case CHAMBER_FAN_INDEX: chamberfan_speed = fan_on ? CHAMBER_AUTO_FAN_SPEED : 0; break;