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
       #endif
7640
       #endif
7641
 
7641
 
7642
       #if HAS_BED_PROBE
7642
       #if HAS_BED_PROBE
7643
-        case 851:
7643
+        case 851: // Set Z Probe Z Offset
7644
           gcode_M851();
7644
           gcode_M851();
7645
           break;
7645
           break;
7646
       #endif // HAS_BED_PROBE
7646
       #endif // HAS_BED_PROBE

+ 17
- 23
Marlin/temperature.cpp View File

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

+ 4
- 4
Marlin/temperature.h View File

65
       static float redundant_temperature;
65
       static float redundant_temperature;
66
     #endif
66
     #endif
67
 
67
 
68
-    static unsigned char soft_pwm_bed;
68
+    static uint8_t soft_pwm_bed;
69
 
69
 
70
     #if ENABLED(FAN_SOFT_PWM)
70
     #if ENABLED(FAN_SOFT_PWM)
71
-      static unsigned char fanSpeedSoftPwm[FAN_COUNT];
71
+      static uint8_t fanSpeedSoftPwm[FAN_COUNT];
72
     #endif
72
     #endif
73
 
73
 
74
     #if ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED)
74
     #if ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED)
209
       static millis_t next_auto_fan_check_ms;
209
       static millis_t next_auto_fan_check_ms;
210
     #endif
210
     #endif
211
 
211
 
212
-    static unsigned char soft_pwm[HOTENDS];
212
+    static uint8_t soft_pwm[HOTENDS];
213
 
213
 
214
     #if ENABLED(FAN_SOFT_PWM)
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
     #endif
216
     #endif
217
 
217
 
218
     #if ENABLED(FILAMENT_WIDTH_SENSOR)
218
     #if ENABLED(FILAMENT_WIDTH_SENSOR)

Loading…
Cancel
Save