Add "kick fan" feature - briefly run fan at full speed on start.

Add a feature to run the cooling fan at full speed for a small period
(default 100ms) when first starting the fan.  Some fans wont reliably
start spinning at low power, and many fans have issue with the PWM at
low power.  However, once the fan starts spinning it can reliably be
set to a wide range of PWM values.
This commit is contained in:
Kevin O'Connor 2012-12-09 23:47:52 -05:00
parent 3f2f94ef28
commit 3d91bd486c
2 changed files with 19 additions and 0 deletions

View File

@ -66,6 +66,11 @@
//#define CONTROLLERFAN_PIN 23 //Pin used for the fan to cool controller, comment out to disable this function
#define CONTROLLERFAN_SEC 60 //How many seconds, after all motors were disabled, the fan should run
// 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
//===========================================================================
//=============================Mechanical Settings===========================
//===========================================================================

View File

@ -466,6 +466,20 @@ 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