|
@@ -472,8 +472,8 @@ int Temperature::getHeaterPower(int heater) {
|
472
|
472
|
#if HAS_AUTO_FAN
|
473
|
473
|
|
474
|
474
|
void Temperature::checkExtruderAutoFans() {
|
475
|
|
- constexpr int8_t fanPin[] = { E0_AUTO_FAN_PIN, E1_AUTO_FAN_PIN, E2_AUTO_FAN_PIN, E3_AUTO_FAN_PIN, E4_AUTO_FAN_PIN };
|
476
|
|
- constexpr int fanBit[] = {
|
|
475
|
+ 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 };
|
|
476
|
+ static const uint8_t fanBit[] PROGMEM = {
|
477
|
477
|
0,
|
478
|
478
|
AUTO_1_IS_0 ? 0 : 1,
|
479
|
479
|
AUTO_2_IS_0 ? 0 : AUTO_2_IS_1 ? 1 : 2,
|
|
@@ -482,20 +482,20 @@ int Temperature::getHeaterPower(int heater) {
|
482
|
482
|
};
|
483
|
483
|
uint8_t fanState = 0;
|
484
|
484
|
|
485
|
|
- HOTEND_LOOP() {
|
|
485
|
+ HOTEND_LOOP()
|
486
|
486
|
if (current_temperature[e] > EXTRUDER_AUTO_FAN_TEMPERATURE)
|
487
|
|
- SBI(fanState, fanBit[e]);
|
488
|
|
- }
|
|
487
|
+ SBI(fanState, pgm_read_byte(&fanBit[e]));
|
489
|
488
|
|
490
|
489
|
uint8_t fanDone = 0;
|
491
|
490
|
for (uint8_t f = 0; f < COUNT(fanPin); f++) {
|
492
|
|
- int8_t pin = fanPin[f];
|
493
|
|
- if (pin >= 0 && !TEST(fanDone, fanBit[f])) {
|
494
|
|
- uint8_t newFanSpeed = TEST(fanState, fanBit[f]) ? EXTRUDER_AUTO_FAN_SPEED : 0;
|
|
491
|
+ int8_t pin = pgm_read_byte(&fanPin[f]);
|
|
492
|
+ const uint8_t bit = pgm_read_byte(&fanBit[f]);
|
|
493
|
+ if (pin >= 0 && !TEST(fanDone, bit)) {
|
|
494
|
+ uint8_t newFanSpeed = TEST(fanState, bit) ? EXTRUDER_AUTO_FAN_SPEED : 0;
|
495
|
495
|
|
496
|
496
|
digitalWrite(pin, newFanSpeed);
|
497
|
497
|
analogWrite(pin, newFanSpeed);
|
498
|
|
- SBI(fanDone, fanBit[f]);
|
|
498
|
+ SBI(fanDone, bit);
|
499
|
499
|
}
|
500
|
500
|
}
|
501
|
501
|
}
|