|
@@ -332,7 +332,7 @@ int Temperature::getHeaterPower(int heater) {
|
332
|
332
|
#if HAS_AUTO_FAN
|
333
|
333
|
|
334
|
334
|
void Temperature::checkExtruderAutoFans() {
|
335
|
|
- const uint8_t fanPin[] = { EXTRUDER_0_AUTO_FAN_PIN, EXTRUDER_1_AUTO_FAN_PIN, EXTRUDER_2_AUTO_FAN_PIN, EXTRUDER_3_AUTO_FAN_PIN };
|
|
335
|
+ const int8_t fanPin[] = { EXTRUDER_0_AUTO_FAN_PIN, EXTRUDER_1_AUTO_FAN_PIN, EXTRUDER_2_AUTO_FAN_PIN, EXTRUDER_3_AUTO_FAN_PIN };
|
336
|
336
|
const int fanBit[] = { 0,
|
337
|
337
|
EXTRUDER_1_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN ? 0 : 1,
|
338
|
338
|
EXTRUDER_2_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN ? 0 :
|
|
@@ -347,10 +347,13 @@ int Temperature::getHeaterPower(int heater) {
|
347
|
347
|
SBI(fanState, fanBit[f]);
|
348
|
348
|
}
|
349
|
349
|
for (int f = 0; f <= 3; f++) {
|
350
|
|
- unsigned char newFanSpeed = TEST(fanState, f) ? EXTRUDER_AUTO_FAN_SPEED : 0;
|
351
|
|
- // this idiom allows both digital and PWM fan outputs (see M42 handling).
|
352
|
|
- digitalWrite(fanPin[f], newFanSpeed);
|
353
|
|
- analogWrite(fanPin[f], newFanSpeed);
|
|
350
|
+ int8_t pin = fanPin[f];
|
|
351
|
+ if (pin >= 0) {
|
|
352
|
+ unsigned char newFanSpeed = TEST(fanState, f) ? EXTRUDER_AUTO_FAN_SPEED : 0;
|
|
353
|
+ // this idiom allows both digital and PWM fan outputs (see M42 handling).
|
|
354
|
+ digitalWrite(pin, newFanSpeed);
|
|
355
|
+ analogWrite(pin, newFanSpeed);
|
|
356
|
+ }
|
354
|
357
|
}
|
355
|
358
|
}
|
356
|
359
|
|