|
@@ -96,6 +96,11 @@ static volatile bool temp_meas_ready = false;
|
96
|
96
|
#endif //PIDTEMPBED
|
97
|
97
|
static unsigned char soft_pwm[EXTRUDERS];
|
98
|
98
|
static unsigned char soft_pwm_bed;
|
|
99
|
+#ifdef FAN_SOFT_PWM
|
|
100
|
+ static unsigned char soft_pwm_fan;
|
|
101
|
+#endif
|
|
102
|
+
|
|
103
|
+
|
99
|
104
|
|
100
|
105
|
#if EXTRUDERS > 3
|
101
|
106
|
# error Unsupported number of extruders
|
|
@@ -597,6 +602,9 @@ void tp_init()
|
597
|
602
|
#ifdef FAST_PWM_FAN
|
598
|
603
|
setPwmFrequency(FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
|
599
|
604
|
#endif
|
|
605
|
+ #ifdef FAN_SOFT_PWM
|
|
606
|
+ soft_pwm_fan=(unsigned char)fanSpeed;
|
|
607
|
+ #endif
|
600
|
608
|
#endif
|
601
|
609
|
|
602
|
610
|
#ifdef HEATER_0_USES_MAX6675
|
|
@@ -929,6 +937,10 @@ ISR(TIMER0_COMPB_vect)
|
929
|
937
|
soft_pwm_b = soft_pwm_bed;
|
930
|
938
|
if(soft_pwm_b > 0) WRITE(HEATER_BED_PIN,1);
|
931
|
939
|
#endif
|
|
940
|
+ #ifdef FAN_SOFT_PWM
|
|
941
|
+ soft_pwm_fan =(unsigned char) fanSpeed;
|
|
942
|
+ if(soft_pwm_fan > 0) WRITE(FAN_PIN,1);
|
|
943
|
+ #endif
|
932
|
944
|
}
|
933
|
945
|
if(soft_pwm_0 <= pwm_count) WRITE(HEATER_0_PIN,0);
|
934
|
946
|
#if EXTRUDERS > 1
|
|
@@ -940,6 +952,9 @@ ISR(TIMER0_COMPB_vect)
|
940
|
952
|
#if HEATER_BED_PIN > -1
|
941
|
953
|
if(soft_pwm_b <= pwm_count) WRITE(HEATER_BED_PIN,0);
|
942
|
954
|
#endif
|
|
955
|
+ #ifdef FAN_SOFT_PWM
|
|
956
|
+ if(soft_pwm_fan <= pwm_count) WRITE(FAN_PIN,0);
|
|
957
|
+ #endif
|
943
|
958
|
|
944
|
959
|
pwm_count++;
|
945
|
960
|
pwm_count &= 0x7f;
|