From 3a0a94b21ad9d6a00c936077a9436992a9b6e268 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 13 Aug 2016 20:16:13 -0700 Subject: [PATCH] Always init configured fan pins --- Marlin/temperature.cpp | 52 +++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 7fb11d8538..78168c2e96 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -987,39 +987,35 @@ void Temperature::init() { SET_OUTPUT(HEATER_BED_PIN); #endif - #if ENABLED(FAST_PWM_FAN) || ENABLED(FAN_SOFT_PWM) - - #if HAS_FAN0 - SET_OUTPUT(FAN_PIN); - #if ENABLED(FAST_PWM_FAN) - setPwmFrequency(FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 - #endif - #if ENABLED(FAN_SOFT_PWM) - soft_pwm_fan[0] = fanSpeedSoftPwm[0] / 2; - #endif + #if HAS_FAN0 + SET_OUTPUT(FAN_PIN); + #if ENABLED(FAST_PWM_FAN) + setPwmFrequency(FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 #endif - - #if HAS_FAN1 - SET_OUTPUT(FAN1_PIN); - #if ENABLED(FAST_PWM_FAN) - setPwmFrequency(FAN1_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 - #endif - #if ENABLED(FAN_SOFT_PWM) - soft_pwm_fan[1] = fanSpeedSoftPwm[1] / 2; - #endif + #if ENABLED(FAN_SOFT_PWM) + soft_pwm_fan[0] = fanSpeedSoftPwm[0] / 2; #endif + #endif - #if HAS_FAN2 - SET_OUTPUT(FAN2_PIN); - #if ENABLED(FAST_PWM_FAN) - setPwmFrequency(FAN2_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 - #endif - #if ENABLED(FAN_SOFT_PWM) - soft_pwm_fan[2] = fanSpeedSoftPwm[2] / 2; - #endif + #if HAS_FAN1 + SET_OUTPUT(FAN1_PIN); + #if ENABLED(FAST_PWM_FAN) + setPwmFrequency(FAN1_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 #endif + #if ENABLED(FAN_SOFT_PWM) + soft_pwm_fan[1] = fanSpeedSoftPwm[1] / 2; + #endif + #endif - #endif // FAST_PWM_FAN || FAN_SOFT_PWM + #if HAS_FAN2 + SET_OUTPUT(FAN2_PIN); + #if ENABLED(FAST_PWM_FAN) + setPwmFrequency(FAN2_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 + #endif + #if ENABLED(FAN_SOFT_PWM) + soft_pwm_fan[2] = fanSpeedSoftPwm[2] / 2; + #endif + #endif #if ENABLED(HEATER_0_USES_MAX6675)