Browse Source

Merge pull request #4889 from thinkyhead/rc_tweaky_fix

Fix HEATERS_PARALLEL
Scott Lahteine 8 years ago
parent
commit
eb4fa8adf8
3 changed files with 22 additions and 28 deletions
  1. 1
    1
      Marlin/Marlin_main.cpp
  2. 17
    23
      Marlin/temperature.cpp
  3. 4
    4
      Marlin/temperature.h

+ 1
- 1
Marlin/Marlin_main.cpp View File

@@ -7640,7 +7640,7 @@ void process_next_command() {
7640 7640
       #endif
7641 7641
 
7642 7642
       #if HAS_BED_PROBE
7643
-        case 851:
7643
+        case 851: // Set Z Probe Z Offset
7644 7644
           gcode_M851();
7645 7645
           break;
7646 7646
       #endif // HAS_BED_PROBE

+ 17
- 23
Marlin/temperature.cpp View File

@@ -64,10 +64,10 @@ int   Temperature::current_temperature_raw[HOTENDS] = { 0 },
64 64
   float Temperature::redundant_temperature = 0.0;
65 65
 #endif
66 66
 
67
-unsigned char Temperature::soft_pwm_bed;
67
+uint8_t Temperature::soft_pwm_bed;
68 68
 
69 69
 #if ENABLED(FAN_SOFT_PWM)
70
-  unsigned char Temperature::fanSpeedSoftPwm[FAN_COUNT];
70
+  uint8_t Temperature::fanSpeedSoftPwm[FAN_COUNT];
71 71
 #endif
72 72
 
73 73
 #if ENABLED(PIDTEMP)
@@ -188,10 +188,10 @@ int Temperature::minttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_LO_TEMP ,
188 188
   millis_t Temperature::next_auto_fan_check_ms = 0;
189 189
 #endif
190 190
 
191
-unsigned char Temperature::soft_pwm[HOTENDS];
191
+uint8_t Temperature::soft_pwm[HOTENDS];
192 192
 
193 193
 #if ENABLED(FAN_SOFT_PWM)
194
-  unsigned char Temperature::soft_pwm_fan[FAN_COUNT];
194
+  uint8_t Temperature::soft_pwm_fan[FAN_COUNT];
195 195
 #endif
196 196
 
197 197
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
@@ -482,7 +482,7 @@ int Temperature::getHeaterPower(int heater) {
482 482
     for (uint8_t f = 0; f < COUNT(fanPin); f++) {
483 483
       int8_t pin = fanPin[f];
484 484
       if (pin >= 0 && !TEST(fanDone, fanBit[f])) {
485
-        unsigned char newFanSpeed = TEST(fanState, fanBit[f]) ? EXTRUDER_AUTO_FAN_SPEED : 0;
485
+        uint8_t newFanSpeed = TEST(fanState, fanBit[f]) ? EXTRUDER_AUTO_FAN_SPEED : 0;
486 486
         // this idiom allows both digital and PWM fan outputs (see M42 handling).
487 487
         digitalWrite(pin, newFanSpeed);
488 488
         analogWrite(pin, newFanSpeed);
@@ -1286,9 +1286,7 @@ void Temperature::disable_all_heaters() {
1286 1286
   }
1287 1287
 
1288 1288
   #if HAS_TEMP_HOTEND
1289
-    setTargetHotend(0, 0);
1290
-    soft_pwm[0] = 0;
1291
-    WRITE_HEATER_0P(LOW); // Should HEATERS_PARALLEL apply here? Then change to DISABLE_HEATER(0)
1289
+    DISABLE_HEATER(0);
1292 1290
   #endif
1293 1291
 
1294 1292
   #if HOTENDS > 1 && HAS_TEMP_1
@@ -1414,24 +1412,24 @@ ISR(TIMER0_COMPB_vect) { Temperature::isr(); }
1414 1412
 
1415 1413
 void Temperature::isr() {
1416 1414
 
1417
-  static unsigned char temp_count = 0;
1415
+  static uint8_t temp_count = 0;
1418 1416
   static TempState temp_state = StartupDelay;
1419
-  static unsigned char pwm_count = _BV(SOFT_PWM_SCALE);
1417
+  static uint8_t pwm_count = _BV(SOFT_PWM_SCALE);
1420 1418
 
1421 1419
   // Static members for each heater
1422 1420
   #if ENABLED(SLOW_PWM_HEATERS)
1423
-    static unsigned char slow_pwm_count = 0;
1421
+    static uint8_t slow_pwm_count = 0;
1424 1422
     #define ISR_STATICS(n) \
1425
-      static unsigned char soft_pwm_ ## n; \
1426
-      static unsigned char state_heater_ ## n = 0; \
1427
-      static unsigned char state_timer_heater_ ## n = 0
1423
+      static uint8_t soft_pwm_ ## n; \
1424
+      static uint8_t state_heater_ ## n = 0; \
1425
+      static uint8_t state_timer_heater_ ## n = 0
1428 1426
   #else
1429
-    #define ISR_STATICS(n) static unsigned char soft_pwm_ ## n
1427
+    #define ISR_STATICS(n) static uint8_t soft_pwm_ ## n
1430 1428
   #endif
1431 1429
 
1432 1430
   // Statics per heater
1433 1431
   ISR_STATICS(0);
1434
-  #if (HOTENDS > 1) || ENABLED(HEATERS_PARALLEL)
1432
+  #if HOTENDS > 1
1435 1433
     ISR_STATICS(1);
1436 1434
     #if HOTENDS > 2
1437 1435
       ISR_STATICS(2);
@@ -1450,15 +1448,11 @@ void Temperature::isr() {
1450 1448
 
1451 1449
   #if DISABLED(SLOW_PWM_HEATERS)
1452 1450
     /**
1453
-     * standard PWM modulation
1451
+     * Standard PWM modulation
1454 1452
      */
1455 1453
     if (pwm_count == 0) {
1456 1454
       soft_pwm_0 = soft_pwm[0];
1457
-      if (soft_pwm_0 > 0) {
1458
-        WRITE_HEATER_0(1);
1459
-      }
1460
-      else WRITE_HEATER_0P(0); // If HEATERS_PARALLEL should apply, change to WRITE_HEATER_0
1461
-
1455
+      WRITE_HEATER_0(soft_pwm_0 > 0 ? 1 : 0);
1462 1456
       #if HOTENDS > 1
1463 1457
         soft_pwm_1 = soft_pwm[1];
1464 1458
         WRITE_HEATER_1(soft_pwm_1 > 0 ? 1 : 0);
@@ -1535,7 +1529,7 @@ void Temperature::isr() {
1535 1529
       #define MIN_STATE_TIME 16 // MIN_STATE_TIME * 65.5 = time in milliseconds
1536 1530
     #endif
1537 1531
 
1538
-    // Macros for Slow PWM timer logic - HEATERS_PARALLEL applies
1532
+    // Macros for Slow PWM timer logic
1539 1533
     #define _SLOW_PWM_ROUTINE(NR, src) \
1540 1534
       soft_pwm_ ## NR = src; \
1541 1535
       if (soft_pwm_ ## NR > 0) { \

+ 4
- 4
Marlin/temperature.h View File

@@ -65,10 +65,10 @@ class Temperature {
65 65
       static float redundant_temperature;
66 66
     #endif
67 67
 
68
-    static unsigned char soft_pwm_bed;
68
+    static uint8_t soft_pwm_bed;
69 69
 
70 70
     #if ENABLED(FAN_SOFT_PWM)
71
-      static unsigned char fanSpeedSoftPwm[FAN_COUNT];
71
+      static uint8_t fanSpeedSoftPwm[FAN_COUNT];
72 72
     #endif
73 73
 
74 74
     #if ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED)
@@ -209,10 +209,10 @@ class Temperature {
209 209
       static millis_t next_auto_fan_check_ms;
210 210
     #endif
211 211
 
212
-    static unsigned char soft_pwm[HOTENDS];
212
+    static uint8_t soft_pwm[HOTENDS];
213 213
 
214 214
     #if ENABLED(FAN_SOFT_PWM)
215
-      static unsigned char soft_pwm_fan[FAN_COUNT];
215
+      static uint8_t soft_pwm_fan[FAN_COUNT];
216 216
     #endif
217 217
 
218 218
     #if ENABLED(FILAMENT_WIDTH_SENSOR)

Loading…
Cancel
Save