From 0f3f5d083d6b100c6d70f4c2eed2f37b04897035 Mon Sep 17 00:00:00 2001
From: daid303 <daid303@gmail.com>
Date: Thu, 10 Jan 2013 11:08:45 +0100
Subject: [PATCH] Minor cleanup of the new FAN_KICKSTART code. #334

---
 Marlin/Configuration_adv.h |  4 ++--
 Marlin/planner.cpp         | 34 +++++++++++++++++-----------------
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h
index 98d0da2756..de9f68cdf3 100644
--- a/Marlin/Configuration_adv.h
+++ b/Marlin/Configuration_adv.h
@@ -68,8 +68,8 @@
 
 // When first starting the main fan, run it at full speed for the
 // given number of milliseconds.  This gets the fan spinning reliably
-// before setting a PWM value.  Set to zero to disable.
-#define FAN_KICKSTART_TIME 100
+// before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu)
+//#define FAN_KICKSTART_TIME 100
 
 //===========================================================================
 //=============================Mechanical Settings===========================
diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp
index 6173bcea3a..5101e18219 100644
--- a/Marlin/planner.cpp
+++ b/Marlin/planner.cpp
@@ -466,23 +466,23 @@ void check_axes_activity()
   }
 #if FAN_PIN > -1
   #ifndef FAN_SOFT_PWM
-  if (FAN_KICKSTART_TIME) {
-    static unsigned long FanKickEnd;
-    if (tail_fan_speed) {
-      if (FanKickEnd == 0) {
-        // Just starting up fan - run at full power.
-        FanKickEnd = millis() + FAN_KICKSTART_TIME;
-        tail_fan_speed = 255;
-      } else if (FanKickEnd > millis())
-        // Fan still spinning up.
-        tail_fan_speed = 255;
-    } else {
-      FanKickEnd = 0;
-    }
-  }
-  analogWrite(FAN_PIN,tail_fan_speed);
-  #endif
-#endif
+    #ifdef FAN_KICKSTART_TIME
+      static unsigned long fan_kick_end;
+      if (tail_fan_speed) {
+        if (fan_kick_end == 0) {
+          // Just starting up fan - run at full power.
+          fan_kick_end = millis() + FAN_KICKSTART_TIME;
+          tail_fan_speed = 255;
+        } else if (fan_kick_end > millis())
+          // Fan still spinning up.
+          tail_fan_speed = 255;
+      } else {
+        fan_kick_end = 0;
+      }
+    #endif//FAN_KICKSTART_TIME
+    analogWrite(FAN_PIN,tail_fan_speed);
+  #endif//!FAN_SOFT_PWM
+#endif//FAN_PIN > -1
 #ifdef AUTOTEMP
   getHighESpeed();
 #endif
-- 
GitLab