This commit is contained in:
Richard Wackerbarth 2015-06-14 20:01:40 -05:00
commit 1418470ae9

View File

@ -370,17 +370,14 @@ int getHeaterPower(int heater) {
#if HAS_AUTO_FAN #if HAS_AUTO_FAN
void setExtruderAutoFanState(int pin, bool state) void setExtruderAutoFanState(int pin, bool state) {
{
unsigned char newFanSpeed = (state != 0) ? EXTRUDER_AUTO_FAN_SPEED : 0; unsigned char newFanSpeed = (state != 0) ? EXTRUDER_AUTO_FAN_SPEED : 0;
// this idiom allows both digital and PWM fan outputs (see M42 handling). // this idiom allows both digital and PWM fan outputs (see M42 handling).
pinMode(pin, OUTPUT);
digitalWrite(pin, newFanSpeed); digitalWrite(pin, newFanSpeed);
analogWrite(pin, newFanSpeed); analogWrite(pin, newFanSpeed);
} }
void checkExtruderAutoFans() void checkExtruderAutoFans() {
{
uint8_t fanState = 0; uint8_t fanState = 0;
// which fan pins need to be turned on? // which fan pins need to be turned on?
@ -443,7 +440,7 @@ void checkExtruderAutoFans()
#endif #endif
} }
#endif // any extruder auto fan pins set #endif // HAS_AUTO_FAN
// //
// Temperature Error Handlers // Temperature Error Handlers
@ -918,6 +915,19 @@ void tp_init() {
ANALOG_SELECT(FILWIDTH_PIN); ANALOG_SELECT(FILWIDTH_PIN);
#endif #endif
#if HAS_AUTO_FAN_0
pinMode(EXTRUDER_0_AUTO_FAN_PIN, OUTPUT);
#endif
#if HAS_AUTO_FAN_1 && (EXTRUDER_1_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN)
pinMode(EXTRUDER_1_AUTO_FAN_PIN, OUTPUT);
#endif
#if HAS_AUTO_FAN_2 && (EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN) && (EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN)
pinMode(EXTRUDER_2_AUTO_FAN_PIN, OUTPUT);
#endif
#if HAS_AUTO_FAN_3 && (EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN) && (EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN) && (EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_2_AUTO_FAN_PIN)
pinMode(EXTRUDER_3_AUTO_FAN_PIN, OUTPUT);
#endif
// Use timer0 for temperature measurement // Use timer0 for temperature measurement
// Interleave temperature interrupt with millies interrupt // Interleave temperature interrupt with millies interrupt
OCR0B = 128; OCR0B = 128;