|
|
@ -5137,41 +5137,34 @@ void prepare_arc_move(char isclockwise) { |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
unsigned long lastMotor = 0; //Save the time for when a motor was turned on last
|
|
|
|
unsigned long lastMotorCheck = 0; |
|
|
|
|
|
|
|
void controllerFan() |
|
|
|
{ |
|
|
|
if ((millis() - lastMotorCheck) >= 2500) //Not a time critical function, so we only check every 2500ms
|
|
|
|
{ |
|
|
|
lastMotorCheck = millis(); |
|
|
|
|
|
|
|
if((X_ENABLE_READ) == (X_ENABLE_ON)) || (Y_ENABLE_READ) == (Y_ENABLE_ON)) || (Z_ENABLE_READ) == (Z_ENABLE_ON)) || (soft_pwm_bed > 0) |
|
|
|
unsigned long lastMotor = 0; // Last time a motor was turned on
|
|
|
|
unsigned long lastMotorCheck = 0; // Last time the state was checked
|
|
|
|
|
|
|
|
void controllerFan() { |
|
|
|
uint32_t ms = millis(); |
|
|
|
if (ms >= lastMotorCheck + 2500) { // Not a time critical function, so we only check every 2500ms
|
|
|
|
lastMotorCheck = ms; |
|
|
|
if (X_ENABLE_READ == X_ENABLE_ON || Y_ENABLE_READ == Y_ENABLE_ON || Z_ENABLE_READ == Z_ENABLE_ON || soft_pwm_bed > 0 |
|
|
|
|| E0_ENABLE_READ == E_ENABLE_ON // If any of the drivers are enabled...
|
|
|
|
#if EXTRUDERS > 1 |
|
|
|
|| E1_ENABLE_READ == E_ENABLE_ON |
|
|
|
#if defined(X2_ENABLE_PIN) && X2_ENABLE_PIN > -1 |
|
|
|
|| X2_ENABLE_READ == X_ENABLE_ON |
|
|
|
#endif |
|
|
|
#if EXTRUDERS > 2 |
|
|
|
|| (E2_ENABLE_READ) == (E_ENABLE_ON)) |
|
|
|
|| E2_ENABLE_READ == E_ENABLE_ON |
|
|
|
#if EXTRUDERS > 3 |
|
|
|
|| E3_ENABLE_READ == E_ENABLE_ON |
|
|
|
#endif |
|
|
|
#if EXTRUDER > 1 |
|
|
|
#if defined(X2_ENABLE_PIN) && X2_ENABLE_PIN > -1 |
|
|
|
|| (X2_ENABLE_READ) == (X_ENABLE_ON)) |
|
|
|
#endif |
|
|
|
|| (E1_ENABLE_READ) == (E_ENABLE_ON)) |
|
|
|
#endif |
|
|
|
|| (E0_ENABLE_READ) == (E_ENABLE_ON))) //If any of the drivers are enabled...
|
|
|
|
{ |
|
|
|
lastMotor = millis(); //... set time to NOW so the fan will turn on
|
|
|
|
} |
|
|
|
|
|
|
|
if ((millis() - lastMotor) >= (CONTROLLERFAN_SECS*1000UL) || lastMotor == 0) //If the last time any driver was enabled, is longer since than CONTROLLERSEC...
|
|
|
|
{ |
|
|
|
digitalWrite(CONTROLLERFAN_PIN, 0); |
|
|
|
analogWrite(CONTROLLERFAN_PIN, 0); |
|
|
|
) { |
|
|
|
lastMotor = ms; //... set time to NOW so the fan will turn on
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
uint8_t speed = (lastMotor == 0 || ms >= lastMotor + (CONTROLLERFAN_SECS * 1000UL)) ? 0 : CONTROLLERFAN_SPEED; |
|
|
|
// allows digital or PWM fan output to be used (see M42 handling)
|
|
|
|
digitalWrite(CONTROLLERFAN_PIN, CONTROLLERFAN_SPEED); |
|
|
|
analogWrite(CONTROLLERFAN_PIN, CONTROLLERFAN_SPEED); |
|
|
|
} |
|
|
|
digitalWrite(CONTROLLERFAN_PIN, speed); |
|
|
|
analogWrite(CONTROLLERFAN_PIN, speed); |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|