Browse Source

Extend measuring range of thermocouple for MAX31855

esenapaj 8 years ago
parent
commit
70e287ca8c
2 changed files with 11 additions and 3 deletions
  1. 4
    0
      Marlin/Conditionals_post.h
  2. 7
    3
      Marlin/temperature.cpp

+ 4
- 0
Marlin/Conditionals_post.h View File

@@ -222,8 +222,12 @@
222 222
   #if TEMP_SENSOR_0 == -3
223 223
     #define HEATER_0_USES_MAX6675
224 224
     #define MAX6675_IS_MAX31855
225
+    #define MAX6675_TMIN -270
226
+    #define MAX6675_TMAX 1800
225 227
   #elif TEMP_SENSOR_0 == -2
226 228
     #define HEATER_0_USES_MAX6675
229
+    #define MAX6675_TMIN 0
230
+    #define MAX6675_TMAX 1024
227 231
   #elif TEMP_SENSOR_0 == -1
228 232
     #define HEATER_0_USES_AD595
229 233
   #elif TEMP_SENSOR_0 == 0

+ 7
- 3
Marlin/temperature.cpp View File

@@ -669,8 +669,8 @@ void Temperature::manage_heater() {
669 669
   updateTemperaturesFromRawValues(); // also resets the watchdog
670 670
 
671 671
   #if ENABLED(HEATER_0_USES_MAX6675)
672
-    if (current_temperature[0] > min(HEATER_0_MAXTEMP, 1023)) max_temp_error(0);
673
-    if (current_temperature[0] < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0);
672
+    if (current_temperature[0] > min(HEATER_0_MAXTEMP, MAX6675_TMAX - 1)) max_temp_error(0);
673
+    if (current_temperature[0] < max(HEATER_0_MINTEMP, MAX6675_TMIN + 0.01)) min_temp_error(0);
674 674
   #endif
675 675
 
676 676
   #if (ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0) || (ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0) || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN
@@ -1355,10 +1355,14 @@ void Temperature::disable_all_heaters() {
1355 1355
       #else
1356 1356
         SERIAL_ERRORLNPGM("MAX6675");
1357 1357
       #endif
1358
-      max6675_temp = 4000; // thermocouple open
1358
+      max6675_temp = MAX6675_TMAX * 4; // thermocouple open
1359 1359
     }
1360 1360
     else
1361 1361
       max6675_temp >>= MAX6675_DISCARD_BITS;
1362
+      #if ENABLED(MAX6675_IS_MAX31855)
1363
+        // Support negative temperature
1364
+        if (max6675_temp & 0x00002000) max6675_temp |= 0xffffc000;
1365
+      #endif
1362 1366
 
1363 1367
     return (int)max6675_temp;
1364 1368
   }

Loading…
Cancel
Save