Browse Source

Option to assist thermocouple debug (#18621)

Axel 5 years ago
parent
commit
c4dd0082a1
No account linked to committer's email address
1 changed files with 15 additions and 14 deletions
  1. 15
    14
      Marlin/src/module/temperature.cpp

+ 15
- 14
Marlin/src/module/temperature.cpp View File

24
  * temperature.cpp - temperature control
24
  * temperature.cpp - temperature control
25
  */
25
  */
26
 
26
 
27
+// Useful when debugging thermocouples
28
+//#define IGNORE_THERMOCOUPLE_ERRORS
29
+
27
 #include "temperature.h"
30
 #include "temperature.h"
28
 #include "endstops.h"
31
 #include "endstops.h"
29
 
32
 
1011
 
1014
 
1012
   updateTemperaturesFromRawValues(); // also resets the watchdog
1015
   updateTemperaturesFromRawValues(); // also resets the watchdog
1013
 
1016
 
1014
-  #if ENABLED(HEATER_0_USES_MAX6675)
1015
-    if (temp_hotend[0].celsius > _MIN(HEATER_0_MAXTEMP, HEATER_0_MAX6675_TMAX - 1.0)) max_temp_error(H_E0);
1016
-    if (temp_hotend[0].celsius < _MAX(HEATER_0_MINTEMP, HEATER_0_MAX6675_TMIN + .01)) min_temp_error(H_E0);
1017
-  #endif
1018
-
1019
-  #if ENABLED(HEATER_1_USES_MAX6675)
1020
-    if (temp_hotend[1].celsius > _MIN(HEATER_1_MAXTEMP, HEATER_1_MAX6675_TMAX - 1.0)) max_temp_error(H_E1);
1021
-    if (temp_hotend[1].celsius < _MAX(HEATER_1_MINTEMP, HEATER_1_MAX6675_TMIN + .01)) min_temp_error(H_E1);
1017
+  #if DISABLED(IGNORE_THERMOCOUPLE_ERRORS)
1018
+    #if ENABLED(HEATER_0_USES_MAX6675)
1019
+      if (temp_hotend[0].celsius > _MIN(HEATER_0_MAXTEMP, HEATER_0_MAX6675_TMAX - 1.0)) max_temp_error(H_E0);
1020
+      if (temp_hotend[0].celsius < _MAX(HEATER_0_MINTEMP, HEATER_0_MAX6675_TMIN + .01)) min_temp_error(H_E0);
1021
+    #endif
1022
+    #if ENABLED(HEATER_1_USES_MAX6675)
1023
+      if (temp_hotend[1].celsius > _MIN(HEATER_1_MAXTEMP, HEATER_1_MAX6675_TMAX - 1.0)) max_temp_error(H_E1);
1024
+      if (temp_hotend[1].celsius < _MAX(HEATER_1_MINTEMP, HEATER_1_MAX6675_TMIN + .01)) min_temp_error(H_E1);
1025
+    #endif
1022
   #endif
1026
   #endif
1023
 
1027
 
1024
   millis_t ms = millis();
1028
   millis_t ms = millis();
2180
 
2184
 
2181
     WRITE_MAX6675(HIGH); // disable TT_MAX6675
2185
     WRITE_MAX6675(HIGH); // disable TT_MAX6675
2182
 
2186
 
2183
-    if (max6675_temp & MAX6675_ERROR_MASK) {
2187
+    if (DISABLED(IGNORE_THERMOCOUPLE_ERRORS) && (max6675_temp & MAX6675_ERROR_MASK)) {
2184
       max6675_errors[hindex] += 1;
2188
       max6675_errors[hindex] += 1;
2185
       if (max6675_errors[hindex] > THERMOCOUPLE_MAX_ERRORS) {
2189
       if (max6675_errors[hindex] > THERMOCOUPLE_MAX_ERRORS) {
2186
         SERIAL_ERROR_START();
2190
         SERIAL_ERROR_START();
2201
         max6675_temp = 4 * (
2205
         max6675_temp = 4 * (
2202
           #if COUNT_6675 > 1
2206
           #if COUNT_6675 > 1
2203
             hindex ? HEATER_1_MAX6675_TMAX : HEATER_0_MAX6675_TMAX
2207
             hindex ? HEATER_1_MAX6675_TMAX : HEATER_0_MAX6675_TMAX
2204
-          #elif ENABLED(HEATER_1_USES_MAX6675)
2205
-            HEATER_1_MAX6675_TMAX
2206
           #else
2208
           #else
2207
-            HEATER_0_MAX6675_TMAX
2209
+            TERN(HEATER_1_USES_MAX6675, HEATER_1_MAX6675_TMAX, HEATER_0_MAX6675_TMAX)
2208
           #endif
2210
           #endif
2209
         );
2211
         );
2210
       }
2212
       }
2211
-      else {
2213
+      else
2212
         max6675_temp >>= MAX6675_DISCARD_BITS;
2214
         max6675_temp >>= MAX6675_DISCARD_BITS;
2213
-      }
2214
     }
2215
     }
2215
     else {
2216
     else {
2216
       max6675_temp >>= MAX6675_DISCARD_BITS;
2217
       max6675_temp >>= MAX6675_DISCARD_BITS;

Loading…
Cancel
Save