Merge pull request #348 from oni303/Marlin_v1
fixed (#328) pwm generation at pin D12 and D13
This commit is contained in:
commit
ab318beaaf
@ -709,6 +709,9 @@
|
|||||||
#define LED_PIN -1
|
#define LED_PIN -1
|
||||||
|
|
||||||
#define FAN_PIN -1
|
#define FAN_PIN -1
|
||||||
|
#if FAN_PIN == 12 || FAN_PIN ==13
|
||||||
|
#define FAN_SOFT_PWM
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef MELZI
|
#ifdef MELZI
|
||||||
#define LED_PIN 28
|
#define LED_PIN 28
|
||||||
|
@ -460,10 +460,12 @@ void check_axes_activity()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if FAN_PIN > -1
|
#if FAN_PIN > -1
|
||||||
|
#ifndef FAN_SOFT_PWM
|
||||||
if (fanSpeed != 0){
|
if (fanSpeed != 0){
|
||||||
analogWrite(FAN_PIN,fanSpeed); // If buffer is empty use current fan speed
|
analogWrite(FAN_PIN,fanSpeed); // If buffer is empty use current fan speed
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if((DISABLE_X) && (x_active == 0)) disable_x();
|
if((DISABLE_X) && (x_active == 0)) disable_x();
|
||||||
if((DISABLE_Y) && (y_active == 0)) disable_y();
|
if((DISABLE_Y) && (y_active == 0)) disable_y();
|
||||||
@ -475,6 +477,7 @@ void check_axes_activity()
|
|||||||
disable_e2();
|
disable_e2();
|
||||||
}
|
}
|
||||||
#if FAN_PIN > -1
|
#if FAN_PIN > -1
|
||||||
|
#ifndef FAN_SOFT_PWM
|
||||||
if((fanSpeed == 0) && (fan_speed ==0))
|
if((fanSpeed == 0) && (fan_speed ==0))
|
||||||
{
|
{
|
||||||
analogWrite(FAN_PIN, 0);
|
analogWrite(FAN_PIN, 0);
|
||||||
@ -484,6 +487,7 @@ void check_axes_activity()
|
|||||||
{
|
{
|
||||||
analogWrite(FAN_PIN,tail_fan_speed);
|
analogWrite(FAN_PIN,tail_fan_speed);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef AUTOTEMP
|
#ifdef AUTOTEMP
|
||||||
getHighESpeed();
|
getHighESpeed();
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user