Explorar el Código

Cleanup to software PWM variables

Scott Lahteine hace 7 años
padre
commit
a1e04942a2
Se han modificado 4 ficheros con 82 adiciones y 90 borrados
  1. 1
    1
      Marlin/Marlin_main.cpp
  2. 3
    3
      Marlin/planner.cpp
  3. 73
    77
      Marlin/temperature.cpp
  4. 5
    9
      Marlin/temperature.h

+ 1
- 1
Marlin/Marlin_main.cpp Ver fichero

@@ -11516,7 +11516,7 @@ void prepare_move_to_destination() {
11516 11516
     const millis_t ms = millis();
11517 11517
     if (ELAPSED(ms, nextMotorCheck)) {
11518 11518
       nextMotorCheck = ms + 2500UL; // Not a time critical function, so only check every 2.5s
11519
-      if (X_ENABLE_READ == X_ENABLE_ON || Y_ENABLE_READ == Y_ENABLE_ON || Z_ENABLE_READ == Z_ENABLE_ON || thermalManager.soft_pwm_bed > 0
11519
+      if (X_ENABLE_READ == X_ENABLE_ON || Y_ENABLE_READ == Y_ENABLE_ON || Z_ENABLE_READ == Z_ENABLE_ON || thermalManager.soft_pwm_amount_bed > 0
11520 11520
           || E0_ENABLE_READ == E_ENABLE_ON // If any of the drivers are enabled...
11521 11521
           #if E_STEPPERS > 1
11522 11522
             || E1_ENABLE_READ == E_ENABLE_ON

+ 3
- 3
Marlin/planner.cpp Ver fichero

@@ -491,13 +491,13 @@ void Planner::check_axes_activity() {
491 491
 
492 492
     #if ENABLED(FAN_SOFT_PWM)
493 493
       #if HAS_FAN0
494
-        thermalManager.fanSpeedSoftPwm[0] = CALC_FAN_SPEED(0);
494
+        thermalManager.soft_pwm_amount_fan[0] = CALC_FAN_SPEED(0);
495 495
       #endif
496 496
       #if HAS_FAN1
497
-        thermalManager.fanSpeedSoftPwm[1] = CALC_FAN_SPEED(1);
497
+        thermalManager.soft_pwm_amount_fan[1] = CALC_FAN_SPEED(1);
498 498
       #endif
499 499
       #if HAS_FAN2
500
-        thermalManager.fanSpeedSoftPwm[2] = CALC_FAN_SPEED(2);
500
+        thermalManager.soft_pwm_amount_fan[2] = CALC_FAN_SPEED(2);
501 501
       #endif
502 502
     #else
503 503
       #if HAS_FAN0

+ 73
- 77
Marlin/temperature.cpp Ver fichero

@@ -74,12 +74,6 @@ int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 },
74 74
   float Temperature::redundant_temperature = 0.0;
75 75
 #endif
76 76
 
77
-uint8_t Temperature::soft_pwm_bed;
78
-
79
-#if ENABLED(FAN_SOFT_PWM)
80
-  uint8_t Temperature::fanSpeedSoftPwm[FAN_COUNT];
81
-#endif
82
-
83 77
 #if ENABLED(PIDTEMP)
84 78
   #if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1
85 79
     float Temperature::Kp[HOTENDS] = ARRAY_BY_HOTENDS1(DEFAULT_Kp),
@@ -194,10 +188,12 @@ int16_t Temperature::minttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_LO_TE
194 188
   millis_t Temperature::next_auto_fan_check_ms = 0;
195 189
 #endif
196 190
 
197
-uint8_t Temperature::soft_pwm[HOTENDS];
191
+uint8_t Temperature::soft_pwm_amount[HOTENDS],
192
+        Temperature::soft_pwm_amount_bed;
198 193
 
199 194
 #if ENABLED(FAN_SOFT_PWM)
200
-  uint8_t Temperature::soft_pwm_fan[FAN_COUNT];
195
+  uint8_t Temperature::soft_pwm_amount_fan[FAN_COUNT],
196
+          Temperature::soft_pwm_count_fan[FAN_COUNT];
201 197
 #endif
202 198
 
203 199
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
@@ -206,7 +202,7 @@ uint8_t Temperature::soft_pwm[HOTENDS];
206 202
 
207 203
 #if ENABLED(PROBING_HEATERS_OFF)
208 204
   bool Temperature::paused;
209
-  int16_t Temperature::paused_hotend_temps[HOTENDS];
205
+  int16_t Temperature::paused_hotend_temp[HOTENDS];
210 206
   #if HAS_TEMP_BED
211 207
     int16_t Temperature::paused_bed_temp;
212 208
   #endif
@@ -254,13 +250,13 @@ uint8_t Temperature::soft_pwm[HOTENDS];
254 250
 
255 251
     #if HAS_PID_FOR_BOTH
256 252
       if (hotend < 0)
257
-        soft_pwm_bed = bias = d = (MAX_BED_POWER) >> 1;
253
+        soft_pwm_amount_bed = bias = d = (MAX_BED_POWER) >> 1;
258 254
       else
259
-        soft_pwm[hotend] = bias = d = (PID_MAX) >> 1;
255
+        soft_pwm_amount[hotend] = bias = d = (PID_MAX) >> 1;
260 256
     #elif ENABLED(PIDTEMP)
261
-      soft_pwm[hotend] = bias = d = (PID_MAX) >> 1;
257
+      soft_pwm_amount[hotend] = bias = d = (PID_MAX) >> 1;
262 258
     #else
263
-      soft_pwm_bed = bias = d = (MAX_BED_POWER) >> 1;
259
+      soft_pwm_amount_bed = bias = d = (MAX_BED_POWER) >> 1;
264 260
     #endif
265 261
 
266 262
     wait_for_heatup = true;
@@ -298,13 +294,13 @@ uint8_t Temperature::soft_pwm[HOTENDS];
298 294
             heating = false;
299 295
             #if HAS_PID_FOR_BOTH
300 296
               if (hotend < 0)
301
-                soft_pwm_bed = (bias - d) >> 1;
297
+                soft_pwm_amount_bed = (bias - d) >> 1;
302 298
               else
303
-                soft_pwm[hotend] = (bias - d) >> 1;
299
+                soft_pwm_amount[hotend] = (bias - d) >> 1;
304 300
             #elif ENABLED(PIDTEMP)
305
-              soft_pwm[hotend] = (bias - d) >> 1;
301
+              soft_pwm_amount[hotend] = (bias - d) >> 1;
306 302
             #elif ENABLED(PIDTEMPBED)
307
-              soft_pwm_bed = (bias - d) >> 1;
303
+              soft_pwm_amount_bed = (bias - d) >> 1;
308 304
             #endif
309 305
             t1 = ms;
310 306
             t_high = t1 - t2;
@@ -367,13 +363,13 @@ uint8_t Temperature::soft_pwm[HOTENDS];
367 363
             }
368 364
             #if HAS_PID_FOR_BOTH
369 365
               if (hotend < 0)
370
-                soft_pwm_bed = (bias + d) >> 1;
366
+                soft_pwm_amount_bed = (bias + d) >> 1;
371 367
               else
372
-                soft_pwm[hotend] = (bias + d) >> 1;
368
+                soft_pwm_amount[hotend] = (bias + d) >> 1;
373 369
             #elif ENABLED(PIDTEMP)
374
-              soft_pwm[hotend] = (bias + d) >> 1;
370
+              soft_pwm_amount[hotend] = (bias + d) >> 1;
375 371
             #else
376
-              soft_pwm_bed = (bias + d) >> 1;
372
+              soft_pwm_amount_bed = (bias + d) >> 1;
377 373
             #endif
378 374
             cycles++;
379 375
             min = temp;
@@ -466,7 +462,7 @@ void Temperature::updatePID() {
466 462
 }
467 463
 
468 464
 int Temperature::getHeaterPower(int heater) {
469
-  return heater < 0 ? soft_pwm_bed : soft_pwm[heater];
465
+  return heater < 0 ? soft_pwm_amount_bed : soft_pwm_amount[heater];
470 466
 }
471 467
 
472 468
 #if HAS_AUTO_FAN
@@ -717,7 +713,7 @@ void Temperature::manage_heater() {
717 713
     float pid_output = get_pid_output(e);
718 714
 
719 715
     // Check if temperature is within the correct range
720
-    soft_pwm[e] = (current_temperature[e] > minttemp[e] || is_preheating(e)) && current_temperature[e] < maxttemp[e] ? (int)pid_output >> 1 : 0;
716
+    soft_pwm_amount[e] = (current_temperature[e] > minttemp[e] || is_preheating(e)) && current_temperature[e] < maxttemp[e] ? (int)pid_output >> 1 : 0;
721 717
 
722 718
     // Check if the temperature is failing to increase
723 719
     #if WATCH_HOTENDS
@@ -798,27 +794,27 @@ void Temperature::manage_heater() {
798 794
     #if ENABLED(PIDTEMPBED)
799 795
       float pid_output = get_pid_output_bed();
800 796
 
801
-      soft_pwm_bed = WITHIN(current_temperature_bed, BED_MINTEMP, BED_MAXTEMP) ? (int)pid_output >> 1 : 0;
797
+      soft_pwm_amount_bed = WITHIN(current_temperature_bed, BED_MINTEMP, BED_MAXTEMP) ? (int)pid_output >> 1 : 0;
802 798
 
803 799
     #elif ENABLED(BED_LIMIT_SWITCHING)
804 800
       // Check if temperature is within the correct band
805 801
       if (WITHIN(current_temperature_bed, BED_MINTEMP, BED_MAXTEMP)) {
806 802
         if (current_temperature_bed >= target_temperature_bed + BED_HYSTERESIS)
807
-          soft_pwm_bed = 0;
803
+          soft_pwm_amount_bed = 0;
808 804
         else if (current_temperature_bed <= target_temperature_bed - (BED_HYSTERESIS))
809
-          soft_pwm_bed = MAX_BED_POWER >> 1;
805
+          soft_pwm_amount_bed = MAX_BED_POWER >> 1;
810 806
       }
811 807
       else {
812
-        soft_pwm_bed = 0;
808
+        soft_pwm_amount_bed = 0;
813 809
         WRITE_HEATER_BED(LOW);
814 810
       }
815 811
     #else // !PIDTEMPBED && !BED_LIMIT_SWITCHING
816 812
       // Check if temperature is within the correct range
817 813
       if (WITHIN(current_temperature_bed, BED_MINTEMP, BED_MAXTEMP)) {
818
-        soft_pwm_bed = current_temperature_bed < target_temperature_bed ? MAX_BED_POWER >> 1 : 0;
814
+        soft_pwm_amount_bed = current_temperature_bed < target_temperature_bed ? MAX_BED_POWER >> 1 : 0;
819 815
       }
820 816
       else {
821
-        soft_pwm_bed = 0;
817
+        soft_pwm_amount_bed = 0;
822 818
         WRITE_HEATER_BED(LOW);
823 819
       }
824 820
     #endif
@@ -1205,7 +1201,7 @@ void Temperature::init() {
1205 1201
 
1206 1202
   #if ENABLED(PROBING_HEATERS_OFF)
1207 1203
     paused = false;
1208
-    ZERO(paused_hotend_temps);
1204
+    ZERO(paused_hotend_temp);
1209 1205
     #if HAS_TEMP_BED
1210 1206
       paused_bed_temp = 0;
1211 1207
     #endif
@@ -1316,7 +1312,7 @@ void Temperature::disable_all_heaters() {
1316 1312
   // Unpause and reset everything
1317 1313
   #if ENABLED(PROBING_HEATERS_OFF)
1318 1314
     paused = false;
1319
-    ZERO(paused_hotend_temps);
1315
+    ZERO(paused_hotend_temp);
1320 1316
     #if HAS_TEMP_BED
1321 1317
       paused_bed_temp = 0;
1322 1318
     #endif
@@ -1327,7 +1323,7 @@ void Temperature::disable_all_heaters() {
1327 1323
 
1328 1324
   #define DISABLE_HEATER(NR) { \
1329 1325
     setTargetHotend(0, NR); \
1330
-    soft_pwm[NR] = 0; \
1326
+    soft_pwm_amount[NR] = 0; \
1331 1327
     WRITE_HEATER_ ##NR (LOW); \
1332 1328
   }
1333 1329
 
@@ -1349,7 +1345,7 @@ void Temperature::disable_all_heaters() {
1349 1345
 
1350 1346
   #if HAS_TEMP_BED
1351 1347
     target_temperature_bed = 0;
1352
-    soft_pwm_bed = 0;
1348
+    soft_pwm_amount_bed = 0;
1353 1349
     #if HAS_HEATER_BED
1354 1350
       WRITE_HEATER_BED(LOW);
1355 1351
     #endif
@@ -1366,7 +1362,7 @@ void Temperature::disable_all_heaters() {
1366 1362
 
1367 1363
     if (p) {
1368 1364
       HOTEND_LOOP() {
1369
-        paused_hotend_temps[e] = degTargetHotend(e);
1365
+        paused_hotend_temp[e] = degTargetHotend(e);
1370 1366
         setTargetHotend(0, e);
1371 1367
       }
1372 1368
       #if HAS_TEMP_BED
@@ -1375,7 +1371,7 @@ void Temperature::disable_all_heaters() {
1375 1371
       #endif
1376 1372
     }
1377 1373
     else {
1378
-      HOTEND_LOOP() setTargetHotend(paused_hotend_temps[e], e);
1374
+      HOTEND_LOOP() setTargetHotend(paused_hotend_temp[e], e);
1379 1375
       #if HAS_TEMP_BED
1380 1376
         setTargetBed(paused_bed_temp);
1381 1377
       #endif
@@ -1613,11 +1609,11 @@ void Temperature::isr() {
1613 1609
   #if ENABLED(SLOW_PWM_HEATERS)
1614 1610
     static uint8_t slow_pwm_count = 0;
1615 1611
     #define ISR_STATICS(n) \
1616
-      static uint8_t soft_pwm_ ## n; \
1617
-      static uint8_t state_heater_ ## n = 0; \
1618
-      static uint8_t state_timer_heater_ ## n = 0
1612
+      static uint8_t soft_pwm_count_ ## n, \
1613
+                     state_heater_ ## n = 0, \
1614
+                     state_timer_heater_ ## n = 0
1619 1615
   #else
1620
-    #define ISR_STATICS(n) static uint8_t soft_pwm_ ## n = 0
1616
+    #define ISR_STATICS(n) static uint8_t soft_pwm_count_ ## n = 0
1621 1617
   #endif
1622 1618
 
1623 1619
   // Statics per heater
@@ -1656,73 +1652,73 @@ void Temperature::isr() {
1656 1652
      */
1657 1653
     if (pwm_count_tmp >= 127) {
1658 1654
       pwm_count_tmp -= 127;
1659
-      soft_pwm_0 = (soft_pwm_0 & pwm_mask) + soft_pwm[0];
1660
-      WRITE_HEATER_0(soft_pwm_0 > pwm_mask ? HIGH : LOW);
1655
+      soft_pwm_count_0 = (soft_pwm_count_0 & pwm_mask) + soft_pwm_amount[0];
1656
+      WRITE_HEATER_0(soft_pwm_count_0 > pwm_mask ? HIGH : LOW);
1661 1657
       #if HOTENDS > 1
1662
-        soft_pwm_1 = (soft_pwm_1 & pwm_mask) + soft_pwm[1];
1663
-        WRITE_HEATER_1(soft_pwm_1 > pwm_mask ? HIGH : LOW);
1658
+        soft_pwm_count_1 = (soft_pwm_count_1 & pwm_mask) + soft_pwm_amount[1];
1659
+        WRITE_HEATER_1(soft_pwm_count_1 > pwm_mask ? HIGH : LOW);
1664 1660
         #if HOTENDS > 2
1665
-          soft_pwm_2 = (soft_pwm_2 & pwm_mask) + soft_pwm[2];
1666
-          WRITE_HEATER_2(soft_pwm_2 > pwm_mask ? HIGH : LOW);
1661
+          soft_pwm_count_2 = (soft_pwm_count_2 & pwm_mask) + soft_pwm_amount[2];
1662
+          WRITE_HEATER_2(soft_pwm_count_2 > pwm_mask ? HIGH : LOW);
1667 1663
           #if HOTENDS > 3
1668
-            soft_pwm_3 = (soft_pwm_3 & pwm_mask) + soft_pwm[3];
1669
-            WRITE_HEATER_3(soft_pwm_3 > pwm_mask ? HIGH : LOW);
1664
+            soft_pwm_count_3 = (soft_pwm_count_3 & pwm_mask) + soft_pwm_amount[3];
1665
+            WRITE_HEATER_3(soft_pwm_count_3 > pwm_mask ? HIGH : LOW);
1670 1666
             #if HOTENDS > 4
1671
-              soft_pwm_4 = (soft_pwm_4 & pwm_mask) + soft_pwm[4];
1672
-              WRITE_HEATER_4(soft_pwm_4 > pwm_mask ? HIGH : LOW);
1667
+              soft_pwm_count_4 = (soft_pwm_count_4 & pwm_mask) + soft_pwm_amount[4];
1668
+              WRITE_HEATER_4(soft_pwm_count_4 > pwm_mask ? HIGH : LOW);
1673 1669
             #endif // HOTENDS > 4
1674 1670
           #endif // HOTENDS > 3
1675 1671
         #endif // HOTENDS > 2
1676 1672
       #endif // HOTENDS > 1
1677 1673
 
1678 1674
       #if HAS_HEATER_BED
1679
-        soft_pwm_BED = (soft_pwm_BED & pwm_mask) + soft_pwm_bed;
1680
-        WRITE_HEATER_BED(soft_pwm_BED > pwm_mask ? HIGH : LOW);
1675
+        soft_pwm_count_BED = (soft_pwm_count_BED & pwm_mask) + soft_pwm_amount_bed;
1676
+        WRITE_HEATER_BED(soft_pwm_count_BED > pwm_mask ? HIGH : LOW);
1681 1677
       #endif
1682 1678
 
1683 1679
       #if ENABLED(FAN_SOFT_PWM)
1684 1680
         #if HAS_FAN0
1685
-          soft_pwm_fan[0] = (soft_pwm_fan[0] & pwm_mask) + fanSpeedSoftPwm[0] >> 1;
1686
-          WRITE_FAN(soft_pwm_fan[0] > pwm_mask ? HIGH : LOW);
1681
+          soft_pwm_count_fan[0] = (soft_pwm_count_fan[0] & pwm_mask) + soft_pwm_amount_fan[0] >> 1;
1682
+          WRITE_FAN(soft_pwm_count_fan[0] > pwm_mask ? HIGH : LOW);
1687 1683
         #endif
1688 1684
         #if HAS_FAN1
1689
-          soft_pwm_fan[1] = (soft_pwm_fan[1] & pwm_mask) + fanSpeedSoftPwm[1] >> 1;
1690
-          WRITE_FAN1(soft_pwm_fan[1] > pwm_mask ? HIGH : LOW);
1685
+          soft_pwm_count_fan[1] = (soft_pwm_count_fan[1] & pwm_mask) + soft_pwm_amount_fan[1] >> 1;
1686
+          WRITE_FAN1(soft_pwm_count_fan[1] > pwm_mask ? HIGH : LOW);
1691 1687
         #endif
1692 1688
         #if HAS_FAN2
1693
-          soft_pwm_fan[2] = (soft_pwm_fan[2] & pwm_mask) + fanSpeedSoftPwm[2] >> 1;
1694
-          WRITE_FAN2(soft_pwm_fan[2] > pwm_mask ? HIGH : LOW);
1689
+          soft_pwm_count_fan[2] = (soft_pwm_count_fan[2] & pwm_mask) + soft_pwm_amount_fan[2] >> 1;
1690
+          WRITE_FAN2(soft_pwm_count_fan[2] > pwm_mask ? HIGH : LOW);
1695 1691
         #endif
1696 1692
       #endif
1697 1693
     }
1698 1694
     else {
1699
-      if (soft_pwm_0 <= pwm_count_tmp) WRITE_HEATER_0(0);
1695
+      if (soft_pwm_count_0 <= pwm_count_tmp) WRITE_HEATER_0(0);
1700 1696
       #if HOTENDS > 1
1701
-        if (soft_pwm_1 <= pwm_count_tmp) WRITE_HEATER_1(0);
1697
+        if (soft_pwm_count_1 <= pwm_count_tmp) WRITE_HEATER_1(0);
1702 1698
         #if HOTENDS > 2
1703
-          if (soft_pwm_2 <= pwm_count_tmp) WRITE_HEATER_2(0);
1699
+          if (soft_pwm_count_2 <= pwm_count_tmp) WRITE_HEATER_2(0);
1704 1700
           #if HOTENDS > 3
1705
-            if (soft_pwm_3 <= pwm_count_tmp) WRITE_HEATER_3(0);
1701
+            if (soft_pwm_count_3 <= pwm_count_tmp) WRITE_HEATER_3(0);
1706 1702
             #if HOTENDS > 4
1707
-              if (soft_pwm_4 <= pwm_count_tmp) WRITE_HEATER_4(0);
1703
+              if (soft_pwm_count_4 <= pwm_count_tmp) WRITE_HEATER_4(0);
1708 1704
             #endif // HOTENDS > 4
1709 1705
           #endif // HOTENDS > 3
1710 1706
         #endif // HOTENDS > 2
1711 1707
       #endif // HOTENDS > 1
1712 1708
 
1713 1709
       #if HAS_HEATER_BED
1714
-        if (soft_pwm_BED <= pwm_count_tmp) WRITE_HEATER_BED(0);
1710
+        if (soft_pwm_count_BED <= pwm_count_tmp) WRITE_HEATER_BED(0);
1715 1711
       #endif
1716 1712
 
1717 1713
       #if ENABLED(FAN_SOFT_PWM)
1718 1714
         #if HAS_FAN0
1719
-          if (soft_pwm_fan[0] <= pwm_count_tmp) WRITE_FAN(0);
1715
+          if (soft_pwm_count_fan[0] <= pwm_count_tmp) WRITE_FAN(0);
1720 1716
         #endif
1721 1717
         #if HAS_FAN1
1722
-          if (soft_pwm_fan[1] <= pwm_count_tmp) WRITE_FAN1(0);
1718
+          if (soft_pwm_count_fan[1] <= pwm_count_tmp) WRITE_FAN1(0);
1723 1719
         #endif
1724 1720
         #if HAS_FAN2
1725
-          if (soft_pwm_fan[2] <= pwm_count_tmp) WRITE_FAN2(0);
1721
+          if (soft_pwm_count_fan[2] <= pwm_count_tmp) WRITE_FAN2(0);
1726 1722
         #endif
1727 1723
       #endif
1728 1724
     }
@@ -1765,7 +1761,7 @@ void Temperature::isr() {
1765 1761
           WRITE_HEATER_ ##NR(0); \
1766 1762
         } \
1767 1763
       }
1768
-    #define SLOW_PWM_ROUTINE(n) _SLOW_PWM_ROUTINE(n, soft_pwm[n])
1764
+    #define SLOW_PWM_ROUTINE(n) _SLOW_PWM_ROUTINE(n, soft_pwm_amount[n])
1769 1765
 
1770 1766
     #define PWM_OFF_ROUTINE(NR) \
1771 1767
       if (soft_pwm_ ##NR < slow_pwm_count) { \
@@ -1792,7 +1788,7 @@ void Temperature::isr() {
1792 1788
         #endif // HOTENDS > 2
1793 1789
       #endif // HOTENDS > 1
1794 1790
       #if HAS_HEATER_BED
1795
-        _SLOW_PWM_ROUTINE(BED, soft_pwm_bed); // BED
1791
+        _SLOW_PWM_ROUTINE(BED, soft_pwm_amount_bed); // BED
1796 1792
       #endif
1797 1793
 
1798 1794
     } // slow_pwm_count == 0
@@ -1818,26 +1814,26 @@ void Temperature::isr() {
1818 1814
       if (pwm_count_tmp >= 127) {
1819 1815
         pwm_count_tmp = 0;
1820 1816
         #if HAS_FAN0
1821
-          soft_pwm_fan[0] = fanSpeedSoftPwm[0] >> 1;
1822
-          WRITE_FAN(soft_pwm_fan[0] > 0 ? HIGH : LOW);
1817
+          soft_pwm_count_fan[0] = soft_pwm_amount_fan[0] >> 1;
1818
+          WRITE_FAN(soft_pwm_count_fan[0] > 0 ? HIGH : LOW);
1823 1819
         #endif
1824 1820
         #if HAS_FAN1
1825
-          soft_pwm_fan[1] = fanSpeedSoftPwm[1] >> 1;
1826
-          WRITE_FAN1(soft_pwm_fan[1] > 0 ? HIGH : LOW);
1821
+          soft_pwm_count_fan[1] = soft_pwm_amount_fan[1] >> 1;
1822
+          WRITE_FAN1(soft_pwm_count_fan[1] > 0 ? HIGH : LOW);
1827 1823
         #endif
1828 1824
         #if HAS_FAN2
1829
-          soft_pwm_fan[2] = fanSpeedSoftPwm[2] >> 1;
1830
-          WRITE_FAN2(soft_pwm_fan[2] > 0 ? HIGH : LOW);
1825
+          soft_pwm_count_fan[2] = soft_pwm_amount_fan[2] >> 1;
1826
+          WRITE_FAN2(soft_pwm_count_fan[2] > 0 ? HIGH : LOW);
1831 1827
         #endif
1832 1828
       }
1833 1829
       #if HAS_FAN0
1834
-        if (soft_pwm_fan[0] <= pwm_count_tmp) WRITE_FAN(0);
1830
+        if (soft_pwm_count_fan[0] <= pwm_count_tmp) WRITE_FAN(0);
1835 1831
       #endif
1836 1832
       #if HAS_FAN1
1837
-        if (soft_pwm_fan[1] <= pwm_count_tmp) WRITE_FAN1(0);
1833
+        if (soft_pwm_count_fan[1] <= pwm_count_tmp) WRITE_FAN1(0);
1838 1834
       #endif
1839 1835
       #if HAS_FAN2
1840
-        if (soft_pwm_fan[2] <= pwm_count_tmp) WRITE_FAN2(0);
1836
+        if (soft_pwm_count_fan[2] <= pwm_count_tmp) WRITE_FAN2(0);
1841 1837
       #endif
1842 1838
     #endif // FAN_SOFT_PWM
1843 1839
 

+ 5
- 9
Marlin/temperature.h Ver fichero

@@ -109,10 +109,12 @@ class Temperature {
109 109
       static float redundant_temperature;
110 110
     #endif
111 111
 
112
-    static uint8_t soft_pwm_bed;
112
+    static uint8_t soft_pwm_amount[HOTENDS],
113
+                   soft_pwm_amount_bed;
113 114
 
114 115
     #if ENABLED(FAN_SOFT_PWM)
115
-      static uint8_t fanSpeedSoftPwm[FAN_COUNT];
116
+      static uint8_t soft_pwm_amount_fan[FAN_COUNT],
117
+                     soft_pwm_count_fan[FAN_COUNT];
116 118
     #endif
117 119
 
118 120
     #if ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED)
@@ -249,19 +251,13 @@ class Temperature {
249 251
       static millis_t next_auto_fan_check_ms;
250 252
     #endif
251 253
 
252
-    static uint8_t soft_pwm[HOTENDS];
253
-
254
-    #if ENABLED(FAN_SOFT_PWM)
255
-      static uint8_t soft_pwm_fan[FAN_COUNT];
256
-    #endif
257
-
258 254
     #if ENABLED(FILAMENT_WIDTH_SENSOR)
259 255
       static int current_raw_filwidth;  //Holds measured filament diameter - one extruder only
260 256
     #endif
261 257
 
262 258
     #if ENABLED(PROBING_HEATERS_OFF)
263 259
       static bool paused;
264
-      static int16_t paused_hotend_temps[HOTENDS];
260
+      static int16_t paused_hotend_temp[HOTENDS];
265 261
 
266 262
       #if HAS_TEMP_BED
267 263
         static int16_t paused_bed_temp;

Loading…
Cancelar
Guardar