|
@ -96,6 +96,11 @@ static volatile bool temp_meas_ready = false; |
|
|
#endif //PIDTEMPBED
|
|
|
#endif //PIDTEMPBED
|
|
|
static unsigned char soft_pwm[EXTRUDERS]; |
|
|
static unsigned char soft_pwm[EXTRUDERS]; |
|
|
static unsigned char soft_pwm_bed; |
|
|
static unsigned char soft_pwm_bed; |
|
|
|
|
|
#ifdef FAN_SOFT_PWM |
|
|
|
|
|
static unsigned char soft_pwm_fan; |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if EXTRUDERS > 3 |
|
|
#if EXTRUDERS > 3 |
|
|
# error Unsupported number of extruders |
|
|
# error Unsupported number of extruders |
|
@ -597,6 +602,9 @@ void tp_init() |
|
|
#ifdef FAST_PWM_FAN |
|
|
#ifdef FAST_PWM_FAN |
|
|
setPwmFrequency(FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
|
|
|
setPwmFrequency(FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
|
|
|
#endif |
|
|
#endif |
|
|
|
|
|
#ifdef FAN_SOFT_PWM |
|
|
|
|
|
soft_pwm_fan=(unsigned char)fanSpeed; |
|
|
|
|
|
#endif |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#ifdef HEATER_0_USES_MAX6675 |
|
|
#ifdef HEATER_0_USES_MAX6675 |
|
@ -929,6 +937,10 @@ ISR(TIMER0_COMPB_vect) |
|
|
soft_pwm_b = soft_pwm_bed; |
|
|
soft_pwm_b = soft_pwm_bed; |
|
|
if(soft_pwm_b > 0) WRITE(HEATER_BED_PIN,1); |
|
|
if(soft_pwm_b > 0) WRITE(HEATER_BED_PIN,1); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
#ifdef FAN_SOFT_PWM |
|
|
|
|
|
soft_pwm_fan =(unsigned char) fanSpeed; |
|
|
|
|
|
if(soft_pwm_fan > 0) WRITE(FAN_PIN,1); |
|
|
|
|
|
#endif |
|
|
} |
|
|
} |
|
|
if(soft_pwm_0 <= pwm_count) WRITE(HEATER_0_PIN,0); |
|
|
if(soft_pwm_0 <= pwm_count) WRITE(HEATER_0_PIN,0); |
|
|
#if EXTRUDERS > 1 |
|
|
#if EXTRUDERS > 1 |
|
@ -940,6 +952,9 @@ ISR(TIMER0_COMPB_vect) |
|
|
#if HEATER_BED_PIN > -1 |
|
|
#if HEATER_BED_PIN > -1 |
|
|
if(soft_pwm_b <= pwm_count) WRITE(HEATER_BED_PIN,0); |
|
|
if(soft_pwm_b <= pwm_count) WRITE(HEATER_BED_PIN,0); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
#ifdef FAN_SOFT_PWM |
|
|
|
|
|
if(soft_pwm_fan <= pwm_count) WRITE(FAN_PIN,0); |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
pwm_count++; |
|
|
pwm_count++; |
|
|
pwm_count &= 0x7f; |
|
|
pwm_count &= 0x7f; |
|
|