Browse Source

Allow MAX31865 resistance values configuration (#19695)

Jason Smith 4 years ago
parent
commit
f4ff6a673f
3 changed files with 12 additions and 2 deletions
  1. 6
    0
      Marlin/Configuration.h
  2. 4
    0
      Marlin/src/inc/SanityCheck.h
  3. 2
    2
      Marlin/src/module/temperature.cpp

+ 6
- 0
Marlin/Configuration.h View File

@@ -431,6 +431,12 @@
431 431
 #define DUMMY_THERMISTOR_998_VALUE 25
432 432
 #define DUMMY_THERMISTOR_999_VALUE 100
433 433
 
434
+// Resistor values when using a MAX31865 (sensor -5)
435
+// Sensor value is typically 100 (PT100) or 1000 (PT1000)
436
+// Calibration value is typically 430 ohm for AdaFruit PT100 modules and 4300 ohm for AdaFruit PT1000 modules.
437
+//#define MAX31865_SENSOR_OHMS      100
438
+//#define MAX31865_CALIBRATION_OHMS 430
439
+
434 440
 // Use temp sensor 1 as a redundant sensor with sensor 0. If the readings
435 441
 // from the two sensors differ too much the print will be aborted.
436 442
 //#define TEMP_SENSOR_1_AS_REDUNDANT

+ 4
- 0
Marlin/src/inc/SanityCheck.h View File

@@ -1845,6 +1845,10 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
1845 1845
   #error "TEMP_SENSOR_1 is required with TEMP_SENSOR_1_AS_REDUNDANT."
1846 1846
 #endif
1847 1847
 
1848
+#if ENABLED(MAX6675_IS_MAX31865) && (!defined(MAX31865_SENSOR_OHMS) || !defined(MAX31865_CALIBRATION_OHMS))
1849
+  #error "MAX31865_SENSOR_OHMS and MAX31865_CALIBRATION_OHMS must be set in Configuration.h when using a MAX31865 temperature sensor."
1850
+#endif
1851
+
1848 1852
 /**
1849 1853
  * Test Heater, Temp Sensor, and Extruder Pins
1850 1854
  */

+ 2
- 2
Marlin/src/module/temperature.cpp View File

@@ -1461,7 +1461,7 @@ void Temperature::manage_heater() {
1461 1461
         #elif ENABLED(HEATER_0_USES_MAX6675)
1462 1462
           return (
1463 1463
             #if ENABLED(MAX6675_IS_MAX31865)
1464
-              max31865.temperature(100, 400)  // 100 ohms = PT100 resistance. 400 ohms = calibration resistor
1464
+              max31865.temperature(MAX31865_SENSOR_OHMS, MAX31865_CALIBRATION_OHMS)
1465 1465
             #else
1466 1466
               raw * 0.25
1467 1467
             #endif
@@ -2236,7 +2236,7 @@ void Temperature::disable_all_heaters() {
2236 2236
     next_max6675_ms[hindex] = ms + MAX6675_HEAT_INTERVAL;
2237 2237
 
2238 2238
     #if ENABLED(MAX6675_IS_MAX31865)
2239
-      max6675_temp = int(max31865.temperature(100, 400)); // 100 ohms = PT100 resistance. 400 ohms = calibration resistor
2239
+      max6675_temp = int(max31865.temperature(MAX31865_SENSOR_OHMS, MAX31865_CALIBRATION_OHMS));
2240 2240
     #endif
2241 2241
 
2242 2242
     //

Loading…
Cancel
Save