|
@@ -438,8 +438,7 @@ void check_axes_activity()
|
438
|
438
|
unsigned char y_active = 0;
|
439
|
439
|
unsigned char z_active = 0;
|
440
|
440
|
unsigned char e_active = 0;
|
441
|
|
- unsigned char fan_speed = 0;
|
442
|
|
- unsigned char tail_fan_speed = 0;
|
|
441
|
+ unsigned char tail_fan_speed = fanSpeed;
|
443
|
442
|
block_t *block;
|
444
|
443
|
|
445
|
444
|
if(block_buffer_tail != block_buffer_head)
|
|
@@ -453,20 +452,9 @@ void check_axes_activity()
|
453
|
452
|
if(block->steps_y != 0) y_active++;
|
454
|
453
|
if(block->steps_z != 0) z_active++;
|
455
|
454
|
if(block->steps_e != 0) e_active++;
|
456
|
|
- if(block->fan_speed != 0) fan_speed++;
|
457
|
455
|
block_index = (block_index+1) & (BLOCK_BUFFER_SIZE - 1);
|
458
|
456
|
}
|
459
|
457
|
}
|
460
|
|
- else
|
461
|
|
- {
|
462
|
|
- #if FAN_PIN > -1
|
463
|
|
- #ifndef FAN_SOFT_PWM
|
464
|
|
- if (fanSpeed != 0){
|
465
|
|
- analogWrite(FAN_PIN,fanSpeed); // If buffer is empty use current fan speed
|
466
|
|
- }
|
467
|
|
- #endif
|
468
|
|
- #endif
|
469
|
|
- }
|
470
|
458
|
if((DISABLE_X) && (x_active == 0)) disable_x();
|
471
|
459
|
if((DISABLE_Y) && (y_active == 0)) disable_y();
|
472
|
460
|
if((DISABLE_Z) && (z_active == 0)) disable_z();
|
|
@@ -478,15 +466,21 @@ void check_axes_activity()
|
478
|
466
|
}
|
479
|
467
|
#if FAN_PIN > -1
|
480
|
468
|
#ifndef FAN_SOFT_PWM
|
481
|
|
- if((fanSpeed == 0) && (fan_speed ==0))
|
482
|
|
- {
|
483
|
|
- analogWrite(FAN_PIN, 0);
|
484
|
|
- }
|
485
|
|
-
|
486
|
|
- if (fanSpeed != 0 && tail_fan_speed !=0)
|
487
|
|
- {
|
488
|
|
- analogWrite(FAN_PIN,tail_fan_speed);
|
|
469
|
+ if (FAN_KICKSTART_TIME) {
|
|
470
|
+ static unsigned long FanKickEnd;
|
|
471
|
+ if (tail_fan_speed) {
|
|
472
|
+ if (FanKickEnd == 0) {
|
|
473
|
+ // Just starting up fan - run at full power.
|
|
474
|
+ FanKickEnd = millis() + FAN_KICKSTART_TIME;
|
|
475
|
+ tail_fan_speed = 255;
|
|
476
|
+ } else if (FanKickEnd > millis())
|
|
477
|
+ // Fan still spinning up.
|
|
478
|
+ tail_fan_speed = 255;
|
|
479
|
+ } else {
|
|
480
|
+ FanKickEnd = 0;
|
|
481
|
+ }
|
489
|
482
|
}
|
|
483
|
+ analogWrite(FAN_PIN,tail_fan_speed);
|
490
|
484
|
#endif
|
491
|
485
|
#endif
|
492
|
486
|
#ifdef AUTOTEMP
|