Browse Source

Fix checkExtruderAutoFans

Make sure to only set the fan state once when extruders share a fan
Scott Lahteine 8 years ago
parent
commit
2f14934c65
1 changed files with 4 additions and 2 deletions
  1. 4
    2
      Marlin/temperature.cpp

+ 4
- 2
Marlin/temperature.cpp View File

346
       if (current_temperature[f] > EXTRUDER_AUTO_FAN_TEMPERATURE)
346
       if (current_temperature[f] > EXTRUDER_AUTO_FAN_TEMPERATURE)
347
         SBI(fanState, fanBit[f]);
347
         SBI(fanState, fanBit[f]);
348
     }
348
     }
349
+    uint8_t fanDone = 0;
349
     for (int f = 0; f <= 3; f++) {
350
     for (int f = 0; f <= 3; f++) {
350
       int8_t pin = fanPin[f];
351
       int8_t pin = fanPin[f];
351
-      if (pin >= 0) {
352
-        unsigned char newFanSpeed = TEST(fanState, f) ? EXTRUDER_AUTO_FAN_SPEED : 0;
352
+      if (pin >= 0 && !TEST(fanDone, fanBit[f])) {
353
+        unsigned char newFanSpeed = TEST(fanState, fanBit[f]) ? EXTRUDER_AUTO_FAN_SPEED : 0;
353
         // this idiom allows both digital and PWM fan outputs (see M42 handling).
354
         // this idiom allows both digital and PWM fan outputs (see M42 handling).
354
         digitalWrite(pin, newFanSpeed);
355
         digitalWrite(pin, newFanSpeed);
355
         analogWrite(pin, newFanSpeed);
356
         analogWrite(pin, newFanSpeed);
357
+        SBI(fanDone, fanBit[f]);
356
       }
358
       }
357
     }
359
     }
358
   }
360
   }

Loading…
Cancel
Save