Merge pull request #8460 from Bob-the-Kuhn/E0-autofan

2.0.x E0 auto fan fixes for LP1768
This commit is contained in:
Bob-the-Kuhn 2017-11-16 18:44:56 -06:00 committed by GitHub
commit 1502b6ad8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -515,7 +515,7 @@ int Temperature::getHeaterPower(int heater) {
#if HAS_AUTO_FAN
void Temperature::checkExtruderAutoFans() {
static const int8_t fanPin[] PROGMEM = { E0_AUTO_FAN_PIN, E1_AUTO_FAN_PIN, E2_AUTO_FAN_PIN, E3_AUTO_FAN_PIN, E4_AUTO_FAN_PIN };
static const pin_t fanPin[] PROGMEM = { E0_AUTO_FAN_PIN, E1_AUTO_FAN_PIN, E2_AUTO_FAN_PIN, E3_AUTO_FAN_PIN, E4_AUTO_FAN_PIN };
static const uint8_t fanBit[] PROGMEM = {
0,
AUTO_1_IS_0 ? 0 : 1,
@ -531,7 +531,11 @@ int Temperature::getHeaterPower(int heater) {
uint8_t fanDone = 0;
for (uint8_t f = 0; f < COUNT(fanPin); f++) {
int8_t pin = pgm_read_byte(&fanPin[f]);
#ifdef ARDUINO
pin_t pin = pgm_read_byte(&fanPin[f]);
#else
pin_t pin = fanPin[f];
#endif
const uint8_t bit = pgm_read_byte(&fanBit[f]);
if (pin >= 0 && !TEST(fanDone, bit)) {
uint8_t newFanSpeed = TEST(fanState, bit) ? EXTRUDER_AUTO_FAN_SPEED : 0;