Browse Source

Merge pull request #1762 from AnHardt/MiMa

Fix MIN&MAX temperatures again
Scott Lahteine 9 years ago
parent
commit
66b3b53e76
2 changed files with 27 additions and 28 deletions
  1. 5
    5
      Marlin/Conditionals.h
  2. 22
    23
      Marlin/temperature.cpp

+ 5
- 5
Marlin/Conditionals.h View File

@@ -349,11 +349,11 @@
349 349
   /**
350 350
    * Shorthand for pin tests, for temperature.cpp
351 351
    */
352
-  #define HAS_TEMP_0 (defined(TEMP_0_PIN) && TEMP_0_PIN >= 0)
353
-  #define HAS_TEMP_1 (defined(TEMP_1_PIN) && TEMP_1_PIN >= 0)
354
-  #define HAS_TEMP_2 (defined(TEMP_2_PIN) && TEMP_2_PIN >= 0)
355
-  #define HAS_TEMP_3 (defined(TEMP_3_PIN) && TEMP_3_PIN >= 0)
356
-  #define HAS_TEMP_BED (defined(TEMP_BED_PIN) && TEMP_BED_PIN >= 0)
352
+  #define HAS_TEMP_0 (defined(TEMP_0_PIN) && TEMP_0_PIN >= 0 && TEMP_SENSOR_0 != 0 && TEMP_SENSOR_0 != -2)
353
+  #define HAS_TEMP_1 (defined(TEMP_1_PIN) && TEMP_1_PIN >= 0 && TEMP_SENSOR_1 != 0)
354
+  #define HAS_TEMP_2 (defined(TEMP_2_PIN) && TEMP_2_PIN >= 0 && TEMP_SENSOR_2 != 0)
355
+  #define HAS_TEMP_3 (defined(TEMP_3_PIN) && TEMP_3_PIN >= 0 && TEMP_SENSOR_3 != 0)
356
+  #define HAS_TEMP_BED (defined(TEMP_BED_PIN) && TEMP_BED_PIN >= 0 && TEMP_SENSOR_BED != 0)
357 357
   #define HAS_FILAMENT_SENSOR (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0)
358 358
   #define HAS_HEATER_0 (defined(HEATER_0_PIN) && HEATER_0_PIN >= 0)
359 359
   #define HAS_HEATER_1 (defined(HEATER_1_PIN) && HEATER_1_PIN >= 0)

+ 22
- 23
Marlin/temperature.cpp View File

@@ -1543,38 +1543,37 @@ ISR(TIMER0_COMPB_vect) {
1543 1543
       if (minttemp_raw[0] GE0 current_temperature_raw[0]) min_temp_error(0);
1544 1544
     #endif
1545 1545
 
1546
-    #if EXTRUDERS > 1
1546
+    #if HAS_TEMP_1
1547 1547
       #if HEATER_1_RAW_LO_TEMP > HEATER_1_RAW_HI_TEMP
1548 1548
         #define GE1 <=
1549 1549
       #else
1550 1550
         #define GE1 >=
1551 1551
       #endif
1552 1552
       if (current_temperature_raw[1] GE1 maxttemp_raw[1]) max_temp_error(1);
1553
-      if (minttemp_raw[1] GE0 current_temperature_raw[1]) min_temp_error(1);
1554
-
1555
-      #if EXTRUDERS > 2
1556
-        #if HEATER_2_RAW_LO_TEMP > HEATER_2_RAW_HI_TEMP
1557
-          #define GE2 <=
1558
-        #else
1559
-          #define GE2 >=
1560
-        #endif
1561
-        if (current_temperature_raw[2] GE2 maxttemp_raw[2]) max_temp_error(2);
1562
-        if (minttemp_raw[2] GE0 current_temperature_raw[2]) min_temp_error(2);
1553
+      if (minttemp_raw[1] GE1 current_temperature_raw[1]) min_temp_error(1);
1554
+    #endif // TEMP_SENSOR_1
1563 1555
 
1564
-        #if EXTRUDERS > 3
1565
-          #if HEATER_3_RAW_LO_TEMP > HEATER_3_RAW_HI_TEMP
1566
-            #define GE3 <=
1567
-          #else
1568
-            #define GE3 >=
1569
-          #endif
1570
-          if (current_temperature_raw[3] GE3 maxttemp_raw[3]) max_temp_error(3);
1571
-          if (minttemp_raw[3] GE0 current_temperature_raw[3]) min_temp_error(3);
1556
+    #if HAS_TEMP_2
1557
+      #if HEATER_2_RAW_LO_TEMP > HEATER_2_RAW_HI_TEMP
1558
+        #define GE2 <=
1559
+      #else
1560
+        #define GE2 >=
1561
+      #endif
1562
+      if (current_temperature_raw[2] GE2 (maxttemp_raw[2]) max_temp_error(2);
1563
+      if (minttemp_raw[2] GE2 current_temperature_raw[2]) min_temp_error(2);
1564
+    #endif // TEMP_SENSOR_2
1572 1565
 
1573
-        #endif // EXTRUDERS > 3
1574
-      #endif // EXTRUDERS > 2
1575
-    #endif // EXTRUDERS > 1
1566
+    #if HAS_TEMP_3
1567
+      #if HEATER_3_RAW_LO_TEMP > HEATER_3_RAW_HI_TEMP
1568
+        #define GE3 <=
1569
+      #else
1570
+        #define GE3 >=
1571
+      #endif
1572
+      if (current_temperature_raw[3] GE3 maxttemp_raw[3]) max_temp_error(3);
1573
+      if (minttemp_raw[3] GE3 current_temperature_raw[3]) min_temp_error(3);
1574
+    #endif // TEMP_SENSOR_3
1576 1575
 
1577
-    #if defined(BED_MAXTEMP) && (TEMP_SENSOR_BED != 0)
1576
+    #if HAS_TEMP_BED
1578 1577
       #if HEATER_BED_RAW_LO_TEMP > HEATER_BED_RAW_HI_TEMP
1579 1578
         #define GEBED <=
1580 1579
       #else

Loading…
Cancel
Save