Browse Source

Cleanup to software PWM variables

Scott Lahteine 8 years ago
parent
commit
a1e04942a2
4 changed files with 82 additions and 90 deletions
  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 View File

11516
     const millis_t ms = millis();
11516
     const millis_t ms = millis();
11517
     if (ELAPSED(ms, nextMotorCheck)) {
11517
     if (ELAPSED(ms, nextMotorCheck)) {
11518
       nextMotorCheck = ms + 2500UL; // Not a time critical function, so only check every 2.5s
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
           || E0_ENABLE_READ == E_ENABLE_ON // If any of the drivers are enabled...
11520
           || E0_ENABLE_READ == E_ENABLE_ON // If any of the drivers are enabled...
11521
           #if E_STEPPERS > 1
11521
           #if E_STEPPERS > 1
11522
             || E1_ENABLE_READ == E_ENABLE_ON
11522
             || E1_ENABLE_READ == E_ENABLE_ON

+ 3
- 3
Marlin/planner.cpp View File

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

+ 73
- 77
Marlin/temperature.cpp View File

74
   float Temperature::redundant_temperature = 0.0;
74
   float Temperature::redundant_temperature = 0.0;
75
 #endif
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
 #if ENABLED(PIDTEMP)
77
 #if ENABLED(PIDTEMP)
84
   #if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1
78
   #if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1
85
     float Temperature::Kp[HOTENDS] = ARRAY_BY_HOTENDS1(DEFAULT_Kp),
79
     float Temperature::Kp[HOTENDS] = ARRAY_BY_HOTENDS1(DEFAULT_Kp),
194
   millis_t Temperature::next_auto_fan_check_ms = 0;
188
   millis_t Temperature::next_auto_fan_check_ms = 0;
195
 #endif
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
 #if ENABLED(FAN_SOFT_PWM)
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
 #endif
197
 #endif
202
 
198
 
203
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
199
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
206
 
202
 
207
 #if ENABLED(PROBING_HEATERS_OFF)
203
 #if ENABLED(PROBING_HEATERS_OFF)
208
   bool Temperature::paused;
204
   bool Temperature::paused;
209
-  int16_t Temperature::paused_hotend_temps[HOTENDS];
205
+  int16_t Temperature::paused_hotend_temp[HOTENDS];
210
   #if HAS_TEMP_BED
206
   #if HAS_TEMP_BED
211
     int16_t Temperature::paused_bed_temp;
207
     int16_t Temperature::paused_bed_temp;
212
   #endif
208
   #endif
254
 
250
 
255
     #if HAS_PID_FOR_BOTH
251
     #if HAS_PID_FOR_BOTH
256
       if (hotend < 0)
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
       else
254
       else
259
-        soft_pwm[hotend] = bias = d = (PID_MAX) >> 1;
255
+        soft_pwm_amount[hotend] = bias = d = (PID_MAX) >> 1;
260
     #elif ENABLED(PIDTEMP)
256
     #elif ENABLED(PIDTEMP)
261
-      soft_pwm[hotend] = bias = d = (PID_MAX) >> 1;
257
+      soft_pwm_amount[hotend] = bias = d = (PID_MAX) >> 1;
262
     #else
258
     #else
263
-      soft_pwm_bed = bias = d = (MAX_BED_POWER) >> 1;
259
+      soft_pwm_amount_bed = bias = d = (MAX_BED_POWER) >> 1;
264
     #endif
260
     #endif
265
 
261
 
266
     wait_for_heatup = true;
262
     wait_for_heatup = true;
298
             heating = false;
294
             heating = false;
299
             #if HAS_PID_FOR_BOTH
295
             #if HAS_PID_FOR_BOTH
300
               if (hotend < 0)
296
               if (hotend < 0)
301
-                soft_pwm_bed = (bias - d) >> 1;
297
+                soft_pwm_amount_bed = (bias - d) >> 1;
302
               else
298
               else
303
-                soft_pwm[hotend] = (bias - d) >> 1;
299
+                soft_pwm_amount[hotend] = (bias - d) >> 1;
304
             #elif ENABLED(PIDTEMP)
300
             #elif ENABLED(PIDTEMP)
305
-              soft_pwm[hotend] = (bias - d) >> 1;
301
+              soft_pwm_amount[hotend] = (bias - d) >> 1;
306
             #elif ENABLED(PIDTEMPBED)
302
             #elif ENABLED(PIDTEMPBED)
307
-              soft_pwm_bed = (bias - d) >> 1;
303
+              soft_pwm_amount_bed = (bias - d) >> 1;
308
             #endif
304
             #endif
309
             t1 = ms;
305
             t1 = ms;
310
             t_high = t1 - t2;
306
             t_high = t1 - t2;
367
             }
363
             }
368
             #if HAS_PID_FOR_BOTH
364
             #if HAS_PID_FOR_BOTH
369
               if (hotend < 0)
365
               if (hotend < 0)
370
-                soft_pwm_bed = (bias + d) >> 1;
366
+                soft_pwm_amount_bed = (bias + d) >> 1;
371
               else
367
               else
372
-                soft_pwm[hotend] = (bias + d) >> 1;
368
+                soft_pwm_amount[hotend] = (bias + d) >> 1;
373
             #elif ENABLED(PIDTEMP)
369
             #elif ENABLED(PIDTEMP)
374
-              soft_pwm[hotend] = (bias + d) >> 1;
370
+              soft_pwm_amount[hotend] = (bias + d) >> 1;
375
             #else
371
             #else
376
-              soft_pwm_bed = (bias + d) >> 1;
372
+              soft_pwm_amount_bed = (bias + d) >> 1;
377
             #endif
373
             #endif
378
             cycles++;
374
             cycles++;
379
             min = temp;
375
             min = temp;
466
 }
462
 }
467
 
463
 
468
 int Temperature::getHeaterPower(int heater) {
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
 #if HAS_AUTO_FAN
468
 #if HAS_AUTO_FAN
717
     float pid_output = get_pid_output(e);
713
     float pid_output = get_pid_output(e);
718
 
714
 
719
     // Check if temperature is within the correct range
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
     // Check if the temperature is failing to increase
718
     // Check if the temperature is failing to increase
723
     #if WATCH_HOTENDS
719
     #if WATCH_HOTENDS
798
     #if ENABLED(PIDTEMPBED)
794
     #if ENABLED(PIDTEMPBED)
799
       float pid_output = get_pid_output_bed();
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
     #elif ENABLED(BED_LIMIT_SWITCHING)
799
     #elif ENABLED(BED_LIMIT_SWITCHING)
804
       // Check if temperature is within the correct band
800
       // Check if temperature is within the correct band
805
       if (WITHIN(current_temperature_bed, BED_MINTEMP, BED_MAXTEMP)) {
801
       if (WITHIN(current_temperature_bed, BED_MINTEMP, BED_MAXTEMP)) {
806
         if (current_temperature_bed >= target_temperature_bed + BED_HYSTERESIS)
802
         if (current_temperature_bed >= target_temperature_bed + BED_HYSTERESIS)
807
-          soft_pwm_bed = 0;
803
+          soft_pwm_amount_bed = 0;
808
         else if (current_temperature_bed <= target_temperature_bed - (BED_HYSTERESIS))
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
       else {
807
       else {
812
-        soft_pwm_bed = 0;
808
+        soft_pwm_amount_bed = 0;
813
         WRITE_HEATER_BED(LOW);
809
         WRITE_HEATER_BED(LOW);
814
       }
810
       }
815
     #else // !PIDTEMPBED && !BED_LIMIT_SWITCHING
811
     #else // !PIDTEMPBED && !BED_LIMIT_SWITCHING
816
       // Check if temperature is within the correct range
812
       // Check if temperature is within the correct range
817
       if (WITHIN(current_temperature_bed, BED_MINTEMP, BED_MAXTEMP)) {
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
       else {
816
       else {
821
-        soft_pwm_bed = 0;
817
+        soft_pwm_amount_bed = 0;
822
         WRITE_HEATER_BED(LOW);
818
         WRITE_HEATER_BED(LOW);
823
       }
819
       }
824
     #endif
820
     #endif
1205
 
1201
 
1206
   #if ENABLED(PROBING_HEATERS_OFF)
1202
   #if ENABLED(PROBING_HEATERS_OFF)
1207
     paused = false;
1203
     paused = false;
1208
-    ZERO(paused_hotend_temps);
1204
+    ZERO(paused_hotend_temp);
1209
     #if HAS_TEMP_BED
1205
     #if HAS_TEMP_BED
1210
       paused_bed_temp = 0;
1206
       paused_bed_temp = 0;
1211
     #endif
1207
     #endif
1316
   // Unpause and reset everything
1312
   // Unpause and reset everything
1317
   #if ENABLED(PROBING_HEATERS_OFF)
1313
   #if ENABLED(PROBING_HEATERS_OFF)
1318
     paused = false;
1314
     paused = false;
1319
-    ZERO(paused_hotend_temps);
1315
+    ZERO(paused_hotend_temp);
1320
     #if HAS_TEMP_BED
1316
     #if HAS_TEMP_BED
1321
       paused_bed_temp = 0;
1317
       paused_bed_temp = 0;
1322
     #endif
1318
     #endif
1327
 
1323
 
1328
   #define DISABLE_HEATER(NR) { \
1324
   #define DISABLE_HEATER(NR) { \
1329
     setTargetHotend(0, NR); \
1325
     setTargetHotend(0, NR); \
1330
-    soft_pwm[NR] = 0; \
1326
+    soft_pwm_amount[NR] = 0; \
1331
     WRITE_HEATER_ ##NR (LOW); \
1327
     WRITE_HEATER_ ##NR (LOW); \
1332
   }
1328
   }
1333
 
1329
 
1349
 
1345
 
1350
   #if HAS_TEMP_BED
1346
   #if HAS_TEMP_BED
1351
     target_temperature_bed = 0;
1347
     target_temperature_bed = 0;
1352
-    soft_pwm_bed = 0;
1348
+    soft_pwm_amount_bed = 0;
1353
     #if HAS_HEATER_BED
1349
     #if HAS_HEATER_BED
1354
       WRITE_HEATER_BED(LOW);
1350
       WRITE_HEATER_BED(LOW);
1355
     #endif
1351
     #endif
1366
 
1362
 
1367
     if (p) {
1363
     if (p) {
1368
       HOTEND_LOOP() {
1364
       HOTEND_LOOP() {
1369
-        paused_hotend_temps[e] = degTargetHotend(e);
1365
+        paused_hotend_temp[e] = degTargetHotend(e);
1370
         setTargetHotend(0, e);
1366
         setTargetHotend(0, e);
1371
       }
1367
       }
1372
       #if HAS_TEMP_BED
1368
       #if HAS_TEMP_BED
1375
       #endif
1371
       #endif
1376
     }
1372
     }
1377
     else {
1373
     else {
1378
-      HOTEND_LOOP() setTargetHotend(paused_hotend_temps[e], e);
1374
+      HOTEND_LOOP() setTargetHotend(paused_hotend_temp[e], e);
1379
       #if HAS_TEMP_BED
1375
       #if HAS_TEMP_BED
1380
         setTargetBed(paused_bed_temp);
1376
         setTargetBed(paused_bed_temp);
1381
       #endif
1377
       #endif
1613
   #if ENABLED(SLOW_PWM_HEATERS)
1609
   #if ENABLED(SLOW_PWM_HEATERS)
1614
     static uint8_t slow_pwm_count = 0;
1610
     static uint8_t slow_pwm_count = 0;
1615
     #define ISR_STATICS(n) \
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
   #else
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
   #endif
1617
   #endif
1622
 
1618
 
1623
   // Statics per heater
1619
   // Statics per heater
1656
      */
1652
      */
1657
     if (pwm_count_tmp >= 127) {
1653
     if (pwm_count_tmp >= 127) {
1658
       pwm_count_tmp -= 127;
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
       #if HOTENDS > 1
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
         #if HOTENDS > 2
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
           #if HOTENDS > 3
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
             #if HOTENDS > 4
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
             #endif // HOTENDS > 4
1669
             #endif // HOTENDS > 4
1674
           #endif // HOTENDS > 3
1670
           #endif // HOTENDS > 3
1675
         #endif // HOTENDS > 2
1671
         #endif // HOTENDS > 2
1676
       #endif // HOTENDS > 1
1672
       #endif // HOTENDS > 1
1677
 
1673
 
1678
       #if HAS_HEATER_BED
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
       #endif
1677
       #endif
1682
 
1678
 
1683
       #if ENABLED(FAN_SOFT_PWM)
1679
       #if ENABLED(FAN_SOFT_PWM)
1684
         #if HAS_FAN0
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
         #endif
1683
         #endif
1688
         #if HAS_FAN1
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
         #endif
1687
         #endif
1692
         #if HAS_FAN2
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
         #endif
1691
         #endif
1696
       #endif
1692
       #endif
1697
     }
1693
     }
1698
     else {
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
       #if HOTENDS > 1
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
         #if HOTENDS > 2
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
           #if HOTENDS > 3
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
             #if HOTENDS > 4
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
             #endif // HOTENDS > 4
1704
             #endif // HOTENDS > 4
1709
           #endif // HOTENDS > 3
1705
           #endif // HOTENDS > 3
1710
         #endif // HOTENDS > 2
1706
         #endif // HOTENDS > 2
1711
       #endif // HOTENDS > 1
1707
       #endif // HOTENDS > 1
1712
 
1708
 
1713
       #if HAS_HEATER_BED
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
       #endif
1711
       #endif
1716
 
1712
 
1717
       #if ENABLED(FAN_SOFT_PWM)
1713
       #if ENABLED(FAN_SOFT_PWM)
1718
         #if HAS_FAN0
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
         #endif
1716
         #endif
1721
         #if HAS_FAN1
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
         #endif
1719
         #endif
1724
         #if HAS_FAN2
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
         #endif
1722
         #endif
1727
       #endif
1723
       #endif
1728
     }
1724
     }
1765
           WRITE_HEATER_ ##NR(0); \
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
     #define PWM_OFF_ROUTINE(NR) \
1766
     #define PWM_OFF_ROUTINE(NR) \
1771
       if (soft_pwm_ ##NR < slow_pwm_count) { \
1767
       if (soft_pwm_ ##NR < slow_pwm_count) { \
1792
         #endif // HOTENDS > 2
1788
         #endif // HOTENDS > 2
1793
       #endif // HOTENDS > 1
1789
       #endif // HOTENDS > 1
1794
       #if HAS_HEATER_BED
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
       #endif
1792
       #endif
1797
 
1793
 
1798
     } // slow_pwm_count == 0
1794
     } // slow_pwm_count == 0
1818
       if (pwm_count_tmp >= 127) {
1814
       if (pwm_count_tmp >= 127) {
1819
         pwm_count_tmp = 0;
1815
         pwm_count_tmp = 0;
1820
         #if HAS_FAN0
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
         #endif
1819
         #endif
1824
         #if HAS_FAN1
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
         #endif
1823
         #endif
1828
         #if HAS_FAN2
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
         #endif
1827
         #endif
1832
       }
1828
       }
1833
       #if HAS_FAN0
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
       #endif
1831
       #endif
1836
       #if HAS_FAN1
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
       #endif
1834
       #endif
1839
       #if HAS_FAN2
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
       #endif
1837
       #endif
1842
     #endif // FAN_SOFT_PWM
1838
     #endif // FAN_SOFT_PWM
1843
 
1839
 

+ 5
- 9
Marlin/temperature.h View File

109
       static float redundant_temperature;
109
       static float redundant_temperature;
110
     #endif
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
     #if ENABLED(FAN_SOFT_PWM)
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
     #endif
118
     #endif
117
 
119
 
118
     #if ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED)
120
     #if ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED)
249
       static millis_t next_auto_fan_check_ms;
251
       static millis_t next_auto_fan_check_ms;
250
     #endif
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
     #if ENABLED(FILAMENT_WIDTH_SENSOR)
254
     #if ENABLED(FILAMENT_WIDTH_SENSOR)
259
       static int current_raw_filwidth;  //Holds measured filament diameter - one extruder only
255
       static int current_raw_filwidth;  //Holds measured filament diameter - one extruder only
260
     #endif
256
     #endif
261
 
257
 
262
     #if ENABLED(PROBING_HEATERS_OFF)
258
     #if ENABLED(PROBING_HEATERS_OFF)
263
       static bool paused;
259
       static bool paused;
264
-      static int16_t paused_hotend_temps[HOTENDS];
260
+      static int16_t paused_hotend_temp[HOTENDS];
265
 
261
 
266
       #if HAS_TEMP_BED
262
       #if HAS_TEMP_BED
267
         static int16_t paused_bed_temp;
263
         static int16_t paused_bed_temp;

Loading…
Cancel
Save