Merge pull request #3771 from thinkyhead/rc_auto_fans_again

Fix checkExtruderAutoFans
master
Scott Lahteine 9 years ago
commit 26b4cb5b42

@ -346,13 +346,15 @@ int Temperature::getHeaterPower(int heater) {
if (current_temperature[f] > EXTRUDER_AUTO_FAN_TEMPERATURE) if (current_temperature[f] > EXTRUDER_AUTO_FAN_TEMPERATURE)
SBI(fanState, fanBit[f]); SBI(fanState, fanBit[f]);
} }
uint8_t fanDone = 0;
for (int f = 0; f <= 3; f++) { for (int f = 0; f <= 3; f++) {
int8_t pin = fanPin[f]; int8_t pin = fanPin[f];
if (pin >= 0) { if (pin >= 0 && !TEST(fanDone, fanBit[f])) {
unsigned char newFanSpeed = TEST(fanState, f) ? EXTRUDER_AUTO_FAN_SPEED : 0; unsigned char newFanSpeed = TEST(fanState, fanBit[f]) ? 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).
digitalWrite(pin, newFanSpeed); digitalWrite(pin, newFanSpeed);
analogWrite(pin, newFanSpeed); analogWrite(pin, newFanSpeed);
SBI(fanDone, fanBit[f]);
} }
} }
} }

Loading…
Cancel
Save