Browse Source

🐛 Redundant Temp Sensor followup (#22196)

Katelyn Schiesser 2 years ago
parent
commit
b2f0913083
No account linked to committer's email address
49 changed files with 1563 additions and 783 deletions
  1. 79
    57
      Marlin/Configuration.h
  2. 15
    4
      Marlin/Configuration_adv.h
  3. 2
    1
      Marlin/src/HAL/SAMD51/inc/SanityCheck.h
  4. 2
    2
      Marlin/src/MarlinCore.cpp
  5. 2
    2
      Marlin/src/core/macros.h
  6. 7
    5
      Marlin/src/gcode/calibrate/G34_M422.cpp
  7. 277
    182
      Marlin/src/inc/Conditionals_post.h
  8. 81
    55
      Marlin/src/inc/SanityCheck.h
  9. 500
    0
      Marlin/src/libs/MAX31865.cpp
  10. 131
    0
      Marlin/src/libs/MAX31865.h
  11. 1
    2
      Marlin/src/module/motion.cpp
  12. 303
    323
      Marlin/src/module/temperature.cpp
  13. 10
    10
      Marlin/src/module/temperature.h
  14. 3
    3
      Marlin/src/pins/linux/pins_RAMPS_LINUX.h
  15. 13
    0
      Marlin/src/pins/lpc1768/pins_BTT_SKR_common.h
  16. 2
    2
      Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h
  17. 9
    9
      Marlin/src/pins/mega/pins_MALYAN_M180.h
  18. 10
    10
      Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h
  19. 3
    3
      Marlin/src/pins/mega/pins_PICA.h
  20. 20
    20
      Marlin/src/pins/pinsDebug_list.h
  21. 3
    3
      Marlin/src/pins/rambo/pins_RAMBO.h
  22. 3
    3
      Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR.h
  23. 3
    3
      Marlin/src/pins/ramps/pins_FORMBOT_TREX2PLUS.h
  24. 3
    3
      Marlin/src/pins/ramps/pins_FORMBOT_TREX3.h
  25. 3
    3
      Marlin/src/pins/ramps/pins_RAMPS.h
  26. 3
    3
      Marlin/src/pins/ramps/pins_RAMPS_OLD.h
  27. 4
    4
      Marlin/src/pins/ramps/pins_RIGIDBOARD.h
  28. 3
    3
      Marlin/src/pins/ramps/pins_TENLOG_D3_HERO.h
  29. 3
    3
      Marlin/src/pins/ramps/pins_TT_OSCAR.h
  30. 3
    3
      Marlin/src/pins/sam/pins_DUE3DOM.h
  31. 3
    3
      Marlin/src/pins/sam/pins_DUE3DOM_MINI.h
  32. 3
    3
      Marlin/src/pins/sam/pins_RADDS.h
  33. 4
    4
      Marlin/src/pins/sam/pins_RAMPS_DUO.h
  34. 3
    3
      Marlin/src/pins/sam/pins_RAMPS_FD_V1.h
  35. 4
    4
      Marlin/src/pins/sam/pins_RAMPS_SMART.h
  36. 3
    3
      Marlin/src/pins/sam/pins_RURAMPS4D_11.h
  37. 3
    3
      Marlin/src/pins/sam/pins_RURAMPS4D_13.h
  38. 5
    6
      Marlin/src/pins/sam/pins_ULTRATRONICS_PRO.h
  39. 4
    4
      Marlin/src/pins/stm32f1/pins_MINGDA_MPX_ARM_MINI.h
  40. 2
    2
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h
  41. 2
    2
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h
  42. 2
    2
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h
  43. 2
    2
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h
  44. 10
    10
      Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h
  45. 6
    6
      Marlin/src/pins/stm32f4/pins_LERDGE_S.h
  46. 2
    2
      Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h
  47. 2
    2
      Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h
  48. 1
    1
      ini/features.ini
  49. 1
    0
      platformio.ini

+ 79
- 57
Marlin/Configuration.h View File

@@ -397,70 +397,92 @@
397 397
 // @section temperature
398 398
 
399 399
 /**
400
- * --NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table
400
+ * --NORMAL IS 4.7kΩ PULLUP!-- 1kΩ pullup can be used on hotend sensor, using correct resistor and table
401 401
  *
402 402
  * Temperature sensors available:
403 403
  *
404
- *    -5 : PT100 / PT1000 with MAX31865 (only for sensors 0-1)
405
- *    -3 : thermocouple with MAX31855 (only for sensors 0-1)
406
- *    -2 : thermocouple with MAX6675 (only for sensors 0-1)
407
- *    -4 : thermocouple with AD8495
408
- *    -1 : thermocouple with AD595
404
+ *  SPI RTD/Thermocouple Boards - IMPORTANT: Read the NOTE below!
405
+ *  -------
406
+ *    -5 : MAX31865 with Pt100/Pt1000, 2, 3, or 4-wire  (only for sensors 0-1)
407
+ *                  NOTE: You must uncomment/set the MAX31865_*_OHMS_n defines below.
408
+ *    -3 : MAX31855 with Thermocouple, -200°C to +700°C (only for sensors 0-1)
409
+ *    -2 : MAX6675  with Thermocouple, 0°C to +700°C    (only for sensors 0-1)
410
+ *
411
+ *  NOTE: Ensure TEMP_n_CS_PIN is set in your pins file for each TEMP_SENSOR_n using an SPI Thermocouple. By default,
412
+ *        Hardware SPI on the default serial bus is used. If you have also set TEMP_n_SCK_PIN and TEMP_n_MISO_PIN,
413
+ *        Software SPI will be used on those ports instead. You can force Hardware SPI on the default bus in the
414
+ *        Configuration_adv.h file. At this time, separate Hardware SPI buses for sensors are not supported.
415
+ *
416
+ *  Analog Themocouple Boards
417
+ *  -------
418
+ *    -4 : AD8495 with Thermocouple
419
+ *    -1 : AD595  with Thermocouple
420
+ *
421
+ *  Analog Thermistors - 4.7kΩ pullup - Normal
422
+ *  -------
423
+ *     1 : 100kΩ  EPCOS - Best choice for EPCOS thermistors
424
+ *   331 : 100kΩ  Same as #1, but 3.3V scaled for MEGA
425
+ *   332 : 100kΩ  Same as #1, but 3.3V scaled for DUE
426
+ *     2 : 200kΩ  ATC Semitec 204GT-2
427
+ *   202 : 200kΩ  Copymaster 3D
428
+ *     3 : ???Ω   Mendel-parts thermistor
429
+ *     4 : 10kΩ   Generic Thermistor !! DO NOT use for a hotend - it gives bad resolution at high temp. !!
430
+ *     5 : 100kΩ  ATC Semitec 104GT-2/104NT-4-R025H42G - Used in ParCan, J-Head, and E3D, SliceEngineering 300°C
431
+ *   501 : 100kΩ  Zonestar - Tronxy X3A
432
+ *   502 : 100kΩ  Zonestar - used by hot bed in Zonestar Průša P802M
433
+ *   512 : 100kΩ  RPW-Ultra hotend
434
+ *     6 : 100kΩ  EPCOS - Not as accurate as table #1 (created using a fluke thermocouple)
435
+ *     7 : 100kΩ  Honeywell 135-104LAG-J01
436
+ *    71 : 100kΩ  Honeywell 135-104LAF-J01
437
+ *     8 : 100kΩ  Vishay 0603 SMD NTCS0603E3104FXT
438
+ *     9 : 100kΩ  GE Sensing AL03006-58.2K-97-G1
439
+ *    10 : 100kΩ  RS PRO 198-961
440
+ *    11 : 100kΩ  Keenovo AC silicone mats, most Wanhao i3 machines - beta 3950, 1%
441
+ *    12 : 100kΩ  Vishay 0603 SMD NTCS0603E3104FXT (#8) - calibrated for Makibox hot bed
442
+ *    13 : 100kΩ  Hisens up to 300°C - for "Simple ONE" & "All In ONE" hotend - beta 3950, 1%
443
+ *    15 : 100kΩ  Calibrated for JGAurora A5 hotend
444
+ *    18 : 200kΩ  ATC Semitec 204GT-2 Dagoma.Fr - MKS_Base_DKU001327
445
+ *    22 : 100kΩ  GTM32 Pro vB - hotend - 4.7kΩ pullup to 3.3V and 220Ω to analog input
446
+ *    23 : 100kΩ  GTM32 Pro vB - bed - 4.7kΩ pullup to 3.3v and 220Ω to analog input
447
+ *    30 : 100kΩ  Kis3d Silicone heating mat 200W/300W with 6mm precision cast plate (EN AW 5083) NTC100K - beta 3950
448
+ *    60 : 100kΩ  Maker's Tool Works Kapton Bed Thermistor - beta 3950
449
+ *    61 : 100kΩ  Formbot/Vivedino 350°C Thermistor - beta 3950
450
+ *    66 : 4.7MΩ  Dyze Design High Temperature Thermistor
451
+ *    67 : 500kΩ  SliceEngineering 450°C Thermistor
452
+ *    70 : 100kΩ  bq Hephestos 2
453
+ *    75 : 100kΩ  Generic Silicon Heat Pad with NTC100K MGB18-104F39050L32
454
+ *
455
+ *  Analog Thermistors - 1kΩ pullup - Atypical, and requires changing out the 4.7kΩ pullup for 1kΩ.
456
+ *  -------                           (but gives greater accuracy and more stable PID)
457
+ *    51 : 100kΩ  EPCOS (1kΩ pullup)
458
+ *    52 : 200kΩ  ATC Semitec 204GT-2 (1kΩ pullup)
459
+ *    55 : 100kΩ  ATC Semitec 104GT-2 - Used in ParCan & J-Head (1kΩ pullup)
460
+ *
461
+ *  Analog Thermistors - 10kΩ pullup - Atypical
462
+ *  -------
463
+ *    99 : 100kΩ  Found on some Wanhao i3 machines with a 10kΩ pull-up resistor
464
+ *
465
+ *  Analog RTDs (Pt100/Pt1000)
466
+ *  -------
467
+ *   110 : Pt100  with 1kΩ pullup (atypical)
468
+ *   147 : Pt100  with 4.7kΩ pullup
469
+ *  1010 : Pt1000 with 1kΩ pullup (atypical)
470
+ *  1047 : Pt1000 with 4.7kΩ pullup (E3D)
471
+ *    20 : Pt100  with circuit in the Ultimainboard V2.x with mainboard ADC reference voltage = INA826 amplifier-board supply voltage.
472
+ *                NOTE: (1) Must use an ADC input with no pullup. (2) Some INA826 amplifiers are unreliable at 3.3V so consider using sensor 147, 110, or 21.
473
+ *    21 : Pt100  with circuit in the Ultimainboard V2.x with 3.3v ADC reference voltage (STM32, LPC176x....) and 5V INA826 amplifier board supply.
474
+ *                NOTE: ADC pins are not 5V tolerant. Not recommended because it's possible to damage the CPU by going over 500°C.
475
+ *   201 : Pt100  with circuit in Overlord, similar to Ultimainboard V2.x
476
+ *
477
+ *  Custom/Dummy/Other Thermos
478
+ *  ------
409 479
  *     0 : not used
410
- *     1 : 100k thermistor - best choice for EPCOS 100k (4.7k pullup)
411
- *   331 : (3.3V scaled thermistor 1 table for MEGA)
412
- *   332 : (3.3V scaled thermistor 1 table for DUE)
413
- *     2 : 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup)
414
- *   202 : 200k thermistor - Copymaster 3D
415
- *     3 : Mendel-parts thermistor (4.7k pullup)
416
- *     4 : 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !!
417
- *     5 : 100K thermistor - ATC Semitec 104GT-2/104NT-4-R025H42G (Used in ParCan, J-Head, and E3D) (4.7k pullup)
418
- *   501 : 100K Zonestar (Tronxy X3A) Thermistor
419
- *   502 : 100K Zonestar Thermistor used by hot bed in Zonestar Průša P802M
420
- *   512 : 100k RPW-Ultra hotend thermistor (4.7k pullup)
421
- *     6 : 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup)
422
- *     7 : 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup)
423
- *    71 : 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup)
424
- *     8 : 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup)
425
- *     9 : 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
426
- *    10 : 100k RS thermistor 198-961 (4.7k pullup)
427
- *    11 : 100k beta 3950 1% thermistor (Used in Keenovo AC silicone mats and most Wanhao i3 machines) (4.7k pullup)
428
- *    12 : 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed)
429
- *    13 : 100k Hisens 3950  1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE"
430
- *    15 : 100k thermistor calibration for JGAurora A5 hotend
431
- *    18 : ATC Semitec 204GT-2 (4.7k pullup) Dagoma.Fr - MKS_Base_DKU001327
432
- *    20 : Pt100 with circuit in the Ultimainboard V2.x with mainboard ADC reference voltage = INA826 amplifier-board supply voltage.
433
- *         NOTES: (1) Must use an ADC input with no pullup. (2) Some INA826 amplifiers are unreliable at 3.3V so consider using sensor 147, 110, or 21.
434
- *    21 : Pt100 with circuit in the Ultimainboard V2.x with 3.3v ADC reference voltage (STM32, LPC176x....) and 5V INA826 amplifier board supply.
435
- *         NOTE: ADC pins are not 5V tolerant. Not recommended because it's possible to damage the CPU by going over 500°C.
436
- *    22 : 100k (hotend) with 4.7k pullup to 3.3V and 220R to analog input (as in GTM32 Pro vB)
437
- *    23 : 100k (bed) with 4.7k pullup to 3.3v and 220R to analog input (as in GTM32 Pro vB)
438
- *    30 : Kis3d Silicone heating mat 200W/300W with 6mm precision cast plate (EN AW 5083) NTC100K / B3950 (4.7k pullup)
439
- *   201 : Pt100 with circuit in Overlord, similar to Ultimainboard V2.x
440
- *    60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
441
- *    61 : 100k Formbot / Vivedino 3950 350C thermistor 4.7k pullup
442
- *    66 : 4.7M High Temperature thermistor from Dyze Design
443
- *    67 : 450C thermistor from SliceEngineering
444
- *    70 : the 100K thermistor found in the bq Hephestos 2
445
- *    75 : 100k Generic Silicon Heat Pad with NTC 100K MGB18-104F39050L32 thermistor
446
- *    99 : 100k thermistor with a 10K pull-up resistor (found on some Wanhao i3 machines)
447
- *
448
- *       1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
449
- *                              (but gives greater accuracy and more stable PID)
450
- *    51 : 100k thermistor - EPCOS (1k pullup)
451
- *    52 : 200k thermistor - ATC Semitec 204GT-2 (1k pullup)
452
- *    55 : 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup)
453
- *
454
- *  1047 : Pt1000 with 4k7 pullup (E3D)
455
- *  1010 : Pt1000 with 1k pullup (non standard)
456
- *   147 : Pt100 with 4k7 pullup
457
- *   110 : Pt100 with 1k pullup (non standard)
458
- *
459 480
  *  1000 : Custom - Specify parameters in Configuration_adv.h
460 481
  *
461
- *         Use these for Testing or Development purposes. NEVER for production machine.
482
+ *   !!! Use these for Testing or Development purposes. NEVER for production machine. !!!
462 483
  *   998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below.
463 484
  *   999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below.
485
+ *
464 486
  */
465 487
 #define TEMP_SENSOR_0 1
466 488
 #define TEMP_SENSOR_1 0
@@ -482,7 +504,7 @@
482 504
 
483 505
 // Resistor values when using MAX31865 sensors (-5) on TEMP_SENSOR_0 / 1
484 506
 //#define MAX31865_SENSOR_OHMS_0      100   // (Ω) Typically 100 or 1000 (PT100 or PT1000)
485
-//#define MAX31865_CALIBRATION_OHMS_0 430   // (Ω) Typically 430 for AdaFruit PT100; 4300 for AdaFruit PT1000
507
+//#define MAX31865_CALIBRATION_OHMS_0 430   // (Ω) Typically 430 for Adafruit PT100; 4300 for Adafruit PT1000
486 508
 //#define MAX31865_SENSOR_OHMS_1      100
487 509
 //#define MAX31865_CALIBRATION_OHMS_1 430
488 510
 

+ 15
- 4
Marlin/Configuration_adv.h View File

@@ -131,10 +131,21 @@
131 131
   #define REDUNDANT_BETA                   3950    // Beta value
132 132
 #endif
133 133
 
134
-//
135
-// Hephestos 2 24V heated bed upgrade kit.
136
-// https://store.bq.com/en/heated-bed-kit-hephestos2
137
-//
134
+/**
135
+ * Configuration options for MAX Thermocouples (-2, -3, -5).
136
+ *   FORCE_HW_SPI:   Ignore SCK/MOSI/MISO pins and just use the CS pin & default SPI bus.
137
+ *   MAX31865_WIRES: Set the number of wires for the probe connected to a MAX31865 board, 2-4. Default: 2
138
+ *   MAX31865_50HZ:  Enable 50Hz filter instead of the default 60Hz.
139
+ */
140
+//#define TEMP_SENSOR_FORCE_HW_SPI
141
+//#define MAX31865_SENSOR_WIRES_0 2
142
+//#define MAX31865_SENSOR_WIRES_1 2
143
+//#define MAX31865_50HZ_FILTER
144
+
145
+/**
146
+ * Hephestos 2 24V heated bed upgrade kit.
147
+ * https://store.bq.com/en/heated-bed-kit-hephestos2
148
+ */
138 149
 //#define HEPHESTOS2_HEATED_BED_KIT
139 150
 #if ENABLED(HEPHESTOS2_HEATED_BED_KIT)
140 151
   #undef TEMP_SENSOR_BED

+ 2
- 1
Marlin/src/HAL/SAMD51/inc/SanityCheck.h View File

@@ -31,7 +31,8 @@
31 31
   #error "No custom SD drive cable defined for this board."
32 32
 #endif
33 33
 
34
-#if defined(MAX6675_SCK_PIN) && defined(MAX6675_DO_PIN) && (MAX6675_SCK_PIN == SCK1 || MAX6675_DO_PIN == MISO1)
34
+#if (defined(TEMP_0_SCK_PIN) && defined(TEMP_0_MISO_PIN) && (TEMP_0_SCK_PIN == SCK1 || TEMP_0_MISO_PIN == MISO1)) || \
35
+    (defined(TEMP_1_SCK_PIN) && defined(TEMP_1_MISO_PIN) && (TEMP_1_SCK_PIN == SCK1 || TEMP_1_MISO_PIN == MISO1))
35 36
   #error "OnBoard SPI BUS can't be shared with other devices."
36 37
 #endif
37 38
 

+ 2
- 2
Marlin/src/MarlinCore.cpp View File

@@ -1169,10 +1169,10 @@ void setup() {
1169 1169
 
1170 1170
   // Init and disable SPI thermocouples; this is still needed
1171 1171
   #if TEMP_SENSOR_0_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 0)
1172
-    OUT_WRITE(MAX6675_SS_PIN, HIGH);  // Disable
1172
+    OUT_WRITE(TEMP_0_CS_PIN, HIGH);  // Disable
1173 1173
   #endif
1174 1174
   #if TEMP_SENSOR_1_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 1)
1175
-    OUT_WRITE(MAX6675_SS2_PIN, HIGH); // Disable
1175
+    OUT_WRITE(TEMP_1_CS_PIN, HIGH);
1176 1176
   #endif
1177 1177
 
1178 1178
   #if ENABLED(DUET_SMART_EFFECTOR) && PIN_EXISTS(SMART_EFFECTOR_MOD)

+ 2
- 2
Marlin/src/core/macros.h View File

@@ -204,8 +204,8 @@
204 204
 #define __TERN(T,V...)      ___TERN(_CAT(_NO,T),V)  // Prepend '_NO' to get '_NOT_0' or '_NOT_1'
205 205
 #define ___TERN(P,V...)     THIRD(P,V)              // If first argument has a comma, A. Else B.
206 206
 
207
-#define _OPTARG(A)          , A
208
-#define OPTARG(O,A)         TERN_(O,DEFER4(_OPTARG)(A))
207
+#define _OPTARG(A...)       , A
208
+#define OPTARG(O,A...)      TERN_(O,DEFER4(_OPTARG)(A))
209 209
 #define _OPTCODE(A)         A;
210 210
 #define OPTCODE(O,A)        TERN_(O,DEFER4(_OPTCODE)(A))
211 211
 

+ 7
- 5
Marlin/src/gcode/calibrate/G34_M422.cpp View File

@@ -314,11 +314,13 @@ void GcodeSuite::G34() {
314 314
           sprintf_P(msg,
315 315
             PSTR("1:2=%s" TERN_(TRIPLE_Z, " 3-2=%s 3-1=%s") TERN_(QUAD_Z, " 4-3=%s 4-2=%s 4-1=%s")),
316 316
             dtostrf(ABS(z_measured[1] - z_measured[0]), 1, 3, fstr1)
317
-            OPTARG(TRIPLE_Z, dtostrf(ABS(z_measured[2] - z_measured[1]), 1, 3, fstr2))
318
-            OPTARG(TRIPLE_Z, dtostrf(ABS(z_measured[2] - z_measured[0]), 1, 3, fstr3))
319
-            OPTARG(QUAD_Z,   dtostrf(ABS(z_measured[3] - z_measured[2]), 1, 3, fstr4))
320
-            OPTARG(QUAD_Z,   dtostrf(ABS(z_measured[3] - z_measured[1]), 1, 3, fstr5))
321
-            OPTARG(QUAD_Z,   dtostrf(ABS(z_measured[3] - z_measured[0]), 1, 3, fstr6))
317
+            OPTARG(TRIPLE_Z,
318
+              dtostrf(ABS(z_measured[2] - z_measured[1]), 1, 3, fstr2),
319
+              dtostrf(ABS(z_measured[2] - z_measured[0]), 1, 3, fstr3))
320
+            OPTARG(QUAD_Z,
321
+              dtostrf(ABS(z_measured[3] - z_measured[2]), 1, 3, fstr4),
322
+              dtostrf(ABS(z_measured[3] - z_measured[1]), 1, 3, fstr5),
323
+              dtostrf(ABS(z_measured[3] - z_measured[0]), 1, 3, fstr6))
322 324
           );
323 325
           ui.set_status(msg);
324 326
         #endif

+ 277
- 182
Marlin/src/inc/Conditionals_post.h View File

@@ -615,20 +615,21 @@
615 615
 
616 616
 #if TEMP_SENSOR_0 == -5 || TEMP_SENSOR_0 == -3 || TEMP_SENSOR_0 == -2
617 617
   #define TEMP_SENSOR_0_IS_MAX_TC 1
618
-  #define HAS_MAX_TC 1
619
-  #if TEMP_SENSOR_0 == -3
620
-    #define TEMP_SENSOR_0_MAX_TC_TMIN -270
621
-    #define TEMP_SENSOR_0_MAX_TC_TMAX 1800
622
-  #else
623
-    #define TEMP_SENSOR_0_MAX_TC_TMIN    0
624
-    #define TEMP_SENSOR_0_MAX_TC_TMAX 1024
625
-  #endif
626 618
   #if TEMP_SENSOR_0 == -5
627 619
     #define TEMP_SENSOR_0_IS_MAX31865 1
620
+    #define TEMP_SENSOR_0_MAX_TC_TMIN    0
621
+    #define TEMP_SENSOR_0_MAX_TC_TMAX 1024
622
+    #ifndef MAX31865_SENSOR_WIRES_0
623
+      #define MAX31865_SENSOR_WIRES_0 2
624
+    #endif
628 625
   #elif TEMP_SENSOR_0 == -3
629 626
     #define TEMP_SENSOR_0_IS_MAX31855 1
627
+    #define TEMP_SENSOR_0_MAX_TC_TMIN -270
628
+    #define TEMP_SENSOR_0_MAX_TC_TMAX 1800
630 629
   #elif TEMP_SENSOR_0 == -2
631 630
     #define TEMP_SENSOR_0_IS_MAX6675 1
631
+    #define TEMP_SENSOR_0_MAX_TC_TMIN    0
632
+    #define TEMP_SENSOR_0_MAX_TC_TMAX 1024
632 633
   #endif
633 634
 #elif TEMP_SENSOR_0 == -4
634 635
   #define TEMP_SENSOR_0_IS_AD8495 1
@@ -648,21 +649,23 @@
648 649
 
649 650
 #if TEMP_SENSOR_1 == -5 || TEMP_SENSOR_1 == -3 || TEMP_SENSOR_1 == -2
650 651
   #define TEMP_SENSOR_1_IS_MAX_TC 1
651
-  #define HAS_MAX_TC 1
652
-  #if TEMP_SENSOR_1 == -3
653
-    #define TEMP_SENSOR_1_MAX_TC_TMIN -270
654
-    #define TEMP_SENSOR_1_MAX_TC_TMAX 1800
655
-  #else
656
-    #define TEMP_SENSOR_1_MAX_TC_TMIN    0
657
-    #define TEMP_SENSOR_1_MAX_TC_TMAX 1024
658
-  #endif
659 652
   #if TEMP_SENSOR_1 == -5
660 653
     #define TEMP_SENSOR_1_IS_MAX31865 1
654
+    #define TEMP_SENSOR_1_MAX_TC_TMIN    0
655
+    #define TEMP_SENSOR_1_MAX_TC_TMAX 1024
656
+    #ifndef MAX31865_SENSOR_WIRES_1
657
+      #define MAX31865_SENSOR_WIRES_1 2
658
+    #endif
661 659
   #elif TEMP_SENSOR_1 == -3
662 660
     #define TEMP_SENSOR_1_IS_MAX31855 1
661
+    #define TEMP_SENSOR_1_MAX_TC_TMIN -270
662
+    #define TEMP_SENSOR_1_MAX_TC_TMAX 1800
663 663
   #elif TEMP_SENSOR_1 == -2
664 664
     #define TEMP_SENSOR_1_IS_MAX6675 1
665
+    #define TEMP_SENSOR_1_MAX_TC_TMIN    0
666
+    #define TEMP_SENSOR_1_MAX_TC_TMAX 1024
665 667
   #endif
668
+
666 669
   #if TEMP_SENSOR_1 != TEMP_SENSOR_0
667 670
     #if   TEMP_SENSOR_1 == -5
668 671
       #error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."
@@ -690,37 +693,48 @@
690 693
 
691 694
 #if TEMP_SENSOR_REDUNDANT == -5 || TEMP_SENSOR_REDUNDANT == -3 || TEMP_SENSOR_REDUNDANT == -2
692 695
   #define TEMP_SENSOR_REDUNDANT_IS_MAX_TC 1
693
-  #define HAS_MAX_TC 1
694
-  #if TEMP_SENSOR_REDUNDANT == -3
695
-    #define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN -270
696
-    #define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1800
697
-  #else
698
-    #define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN    0
699
-    #define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1024
700
-  #endif
701
-  #if TEMP_SENSOR_REDUNDANT_SOURCE == 0
702
-    #define TEMP_SENSOR_0_MAX_TC_TMIN TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN
703
-    #define TEMP_SENSOR_0_MAX_TC_TMAX TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX
704
-  #elif TEMP_SENSOR_REDUNDANT_SOURCE == 1
705
-    #define TEMP_SENSOR_1_MAX_TC_TMIN TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN
706
-    #define TEMP_SENSOR_1_MAX_TC_TMAX TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX
707
-  #endif
696
+
708 697
   #if TEMP_SENSOR_REDUNDANT == -5
709 698
     #if TEMP_SENSOR_REDUNDANT_SOURCE != 0 && TEMP_SENSOR_REDUNDANT_SOURCE != 1
710 699
       #error "MAX31865 Thermocouples (-5) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
711 700
     #endif
712
-    #define TEMP_SENSOR_REDUNDANT_IS_MAX31865 1
701
+
702
+    #define TEMP_SENSOR_REDUNDANT_IS_MAX31865    1
703
+    #define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN    0
704
+    #define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1024
713 705
   #elif TEMP_SENSOR_REDUNDANT == -3
714 706
     #if TEMP_SENSOR_REDUNDANT_SOURCE != 0 && TEMP_SENSOR_REDUNDANT_SOURCE != 1
715 707
       #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
716 708
     #endif
717
-    #define TEMP_SENSOR_REDUNDANT_IS_MAX31855 1
709
+
710
+    #define TEMP_SENSOR_REDUNDANT_IS_MAX31855    1
711
+    #define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN -270
712
+    #define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1800
718 713
   #elif TEMP_SENSOR_REDUNDANT == -2
719 714
     #if TEMP_SENSOR_REDUNDANT_SOURCE != 0 && TEMP_SENSOR_REDUNDANT_SOURCE != 1
720 715
       #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
721 716
     #endif
722
-    #define TEMP_SENSOR_REDUNDANT_IS_MAX6675 1
717
+
718
+    #define TEMP_SENSOR_REDUNDANT_IS_MAX6675     1
719
+    #define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN    0
720
+    #define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1024
723 721
   #endif
722
+
723
+  // mimic setting up the source TEMP_SENSOR
724
+  #if TEMP_SENSOR_REDUNDANT_SOURCE == 0
725
+    #define TEMP_SENSOR_0_MAX_TC_TMIN TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN
726
+    #define TEMP_SENSOR_0_MAX_TC_TMAX TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX
727
+    #ifndef MAX31865_SENSOR_WIRES_0
728
+      #define MAX31865_SENSOR_WIRES_0 2
729
+    #endif
730
+  #elif TEMP_SENSOR_REDUNDANT_SOURCE == 1
731
+    #define TEMP_SENSOR_1_MAX_TC_TMIN TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN
732
+    #define TEMP_SENSOR_1_MAX_TC_TMAX TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX
733
+    #ifndef MAX31865_SENSOR_WIRES_1
734
+      #define MAX31865_SENSOR_WIRES_1 2
735
+    #endif
736
+  #endif
737
+
724 738
   #if (TEMP_SENSOR_0_IS_MAX_TC && TEMP_SENSOR_REDUNDANT != TEMP_SENSOR_0) || (TEMP_SENSOR_1_IS_MAX_TC && TEMP_SENSOR_REDUNDANT != TEMP_SENSOR_1)
725 739
     #if   TEMP_SENSOR_REDUNDANT == -5
726 740
       #error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match."
@@ -743,101 +757,182 @@
743 757
   #endif
744 758
 #endif
745 759
 
760
+#if TEMP_SENSOR_0_IS_MAX_TC || TEMP_SENSOR_1_IS_MAX_TC || TEMP_SENSOR_REDUNDANT_IS_MAX_TC
761
+  #define HAS_MAX_TC 1
762
+#endif
763
+#if TEMP_SENSOR_0_IS_MAX6675 || TEMP_SENSOR_1_IS_MAX6675 || TEMP_SENSOR_REDUNDANT_IS_MAX6675
764
+  #define HAS_MAX6675 1
765
+#endif
746 766
 #if TEMP_SENSOR_0_IS_MAX31855 || TEMP_SENSOR_1_IS_MAX31855 || TEMP_SENSOR_REDUNDANT_IS_MAX31855
747 767
   #define HAS_MAX31855 1
748 768
 #endif
749 769
 #if TEMP_SENSOR_0_IS_MAX31865 || TEMP_SENSOR_1_IS_MAX31865 || TEMP_SENSOR_REDUNDANT_IS_MAX31865
750 770
   #define HAS_MAX31865 1
751 771
 #endif
752
-#if TEMP_SENSOR_0_IS_MAX6675 || TEMP_SENSOR_1_IS_MAX6675 || TEMP_SENSOR_REDUNDANT_IS_MAX6675
753
-  #define HAS_MAX6675 1
754
-#endif
755 772
 
756 773
 //
757 774
 // Compatibility layer for MAX (SPI) temp boards
758 775
 //
759
-#define TEMP_SENSOR_IS_MAX(n, M) (ENABLED(TEMP_SENSOR_##n##_IS_##M) || (ENABLED(TEMP_SENSOR_REDUNDANT_IS_##M) && TEMP_SENSOR_REDUNDANT_SOURCE == (n)))
776
+#if HAS_MAX_TC
777
+
778
+  // Translate old _SS, _CS, _SCK, _DO, _DI, _MISO, and _MOSI PIN defines.
779
+  #if TEMP_SENSOR_0_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 1)
780
+
781
+    #if !PIN_EXISTS(TEMP_0_CS) // SS, CS
782
+      #if PIN_EXISTS(MAX6675_SS)
783
+        #define TEMP_0_CS_PIN MAX6675_SS_PIN
784
+      #elif PIN_EXISTS(MAX6675_CS)
785
+        #define TEMP_0_CS_PIN MAX6675_CS_PIN
786
+      #elif PIN_EXISTS(MAX31855_SS)
787
+        #define TEMP_0_CS_PIN MAX31855_SS_PIN
788
+      #elif PIN_EXISTS(MAX31855_CS)
789
+        #define TEMP_0_CS_PIN MAX31855_CS_PIN
790
+      #elif PIN_EXISTS(MAX31865_SS)
791
+        #define TEMP_0_CS_PIN MAX31865_SS_PIN
792
+      #elif PIN_EXISTS(MAX31865_CS)
793
+        #define TEMP_0_CS_PIN MAX31865_CS_PIN
794
+      #endif
795
+    #endif
760 796
 
761
-#if PIN_EXISTS(MAX6675_SS)
762
-  #if TEMP_SENSOR_IS_MAX(0, MAX31855)
763
-    #define MAX31855_CS_PIN MAX6675_SS_PIN
764
-  #elif TEMP_SENSOR_IS_MAX(0, MAX31865)
765
-    #define MAX31865_CS_PIN MAX6675_SS_PIN
766
-  #elif TEMP_SENSOR_IS_MAX(0, MAX6675)
767
-    #define MAX6675_CS_PIN MAX6675_SS_PIN
768
-  #endif
769
-#endif
797
+    #if TEMP_SENSOR_0_IS_MAX6675
798
+      #if !PIN_EXISTS(TEMP_0_MISO) // DO
799
+        #if PIN_EXISTS(MAX6675_MISO)
800
+          #define TEMP_0_MISO_PIN MAX6675_MISO_PIN
801
+        #elif PIN_EXISTS(MAX6675_DO)
802
+          #define TEMP_0_MISO_PIN MAX6675_DO_PIN
803
+        #endif
804
+      #endif
805
+      #if !PIN_EXISTS(TEMP_0_SCK) && PIN_EXISTS(MAX6675_SCK)
806
+        #define TEMP_0_SCK_PIN MAX6675_SCK_PIN
807
+      #endif
770 808
 
771
-#if PIN_EXISTS(MAX6675_SS2)
772
-  #if TEMP_SENSOR_IS_MAX(1, MAX31855)
773
-    #define MAX31855_CS2_PIN MAX6675_SS2_PIN
774
-  #elif TEMP_SENSOR_IS_MAX(1, MAX31865)
775
-    #define MAX31865_CS2_PIN MAX6675_SS2_PIN
776
-  #elif TEMP_SENSOR_IS_MAX(1, MAX6675)
777
-    #define MAX6675_CS2_PIN MAX6675_SS2_PIN
778
-  #endif
779
-#endif
809
+    #elif TEMP_SENSOR_0_IS_MAX31855
810
+      #if !PIN_EXISTS(TEMP_0_MISO) // DO
811
+        #if PIN_EXISTS(MAX31855_MISO)
812
+          #define TEMP_0_MISO_PIN MAX31855_MISO_PIN
813
+        #elif PIN_EXISTS(MAX31855_DO)
814
+          #define TEMP_0_MISO_PIN MAX31855_DO_PIN
815
+        #endif
816
+      #endif
817
+      #if !PIN_EXISTS(TEMP_0_SCK) && PIN_EXISTS(MAX31855_SCK)
818
+        #define TEMP_0_SCK_PIN MAX31855_SCK_PIN
819
+      #endif
780 820
 
781
-#if PIN_EXISTS(MAX6675_DO)
782
-  #if HAS_MAX31855
783
-    #define MAX31855_MISO_PIN MAX6675_DO_PIN
784
-  #elif HAS_MAX31865
785
-    #define MAX31865_MISO_PIN MAX6675_DO_PIN
786
-  #elif HAS_MAX6675
787
-    #define MAX6675_MISO_PIN MAX6675_DO_PIN
788
-  #endif
789
-#endif
821
+    #elif TEMP_SENSOR_1_IS_MAX31865
822
+      #if !PIN_EXISTS(TEMP_1_MISO) // DO
823
+        #if PIN_EXISTS(MAX31865_MISO)
824
+          #define TEMP_1_MISO_PIN MAX31865_MISO_PIN
825
+        #elif PIN_EXISTS(MAX31865_DO)
826
+          #define TEMP_1_MISO_PIN MAX31865_DO_PIN
827
+        #endif
828
+      #endif
829
+      #if !PIN_EXISTS(TEMP_1_SCK) && PIN_EXISTS(MAX31865_SCK)
830
+        #define TEMP_1_SCK_PIN MAX31865_SCK_PIN
831
+      #endif
832
+      #if !PIN_EXISTS(TEMP_1_MOSI) && PIN_EXISTS(MAX31865_MOSI) // MOSI for '65 only
833
+        #define TEMP_1_MOSI_PIN MAX31865_MOSI_PIN
834
+      #endif
835
+    #endif
790 836
 
791
-#if PIN_EXISTS(MAX6675_SCK)
792
-  #if HAS_MAX31855
793
-    #define MAX31855_SCK_PIN MAX6675_SCK_PIN
794
-  #elif HAS_MAX31865
795
-    #define MAX31865_SCK_PIN MAX6675_SCK_PIN
796
-  #endif
797
-#endif
837
+    // Software SPI - enable if MISO/SCK are defined.
838
+    #if PIN_EXISTS(TEMP_0_MISO) && PIN_EXISTS(TEMP_0_SCK) && DISABLED(TEMP_SENSOR_0_FORCE_HW_SPI)
839
+      #if TEMP_SENSOR_0_IS_MAX31865 && !PIN_EXISTS(TEMP_0_MOSI)
840
+        #error "TEMP_SENSOR_0 MAX31865 requires TEMP_0_MOSI_PIN defined for Software SPI. To use Hardware SPI instead, undefine MISO/SCK or enable TEMP_SENSOR_0_FORCE_HW_SPI."
841
+      #else
842
+        #define TEMP_SENSOR_0_HAS_SPI_PINS 1
843
+      #endif
844
+    #endif
798 845
 
799
-// Compatibility Layer for use when HAL manipulates PINS for MAX31855 and MAX6675
800
-#if PIN_EXISTS(MAX31855_CS) && !PIN_EXISTS(MAX6675_SS)
801
-  #define MAX6675_SS_PIN MAX31855_CS_PIN
802
-#endif
803
-#if PIN_EXISTS(MAX31855_CS2) && !PIN_EXISTS(MAX6675_SS2)
804
-  #define MAX6675_SS2_PIN MAX31855_CS2_PIN
805
-#endif
806
-#if PIN_EXISTS(MAX6675_CS) && !PIN_EXISTS(MAX6675_SS)
807
-  #define MAX6675_SS_PIN MAX6675_CS_PIN
808
-#endif
809
-#if PIN_EXISTS(MAX6675_CS2) && !PIN_EXISTS(MAX6675_SS2)
810
-  #define MAX6675_SS2_PIN MAX6675_CS2_PIN
811
-#endif
812
-#if PIN_EXISTS(MAX31855_MISO) && !PIN_EXISTS(MAX6675_DO)
813
-  #define MAX6675_DO_PIN MAX31855_MISO_PIN
814
-#endif
815
-#if PIN_EXISTS(MAX6675_MISO) && !PIN_EXISTS(MAX6675_DO)
816
-  #define MAX6675_DO_PIN MAX6675_MISO_PIN
817
-#endif
818
-#if PIN_EXISTS(MAX31855_SCK) && !PIN_EXISTS(MAX6675_SCK)
819
-  #define MAX6675_SCK_PIN MAX31855_SCK_PIN
820
-#endif
846
+  #endif // TEMP_SENSOR_0_IS_MAX_TC
847
+
848
+  #if TEMP_SENSOR_1_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 1)
849
+
850
+    #if !PIN_EXISTS(TEMP_1_CS) // SS2, CS2
851
+      #if PIN_EXISTS(MAX6675_SS2)
852
+        #define TEMP_1_CS_PIN MAX6675_SS2_PIN
853
+      #elif PIN_EXISTS(MAX6675_CS)
854
+        #define TEMP_1_CS_PIN MAX6675_CS2_PIN
855
+      #elif PIN_EXISTS(MAX31855_SS2)
856
+        #define TEMP_1_CS_PIN MAX31855_SS2_PIN
857
+      #elif PIN_EXISTS(MAX31855_CS2)
858
+        #define TEMP_1_CS_PIN MAX31855_CS2_PIN
859
+      #elif PIN_EXISTS(MAX31865_SS2)
860
+        #define TEMP_1_CS_PIN MAX31865_SS2_PIN
861
+      #elif PIN_EXISTS(MAX31865_CS2)
862
+        #define TEMP_1_CS_PIN MAX31865_CS2_PIN
863
+      #endif
864
+    #endif
821 865
 
822
-//
823
-// User-defined thermocouple libraries
824
-//
825
-// Add LIB_MAX6675 / LIB_MAX31855 / LIB_MAX31865 to the build_flags
826
-// to select a USER library for MAX6675, MAX31855, MAX31865
827
-//
828
-#if BOTH(HAS_MAX6675, LIB_MAX6675)
829
-  #define LIB_USR_MAX6675 1
830
-#endif
831
-#if BOTH(HAS_MAX31855, LIB_MAX31855)
832
-  #define LIB_USR_MAX31855 1
833
-#endif
834
-#if HAS_MAX31865
835
-  #if ENABLED(LIB_MAX31865)
866
+    #if TEMP_SENSOR_1_IS_MAX6675
867
+      #if !PIN_EXISTS(TEMP_1_MISO) // DO
868
+        #if PIN_EXISTS(MAX6675_MISO)
869
+          #define TEMP_1_MISO_PIN MAX6675_MISO_PIN
870
+        #elif PIN_EXISTS(MAX6675_DO)
871
+          #define TEMP_1_MISO_PIN MAX6675_DO_PIN
872
+        #endif
873
+      #endif
874
+      #if !PIN_EXISTS(TEMP_1_SCK) && PIN_EXISTS(MAX6675_SCK)
875
+        #define TEMP_1_SCK_PIN MAX6675_SCK_PIN
876
+      #endif
877
+
878
+    #elif TEMP_SENSOR_1_IS_MAX31855
879
+      #if !PIN_EXISTS(TEMP_1_MISO) // DO
880
+        #if PIN_EXISTS(MAX31855_MISO)
881
+          #define TEMP_1_MISO_PIN MAX31855_MISO_PIN
882
+        #elif PIN_EXISTS(MAX31855_DO)
883
+          #define TEMP_1_MISO_PIN MAX31855_DO_PIN
884
+        #endif
885
+      #endif
886
+      #if !PIN_EXISTS(TEMP_1_SCK) && PIN_EXISTS(MAX31855_SCK)
887
+        #define TEMP_1_SCK_PIN MAX31855_SCK_PIN
888
+      #endif
889
+
890
+    #elif TEMP_SENSOR_1_IS_MAX31865
891
+      #if !PIN_EXISTS(TEMP_1_MISO) // DO
892
+        #if PIN_EXISTS(MAX31865_MISO)
893
+          #define TEMP_1_MISO_PIN MAX31865_MISO_PIN
894
+        #elif PIN_EXISTS(MAX31865_DO)
895
+          #define TEMP_1_MISO_PIN MAX31865_DO_PIN
896
+        #endif
897
+      #endif
898
+      #if !PIN_EXISTS(TEMP_1_SCK) && PIN_EXISTS(MAX31865_SCK)
899
+        #define TEMP_1_SCK_PIN MAX31865_SCK_PIN
900
+      #endif
901
+      #if !PIN_EXISTS(TEMP_1_MOSI) && PIN_EXISTS(MAX31865_MOSI) // MOSI for '65 only
902
+        #define TEMP_1_MOSI_PIN MAX31865_MOSI_PIN
903
+      #endif
904
+    #endif
905
+
906
+    // Software SPI - enable if MISO/SCK are defined.
907
+    #if PIN_EXISTS(TEMP_1_MISO) && PIN_EXISTS(TEMP_1_SCK) && DISABLED(TEMP_SENSOR_1_FORCE_HW_SPI)
908
+      #if TEMP_SENSOR_1_IS_MAX31865 && !PIN_EXISTS(TEMP_1_MOSI)
909
+        #error "TEMP_SENSOR_1 MAX31865 requires TEMP_1_MOSI_PIN defined for Software SPI. To use Hardware SPI instead, undefine MISO/SCK or enable TEMP_SENSOR_1_FORCE_HW_SPI."
910
+      #else
911
+        #define TEMP_SENSOR_1_HAS_SPI_PINS 1
912
+      #endif
913
+    #endif
914
+
915
+  #endif // TEMP_SENSOR_1_IS_MAX_TC
916
+
917
+  //
918
+  // User-defined thermocouple libraries
919
+  //
920
+  // Add LIB_MAX6675 / LIB_MAX31855 / LIB_MAX31865 to the build_flags
921
+  // to select a USER library for MAX6675, MAX31855, MAX31865
922
+  //
923
+  #if BOTH(HAS_MAX6675, LIB_MAX6675)
924
+    #define LIB_USR_MAX6675 1
925
+  #endif
926
+  #if BOTH(HAS_MAX31855, LIB_MAX31855)
927
+    #define LIB_USR_MAX31855 1
928
+  #endif
929
+  #if BOTH(HAS_MAX31865, LIB_MAX31865)
836 930
     #define LIB_USR_MAX31865 1
837
-  #else
838
-    #define LIB_ADAFRUIT_MAX31865 1
931
+  #elif HAS_MAX31865
932
+    #define LIB_INTERNAL_MAX31865 1
839 933
   #endif
840
-#endif
934
+
935
+#endif //HAS_MAX_TC
841 936
 
842 937
 #if TEMP_SENSOR_2 == -4
843 938
   #define TEMP_SENSOR_2_IS_AD8495 1
@@ -2722,6 +2817,77 @@
2722 2817
   #define BED_OR_CHAMBER_OR_FAN 1
2723 2818
 #endif
2724 2819
 
2820
+/**
2821
+ * Up to 3 PWM fans
2822
+ */
2823
+#ifndef FAN_INVERTING
2824
+  #define FAN_INVERTING false
2825
+#endif
2826
+
2827
+#if HAS_FAN7
2828
+  #define FAN_COUNT 8
2829
+#elif HAS_FAN6
2830
+  #define FAN_COUNT 7
2831
+#elif HAS_FAN5
2832
+  #define FAN_COUNT 6
2833
+#elif HAS_FAN4
2834
+  #define FAN_COUNT 5
2835
+#elif HAS_FAN3
2836
+  #define FAN_COUNT 4
2837
+#elif HAS_FAN2
2838
+  #define FAN_COUNT 3
2839
+#elif HAS_FAN1
2840
+  #define FAN_COUNT 2
2841
+#elif HAS_FAN0
2842
+  #define FAN_COUNT 1
2843
+#else
2844
+  #define FAN_COUNT 0
2845
+#endif
2846
+
2847
+#if FAN_COUNT > 0
2848
+  #define HAS_FAN 1
2849
+#endif
2850
+
2851
+/**
2852
+ * Part Cooling fan multipliexer
2853
+ */
2854
+#if PIN_EXISTS(FANMUX0)
2855
+  #define HAS_FANMUX 1
2856
+#endif
2857
+
2858
+/**
2859
+ * MIN/MAX fan PWM scaling
2860
+ */
2861
+#ifndef FAN_OFF_PWM
2862
+  #define FAN_OFF_PWM 0
2863
+#endif
2864
+#ifndef FAN_MIN_PWM
2865
+  #if FAN_OFF_PWM > 0
2866
+    #define FAN_MIN_PWM (FAN_OFF_PWM + 1)
2867
+  #else
2868
+    #define FAN_MIN_PWM 0
2869
+  #endif
2870
+#endif
2871
+#ifndef FAN_MAX_PWM
2872
+  #define FAN_MAX_PWM 255
2873
+#endif
2874
+#if FAN_MIN_PWM < 0 || FAN_MIN_PWM > 255
2875
+  #error "FAN_MIN_PWM must be a value from 0 to 255."
2876
+#elif FAN_MAX_PWM < 0 || FAN_MAX_PWM > 255
2877
+  #error "FAN_MAX_PWM must be a value from 0 to 255."
2878
+#elif FAN_MIN_PWM > FAN_MAX_PWM
2879
+  #error "FAN_MIN_PWM must be less than or equal to FAN_MAX_PWM."
2880
+#elif FAN_OFF_PWM > FAN_MIN_PWM
2881
+  #error "FAN_OFF_PWM must be less than or equal to FAN_MIN_PWM."
2882
+#endif
2883
+
2884
+/**
2885
+ * FAST PWM FAN Settings
2886
+ */
2887
+#if ENABLED(FAST_PWM_FAN) && !defined(FAST_PWM_FAN_FREQUENCY)
2888
+  #define FAST_PWM_FAN_FREQUENCY ((F_CPU) / (2 * 255 * 1)) // Fan frequency default
2889
+#endif
2890
+
2725 2891
 // Servos
2726 2892
 #if PIN_EXISTS(SERVO0) && NUM_SERVOS > 0
2727 2893
   #define HAS_SERVO_0 1
@@ -2997,77 +3163,6 @@
2997 3163
 #endif
2998 3164
 
2999 3165
 /**
3000
- * Up to 3 PWM fans
3001
- */
3002
-#ifndef FAN_INVERTING
3003
-  #define FAN_INVERTING false
3004
-#endif
3005
-
3006
-#if HAS_FAN7
3007
-  #define FAN_COUNT 8
3008
-#elif HAS_FAN6
3009
-  #define FAN_COUNT 7
3010
-#elif HAS_FAN5
3011
-  #define FAN_COUNT 6
3012
-#elif HAS_FAN4
3013
-  #define FAN_COUNT 5
3014
-#elif HAS_FAN3
3015
-  #define FAN_COUNT 4
3016
-#elif HAS_FAN2
3017
-  #define FAN_COUNT 3
3018
-#elif HAS_FAN1
3019
-  #define FAN_COUNT 2
3020
-#elif HAS_FAN0
3021
-  #define FAN_COUNT 1
3022
-#else
3023
-  #define FAN_COUNT 0
3024
-#endif
3025
-
3026
-#if FAN_COUNT > 0
3027
-  #define HAS_FAN 1
3028
-#endif
3029
-
3030
-/**
3031
- * Part Cooling fan multipliexer
3032
- */
3033
-#if PIN_EXISTS(FANMUX0)
3034
-  #define HAS_FANMUX 1
3035
-#endif
3036
-
3037
-/**
3038
- * MIN/MAX fan PWM scaling
3039
- */
3040
-#ifndef FAN_OFF_PWM
3041
-  #define FAN_OFF_PWM 0
3042
-#endif
3043
-#ifndef FAN_MIN_PWM
3044
-  #if FAN_OFF_PWM > 0
3045
-    #define FAN_MIN_PWM (FAN_OFF_PWM + 1)
3046
-  #else
3047
-    #define FAN_MIN_PWM 0
3048
-  #endif
3049
-#endif
3050
-#ifndef FAN_MAX_PWM
3051
-  #define FAN_MAX_PWM 255
3052
-#endif
3053
-#if FAN_MIN_PWM < 0 || FAN_MIN_PWM > 255
3054
-  #error "FAN_MIN_PWM must be a value from 0 to 255."
3055
-#elif FAN_MAX_PWM < 0 || FAN_MAX_PWM > 255
3056
-  #error "FAN_MAX_PWM must be a value from 0 to 255."
3057
-#elif FAN_MIN_PWM > FAN_MAX_PWM
3058
-  #error "FAN_MIN_PWM must be less than or equal to FAN_MAX_PWM."
3059
-#elif FAN_OFF_PWM > FAN_MIN_PWM
3060
-  #error "FAN_OFF_PWM must be less than or equal to FAN_MIN_PWM."
3061
-#endif
3062
-
3063
-/**
3064
- * FAST PWM FAN Settings
3065
- */
3066
-#if ENABLED(FAST_PWM_FAN) && !defined(FAST_PWM_FAN_FREQUENCY)
3067
-  #define FAST_PWM_FAN_FREQUENCY ((F_CPU) / (2 * 255 * 1)) // Fan frequency default
3068
-#endif
3069
-
3070
-/**
3071 3166
  * MIN/MAX case light PWM scaling
3072 3167
  */
3073 3168
 #if ENABLED(CASE_LIGHT_ENABLE)

+ 81
- 55
Marlin/src/inc/SanityCheck.h View File

@@ -416,8 +416,19 @@
416 416
   #error "MBL_Z_STEP is now MESH_EDIT_Z_STEP."
417 417
 #elif defined(CHDK)
418 418
   #error "CHDK is now CHDK_PIN."
419
-#elif defined(MAX6675_SS) || defined(MAX6675_SS2)
420
-  #error "MAX6675_SS / MAX6675_SS2 is now MAX6675_SS_PIN / MAX6675_SS2_PIN."
419
+#elif ANY_PIN( \
420
+        MAX6675_SS, MAX6675_SS2, MAX6675_CS, MAX6675_CS2, \
421
+        MAX31855_SS, MAX31855_SS2, MAX31855_CS, MAX31855_CS2, \
422
+        MAX31865_SS, MAX31865_SS2, MAX31865_CS, MAX31865_CS2)
423
+  #warning "MAX*_SS_PIN, MAX*_SS2_PIN, MAX*_CS_PIN, and MAX*_CS2_PIN are deprecated and will be removed in a future version. Please use TEMP_0_CS_PIN/TEMP_1_CS_PIN instead."
424
+#elif ANY_PIN(MAX6675_SCK, MAX31855_SCK, MAX31865_SCK)
425
+  #warning "MAX*_SCK_PIN is deprecated and will be removed in a future version. Please use TEMP_0_SCK_PIN/TEMP_1_SCK_PIN instead."
426
+#elif ANY_PIN(MAX6675_MISO, MAX6675_DO, MAX31855_MISO, MAX31855_DO, MAX31865_MISO, MAX31865_DO)
427
+  #warning "MAX*_MISO_PIN and MAX*_DO_PIN are deprecated and will be removed in a future version. Please use TEMP_0_MISO_PIN/TEMP_1_MISO_PIN instead."
428
+#elif PIN_EXISTS(MAX31865_MOSI)
429
+  #warning "MAX31865_MOSI_PIN is deprecated and will be removed in a future version. Please use TEMP_0_MOSI_PIN/TEMP_1_MOSI_PIN instead."
430
+#elif ANY_PIN(THERMO_CS1_PIN, THERMO_CS2_PIN, THERMO_DO_PIN, THERMO_SCK_PIN)
431
+  #error "THERMO_*_PIN is now TEMP_n_CS_PIN, TEMP_n_SCK_PIN, TEMP_n_MOSI_PIN, TEMP_n_MISO_PIN."
421 432
 #elif defined(MAX31865_SENSOR_OHMS)
422 433
   #error "MAX31865_SENSOR_OHMS is now MAX31865_SENSOR_OHMS_0."
423 434
 #elif defined(MAX31865_CALIBRATION_OHMS)
@@ -1953,14 +1964,21 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
1953 1964
 #endif
1954 1965
 
1955 1966
 /**
1956
- * Pins and Sensor IDs must be set for each heater
1967
+ * Required MAX31865 settings
1957 1968
  */
1958
-#if TEMP_SENSOR_0_IS_MAX6675 && !ANY_PIN(MAX6675_SS, MAX31855_CS, MAX31865_CS, MAX6675_CS)
1959
-  #error "TEMP_SENSOR_0 -2 requires a MAX6675_SS_PIN, MAX6675_CS_PIN, MAX31855_CS_PIN, or MAX31865_CS_PIN."
1960
-#elif HAS_HOTEND && !HAS_TEMP_HOTEND && !TEMP_SENSOR_0_IS_DUMMY
1961
-  #error "TEMP_0_PIN (required for TEMP_SENSOR_0) not defined for this board."
1962
-#elif EITHER(HAS_MULTI_HOTEND, HEATERS_PARALLEL) && !HAS_HEATER_1
1963
-  #error "HEATER_1_PIN is not defined. TEMP_SENSOR_1 might not be set, or the board (not EEB / EEF?) doesn't define a pin."
1969
+#if TEMP_SENSOR_0_IS_MAX31865 || (TEMP_SENSOR_REDUNDANT_IS_MAX31865 && TEMP_SENSOR_REDUNDANT_SOURCE == 0)
1970
+  #if !defined(MAX31865_SENSOR_WIRES_0) || !WITHIN(MAX31865_SENSOR_WIRES_0, 2, 4)
1971
+    #error "MAX31865_SENSOR_WIRES_0 must be defined as an integer between 2 and 4."
1972
+  #elif !defined(MAX31865_SENSOR_OHMS_0) || !defined(MAX31865_CALIBRATION_OHMS_0)
1973
+    #error "MAX31865_SENSOR_OHMS_0 and MAX31865_CALIBRATION_OHMS_0 must be set if TEMP_SENSOR_0/TEMP_SENSOR_REDUNDANT is MAX31865."
1974
+  #endif
1975
+#endif
1976
+#if TEMP_SENSOR_1_IS_MAX31865 || (TEMP_SENSOR_REDUNDANT_IS_MAX31865 && TEMP_SENSOR_REDUNDANT_SOURCE == 1)
1977
+  #if !defined(MAX31865_SENSOR_WIRES_1) || !WITHIN(MAX31865_SENSOR_WIRES_1, 2, 4)
1978
+    #error "MAX31865_SENSOR_WIRES_1 must be defined as an integer between 2 and 4."
1979
+  #elif !defined(MAX31865_SENSOR_OHMS_1) || !defined(MAX31865_CALIBRATION_OHMS_1)
1980
+    #error "MAX31865_SENSOR_OHMS_1 and MAX31865_CALIBRATION_OHMS_1 must be set if TEMP_SENSOR_1/TEMP_SENSOR_REDUNDANT is MAX31865."
1981
+  #endif
1964 1982
 #endif
1965 1983
 
1966 1984
 /**
@@ -2023,20 +2041,36 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
2023 2041
     #error "TEMP_SENSOR_REDUNDANT_TARGET can't be Cooler (-5): requires TEMP_COOLER_PIN"
2024 2042
   #endif
2025 2043
 
2026
-  #if TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 0 && !PIN_EXISTS(MAX6675_SS)
2027
-    #error "TEMP_SENSOR_REDUNDANT MAX Thermocouple with TEMP_SENSOR_REDUNDANT_SOURCE 0 requires a MAX6675_SS_PIN, MAX6675_CS_PIN, MAX31855_CS_PIN, or MAX31865_CS_PIN."
2028
-  #elif TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 1 && !PIN_EXISTS(MAX6675_SS2)
2029
-    #error "TEMP_SENSOR_REDUNDANT MAX Thermocouple with TEMP_SENSOR_REDUNDANT_SOURCE 1 requires a MAX6675_SS2_PIN, MAX6675_CS_PIN, MAX31855_CS_PIN, or MAX31865_CS_PIN."
2044
+  #if TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 0 && !PIN_EXISTS(TEMP_0_CS)
2045
+    #error "TEMP_SENSOR_REDUNDANT MAX Thermocouple with TEMP_SENSOR_REDUNDANT_SOURCE 0 requires TEMP_0_CS_PIN."
2046
+  #elif TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 1 && !PIN_EXISTS(TEMP_1_CS)
2047
+    #error "TEMP_SENSOR_REDUNDANT MAX Thermocouple with TEMP_SENSOR_REDUNDANT_SOURCE 1 requires TEMP_1_CS_PIN."
2030 2048
   #endif
2031 2049
 #endif
2032 2050
 
2051
+/**
2052
+ * Test Sensor & Heater pin combos.
2053
+ * Pins and Sensor IDs must be set for each heater
2054
+ */
2055
+#if !ANY_PIN(TEMP_0, TEMP_0_CS)
2056
+  #error "TEMP_0_PIN or TEMP_0_CS_PIN not defined for this board."
2057
+#elif !HAS_HEATER_0 && EXTRUDERS
2058
+  #error "HEATER_0_PIN not defined for this board."
2059
+#elif TEMP_SENSOR_0_IS_MAX_TC && !PIN_EXISTS(TEMP_0_CS)
2060
+  #error "TEMP_SENSOR_0 MAX thermocouple requires TEMP_0_CS_PIN."
2061
+#elif HAS_HOTEND && !HAS_TEMP_HOTEND && !TEMP_SENSOR_0_IS_DUMMY
2062
+  #error "TEMP_0_PIN (required for TEMP_SENSOR_0) not defined for this board."
2063
+#elif EITHER(HAS_MULTI_HOTEND, HEATERS_PARALLEL) && !HAS_HEATER_1
2064
+  #error "HEATER_1_PIN is not defined. TEMP_SENSOR_1 might not be set, or the board (not EEB / EEF?) doesn't define a pin."
2065
+#endif
2066
+
2033 2067
 #if HAS_MULTI_HOTEND
2034
-  #if TEMP_SENSOR_1_IS_MAX6675 && !ANY_PIN(MAX6675_SS2, MAX31855_CS2, MAX31865_CS2, MAX6675_CS2)
2035
-    #error "TEMP_SENSOR_1 requires a MAX6675_SS2_PIN, MAX6675_CS2_PIN, MAX31855_CS2_PIN, or MAX31865_CS2_PIN."
2068
+  #if TEMP_SENSOR_1_IS_MAX_TC && !PIN_EXISTS(TEMP_1_CS)
2069
+    #error "TEMP_SENSOR_1 MAX thermocouple requires TEMP_1_CS_PIN."
2036 2070
   #elif TEMP_SENSOR_1 == 0
2037 2071
     #error "TEMP_SENSOR_1 is required with 2 or more HOTENDS."
2038
-  #elif !ANY_PIN(TEMP_1, MAX6675_SS2) && !TEMP_SENSOR_1_IS_DUMMY
2039
-    #error "TEMP_1_PIN or MAX6675_SS2_PIN not defined for this board."
2072
+  #elif !ANY_PIN(TEMP_1, TEMP_1_CS) && !TEMP_SENSOR_1_IS_DUMMY
2073
+    #error "TEMP_1_PIN or TEMP_1_CS_PIN not defined for this board."
2040 2074
   #endif
2041 2075
   #if HOTENDS > 2
2042 2076
     #if TEMP_SENSOR_2 == 0
@@ -2148,14 +2182,31 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
2148 2182
   #error "TEMP_SENSOR_6 shouldn't be set with only 1 HOTEND."
2149 2183
 #elif TEMP_SENSOR_7 != 0
2150 2184
   #error "TEMP_SENSOR_7 shouldn't be set with only 1 HOTEND."
2151
-#endif
2185
+#endif // HAS_MULTI_HOTEND
2152 2186
 
2187
+/**
2188
+ * Pins must be set for temp sensors, with some other feature requirements.
2189
+ */
2153 2190
 #if TEMP_SENSOR_CHAMBER && !PIN_EXISTS(TEMP_CHAMBER)
2154 2191
   #error "TEMP_SENSOR_CHAMBER requires TEMP_CHAMBER_PIN."
2155 2192
 #endif
2156 2193
 
2157
-#if TEMP_SENSOR_COOLER && !(PIN_EXISTS(TEMP_COOLER) && ENABLED(LASER_FEATURE))
2158
-  #error "TEMP_SENSOR_COOLER requires LASER_FEATURE and TEMP_COOLER_PIN."
2194
+#if TEMP_SENSOR_COOLER
2195
+  #if !PIN_EXISTS(TEMP_COOLER)
2196
+    #error "TEMP_SENSOR_COOLER requires TEMP_COOLER_PIN."
2197
+  #elif DISABLED(LASER_FEATURE)
2198
+    #error "TEMP_SENSOR_COOLER requires LASER_FEATURE."
2199
+  #endif
2200
+#endif
2201
+
2202
+#if TEMP_SENSOR_PROBE
2203
+  #if !PIN_EXISTS(TEMP_PROBE)
2204
+    #error "TEMP_SENSOR_PROBE requires TEMP_PROBE_PIN."
2205
+  #elif !HAS_TEMP_ADC_PROBE
2206
+    #error "TEMP_PROBE_PIN must be an ADC pin."
2207
+  #elif DISABLED(FIX_MOUNTED_PROBE)
2208
+    #error "TEMP_SENSOR_PROBE shouldn't be set without FIX_MOUNTED_PROBE."
2209
+  #endif
2159 2210
 #endif
2160 2211
 
2161 2212
 #if ENABLED(LASER_COOLANT_FLOW_METER) && !(PIN_EXISTS(FLOWMETER) && ENABLED(LASER_FEATURE))
@@ -2186,41 +2237,6 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
2186 2237
   #endif
2187 2238
 #endif
2188 2239
 
2189
-#if TEMP_SENSOR_PROBE
2190
-  #if !PIN_EXISTS(TEMP_PROBE)
2191
-    #error "TEMP_SENSOR_PROBE requires TEMP_PROBE_PIN."
2192
-  #elif !HAS_TEMP_ADC_PROBE
2193
-    #error "TEMP_PROBE_PIN must be an ADC pin."
2194
-  #elif DISABLED(FIX_MOUNTED_PROBE)
2195
-    #error "TEMP_SENSOR_PROBE shouldn't be set without FIX_MOUNTED_PROBE."
2196
-  #endif
2197
-#endif
2198
-
2199
-#if TEMP_SENSOR_IS_MAX(0, MAX31865) && !(defined(MAX31865_SENSOR_OHMS_0) && defined(MAX31865_CALIBRATION_OHMS_0))
2200
-  #error "MAX31865_SENSOR_OHMS_0 and MAX31865_CALIBRATION_OHMS_0 must be set if TEMP_SENSOR_0/TEMP_SENSOR_REDUNDANT is MAX31865."
2201
-#elif TEMP_SENSOR_IS_MAX(1, MAX31865) && !(defined(MAX31865_SENSOR_OHMS_1) && defined(MAX31865_CALIBRATION_OHMS_1))
2202
-  #error "MAX31865_SENSOR_OHMS_1 and MAX31865_CALIBRATION_OHMS_1 must be set if TEMP_SENSOR_1/TEMP_SENSOR_REDUNDANT is MAX31865."
2203
-#endif
2204
-
2205
-/**
2206
- * Test Heater, Temp Sensor, and Extruder Pins
2207
- */
2208
-#if !HAS_HEATER_0 && EXTRUDERS
2209
-  #error "HEATER_0_PIN not defined for this board."
2210
-#elif !ANY_PIN(TEMP_0, MAX6675_SS)
2211
-  #error "TEMP_0_PIN or MAX6675_SS not defined for this board."
2212
-#endif
2213
-
2214
-#if HAS_EXTRUDERS
2215
-  #if ((defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && !PINS_EXIST(E0_STEP, E0_DIR))
2216
-    #error "E0_STEP_PIN or E0_DIR_PIN not defined for this board."
2217
-  #elif ( !(defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && (!PINS_EXIST(E0_STEP, E0_DIR) || !HAS_E0_ENABLE))
2218
-    #error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board."
2219
-  #elif EXTRUDERS && TEMP_SENSOR_0 == 0
2220
-    #error "TEMP_SENSOR_0 is required if there are any extruders."
2221
-  #endif
2222
-#endif
2223
-
2224 2240
 /**
2225 2241
  * Temperature status LEDs
2226 2242
  */
@@ -2262,6 +2278,16 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
2262 2278
 /**
2263 2279
  * Test Extruder Stepper Pins
2264 2280
  */
2281
+#if HAS_EXTRUDERS
2282
+  #if ((defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && !PINS_EXIST(E0_STEP, E0_DIR))
2283
+    #error "E0_STEP_PIN or E0_DIR_PIN not defined for this board."
2284
+  #elif ( !(defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && (!PINS_EXIST(E0_STEP, E0_DIR) || !HAS_E0_ENABLE))
2285
+    #error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board."
2286
+  #elif EXTRUDERS && TEMP_SENSOR_0 == 0
2287
+    #error "TEMP_SENSOR_0 is required if there are any extruders."
2288
+  #endif
2289
+#endif
2290
+
2265 2291
 #if E_STEPPERS
2266 2292
   #if !(PINS_EXIST(E0_STEP, E0_DIR) && HAS_E0_ENABLE)
2267 2293
     #error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board."

+ 500
- 0
Marlin/src/libs/MAX31865.cpp View File

@@ -0,0 +1,500 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+/**
24
+ * Based on Based on Adafruit MAX31865 library:
25
+ *
26
+ * This is a library for the Adafruit PT100/P1000 RTD Sensor w/MAX31865
27
+ * Designed specifically to work with the Adafruit RTD Sensor
28
+ * https://www.adafruit.com/products/3328
29
+ *
30
+ * This sensor uses SPI to communicate, 4 pins are required to interface.
31
+ *
32
+ * Adafruit invests time and resources providing this open source code,
33
+ * please support Adafruit and open-source hardware by purchasing
34
+ * products from Adafruit!
35
+ *
36
+ * Written by Limor Fried/Ladyada for Adafruit Industries.
37
+ *
38
+ * Modifications by JoAnn Manges (@GadgetAngel)
39
+ * Copyright (c) 2020, JoAnn Manges
40
+ * All rights reserved.
41
+ */
42
+
43
+// Useful for RTD debugging.
44
+//#define MAX31865_DEBUG
45
+//#define MAX31865_DEBUG_SPI
46
+
47
+//TODO: switch to SPIclass/SoftSPI
48
+
49
+#include "../inc/MarlinConfig.h"
50
+
51
+#if HAS_MAX31865 && !LIB_USR_MAX31865
52
+
53
+#include "MAX31865.h"
54
+
55
+// The maximum speed the MAX31865 can do is 5 MHz
56
+SPISettings MAX31865::spiConfig = SPISettings(
57
+  #if defined(TARGET_LPC1768)
58
+    SPI_QUARTER_SPEED
59
+  #elif defined(ARDUINO_ARCH_STM32)
60
+    SPI_CLOCK_DIV4
61
+  #else
62
+    500000
63
+  #endif
64
+  , MSBFIRST
65
+  , SPI_MODE_1 // CPOL0 CPHA1
66
+);
67
+
68
+#ifndef LARGE_PINMAP
69
+
70
+  /**
71
+   * Create the interface object using software (bitbang) SPI for PIN values
72
+   * less than or equal to 127.
73
+   *
74
+   * @param spi_cs    the SPI CS pin to use
75
+   * @param spi_mosi  the SPI MOSI pin to use
76
+   * @param spi_miso  the SPI MISO pin to use
77
+   * @param spi_clk   the SPI clock pin to use
78
+  */
79
+  MAX31865::MAX31865(int8_t spi_cs, int8_t spi_mosi, int8_t spi_miso, int8_t spi_clk) {
80
+    _cs = spi_cs;
81
+    _mosi = spi_mosi;
82
+    _miso = spi_miso;
83
+    _sclk = spi_clk;
84
+  }
85
+
86
+  /**
87
+   * Create the interface object using hardware SPI for PIN for PIN values less
88
+   * than or equal to 127.
89
+   *
90
+   * @param spi_cs  the SPI CS pin to use along with the default SPI device
91
+   */
92
+  MAX31865::MAX31865(int8_t spi_cs) {
93
+    _cs = spi_cs;
94
+    _sclk = _miso = _mosi = -1;
95
+  }
96
+
97
+#else
98
+
99
+  /**
100
+   * Create the interface object using software (bitbang) SPI for PIN values
101
+   * which are larger than 127. If you have PIN values less than or equal to
102
+   * 127 use the other call for SW SPI.
103
+   *
104
+   * @param spi_cs       the SPI CS pin to use
105
+   * @param spi_mosi     the SPI MOSI pin to use
106
+   * @param spi_miso     the SPI MISO pin to use
107
+   * @param spi_clk      the SPI clock pin to use
108
+   * @param pin_mapping  set to 1 for positive pin values
109
+   */
110
+  MAX31865::MAX31865(uint32_t spi_cs, uint32_t spi_mosi,
111
+                     uint32_t spi_miso, uint32_t spi_clk,
112
+                     uint8_t pin_mapping) {
113
+    _cs = spi_cs;
114
+    _mosi = spi_mosi;
115
+    _miso = spi_miso;
116
+    _sclk = spi_clk;
117
+  }
118
+
119
+  /**
120
+   * Create the interface object using hardware SPI for PIN values which are
121
+   * larger than 127. If you have PIN values less than or equal to 127 use
122
+   * the other call for HW SPI.
123
+   *
124
+   * @param spi_cs       the SPI CS pin to use along with the default SPI device
125
+   * @param pin_mapping  set to 1 for positive pin values
126
+   */
127
+  MAX31865::MAX31865(uint32_t spi_cs, uint8_t pin_mapping) {
128
+    _cs = spi_cs;
129
+    _sclk = _miso = _mosi = -1UL;  //-1UL or 0xFFFFFFFF or 4294967295
130
+  }
131
+
132
+#endif // LARGE_PINMAP
133
+
134
+
135
+/**
136
+ *
137
+ * Instance & Class methods
138
+ *
139
+ */
140
+
141
+
142
+/**
143
+ * Initialize the SPI interface and set the number of RTD wires used
144
+ *
145
+ * @param wires  The number of wires in enum format. Can be MAX31865_2WIRE, MAX31865_3WIRE, or MAX31865_4WIRE.
146
+ * @param zero   The resistance of the RTD at 0 degC, in ohms.
147
+ * @param ref    The resistance of the reference resistor, in ohms.
148
+ */
149
+void MAX31865::begin(max31865_numwires_t wires, float zero, float ref) {
150
+  Rzero = zero;
151
+  Rref = ref;
152
+
153
+  OUT_WRITE(_cs, HIGH);
154
+
155
+  if (_sclk != TERN(LARGE_PINMAP, -1UL, -1)) {
156
+    // define pin modes for Software SPI
157
+    #ifdef MAX31865_DEBUG
158
+      SERIAL_ECHOLN("Initializing MAX31865 Software SPI");
159
+    #endif
160
+
161
+    OUT_WRITE(_sclk, LOW);
162
+    SET_OUTPUT(_mosi);
163
+    SET_INPUT(_miso);
164
+  } else {
165
+    // start and configure hardware SPI
166
+    #ifdef MAX31865_DEBUG
167
+      SERIAL_ECHOLN("Initializing MAX31865 Hardware SPI");
168
+    #endif
169
+
170
+    SPI.begin();
171
+  }
172
+
173
+  setWires(wires);
174
+  enableBias(false);
175
+  autoConvert(false);
176
+  clearFault();
177
+
178
+  #ifdef MAX31865_DEBUG_SPI
179
+    #ifndef LARGE_PINMAP
180
+      SERIAL_ECHOLNPAIR(
181
+        "Regular begin call with _cs: ", _cs,
182
+        " _miso: ", _miso,
183
+        " _sclk: ", _sclk,
184
+        " _mosi: ", _mosi
185
+      );
186
+    #else
187
+      SERIAL_ECHOLNPAIR(
188
+        "LARGE_PINMAP begin call with _cs: ", _cs,
189
+        " _miso: ", _miso,
190
+        " _sclk: ", _sclk,
191
+        " _mosi: ", _mosi
192
+      );
193
+    #endif // LARGE_PINMAP
194
+
195
+    SERIAL_ECHOLNPAIR("config: ", readRegister8(MAX31856_CONFIG_REG));
196
+    SERIAL_EOL();
197
+  #endif // MAX31865_DEBUG_SPI
198
+}
199
+
200
+/**
201
+ * Read the raw 8-bit FAULTSTAT register
202
+ *
203
+ * @return The raw unsigned 8-bit FAULT status register
204
+ */
205
+uint8_t MAX31865::readFault() {
206
+  return readRegister8(MAX31856_FAULTSTAT_REG);
207
+}
208
+
209
+/**
210
+ * Clear all faults in FAULTSTAT.
211
+ */
212
+void MAX31865::clearFault() {
213
+  setConfig(MAX31856_CONFIG_FAULTSTAT, 1);
214
+}
215
+
216
+/**
217
+ * Whether we want to have continuous conversions (50/60 Hz)
218
+ *
219
+ * @param b  If true, auto conversion is enabled
220
+ */
221
+void MAX31865::autoConvert(bool b) {
222
+  setConfig(MAX31856_CONFIG_MODEAUTO, b);
223
+}
224
+
225
+/**
226
+ * Whether we want filter out 50Hz noise or 60Hz noise
227
+ *
228
+ * @param b  If true, 50Hz noise is filtered, else 60Hz(default)
229
+ */
230
+void MAX31865::enable50HzFilter(bool b) {
231
+  setConfig(MAX31856_CONFIG_FILT50HZ, b);
232
+}
233
+
234
+/**
235
+ * Enable the bias voltage on the RTD sensor
236
+ *
237
+ * @param b  If true bias is enabled, else disabled
238
+ */
239
+void MAX31865::enableBias(bool b) {
240
+  setConfig(MAX31856_CONFIG_BIAS, b);
241
+
242
+  // From the datasheet:
243
+  // Note that if VBIAS is off (to reduce supply current between conversions), any filter
244
+  // capacitors at the RTDIN inputs need to charge before an accurate conversion can be
245
+  // performed. Therefore, enable VBIAS and wait at least 10.5 time constants of the input
246
+  // RC network plus an additional 1ms before initiating the conversion.
247
+  if (b)
248
+    DELAY_US(11500); //11.5ms
249
+}
250
+
251
+/**
252
+ * Start a one-shot temperature reading.
253
+ */
254
+void MAX31865::oneShot() {
255
+  setConfig(MAX31856_CONFIG_1SHOT, 1);
256
+
257
+  // From the datasheet:
258
+  // Note that a single conversion requires approximately 52ms in 60Hz filter
259
+  // mode or 62.5ms in 50Hz filter mode to complete. 1-Shot is a self-clearing bit.
260
+  // TODO: switch this out depeding on the filter mode.
261
+  DELAY_US(65000); // 65ms
262
+}
263
+
264
+/**
265
+ * How many wires we have in our RTD setup, can be MAX31865_2WIRE,
266
+ * MAX31865_3WIRE, or MAX31865_4WIRE
267
+ *
268
+ * @param wires The number of wires in enum format
269
+ */
270
+void MAX31865::setWires(max31865_numwires_t wires) {
271
+  uint8_t t = readRegister8(MAX31856_CONFIG_REG);
272
+  if (wires == MAX31865_3WIRE)
273
+    t |= MAX31856_CONFIG_3WIRE;
274
+  else // 2 or 4 wire
275
+    t &= ~MAX31856_CONFIG_3WIRE;
276
+  writeRegister8(MAX31856_CONFIG_REG, t);
277
+}
278
+
279
+/**
280
+ * Read the raw 16-bit value from the RTD_REG in one shot mode. This will include
281
+ * the fault bit, D0.
282
+ *
283
+ * @return The raw unsigned 16-bit register value with ERROR bit attached, NOT temperature!
284
+ */
285
+uint16_t MAX31865::readRaw() {
286
+  clearFault();
287
+  enableBias(true);
288
+
289
+  oneShot();
290
+  uint16_t rtd = readRegister16(MAX31856_RTDMSB_REG);
291
+
292
+  #ifdef MAX31865_DEBUG
293
+    SERIAL_ECHOLNPAIR("RTD MSB:", (rtd >> 8), "  RTD LSB:", (rtd & 0x00FF));
294
+  #endif
295
+
296
+  // Disable the bias to lower power dissipation between reads.
297
+  // If the ref resistor heats up, the temperature reading will be skewed.
298
+  enableBias(false);
299
+
300
+  return rtd;
301
+}
302
+
303
+/**
304
+ * Calulate and return the resistance value of the connected RTD.
305
+ *
306
+ * @param  refResistor The value of the matching reference resistor, usually 430 or 4300
307
+ * @return             The raw RTD resistance value, NOT temperature!
308
+ */
309
+float MAX31865::readResistance() {
310
+  // Strip the error bit (D0) and convert to a float ratio.
311
+  // less precise method: (readRaw() * Rref) >> 16
312
+  return (((readRaw() >> 1) / 32768.0f) * Rref);
313
+}
314
+
315
+/**
316
+ * Read the RTD and pass it to temperature(float) for calculation.
317
+ *
318
+ * @return  Temperature in C
319
+ */
320
+float MAX31865::temperature() {
321
+  return temperature(readResistance());
322
+}
323
+
324
+/**
325
+ * Given the 15-bit ADC value, calculate the resistance and pass it to temperature(float) for calculation.
326
+ *
327
+ * @return  Temperature in C
328
+ */
329
+float MAX31865::temperature(uint16_t adcVal) {
330
+  return temperature(((adcVal) / 32768.0f) * Rref);
331
+}
332
+
333
+/**
334
+ * Calculate the temperature in C from the RTD resistance.
335
+ * Uses the technique outlined in this PDF:
336
+ * http://www.analog.com/media/en/technical-documentation/application-notes/AN709_0.pdf
337
+ *
338
+ * @param    Rrtd  the resistance value in ohms
339
+ * @return         the temperature in degC
340
+ */
341
+float MAX31865::temperature(float Rrtd) {
342
+  float temp = (RTD_Z1 + sqrt(RTD_Z2 + (RTD_Z3 * Rrtd))) / RTD_Z4;
343
+
344
+  // From the PDF...
345
+  //
346
+  // The previous equation is valid only for temperatures of 0°C and above.
347
+  // The equation for RRTD(t) that defines negative temperature behavior is a
348
+  // fourth-order polynomial (after expanding the third term) and is quite
349
+  // impractical to solve for a single expression of temperature as a function
350
+  // of resistance.
351
+  //
352
+  if (temp < 0) {
353
+    Rrtd = (Rrtd / Rzero) * 100; // normalize to 100 ohm
354
+    float rpoly = Rrtd;
355
+
356
+    temp = -242.02 + (2.2228 * rpoly);
357
+    rpoly *= Rrtd; // square
358
+    temp += 2.5859e-3 * rpoly;
359
+    rpoly *= Rrtd; // ^3
360
+    temp -= 4.8260e-6 * rpoly;
361
+    rpoly *= Rrtd; // ^4
362
+    temp -= 2.8183e-8 * rpoly;
363
+    rpoly *= Rrtd; // ^5
364
+    temp += 1.5243e-10 * rpoly;
365
+  }
366
+
367
+  return temp;
368
+}
369
+
370
+//
371
+// private:
372
+//
373
+
374
+
375
+/**
376
+ * Set a value in the configuration register.
377
+ *
378
+ * @param config  8-bit value for the config item
379
+ * @param enable  whether to enable or disable the value
380
+ */
381
+void MAX31865::setConfig(uint8_t config, bool enable) {
382
+  uint8_t t = readRegister8(MAX31856_CONFIG_REG);
383
+  if (enable)
384
+    t |= config;
385
+  else
386
+    t &= ~config; // disable
387
+  writeRegister8(MAX31856_CONFIG_REG, t);
388
+}
389
+
390
+/**
391
+ * Read a single byte from the specified register address.
392
+ *
393
+ * @param  addr  the register address
394
+ * @return       the register contents
395
+ */
396
+uint8_t MAX31865::readRegister8(uint8_t addr) {
397
+  uint8_t ret = 0;
398
+  readRegisterN(addr, &ret, 1);
399
+
400
+  return ret;
401
+}
402
+
403
+/**
404
+ * Read two bytes: 1 from the specified register address, and 1 from the next address.
405
+ *
406
+ * @param  addr  the first register address
407
+ * @return       both register contents as a single 16-bit int
408
+ */
409
+uint16_t MAX31865::readRegister16(uint8_t addr) {
410
+  uint8_t buffer[2] = {0, 0};
411
+  readRegisterN(addr, buffer, 2);
412
+
413
+  uint16_t ret = buffer[0];
414
+  ret <<= 8;
415
+  ret |= buffer[1];
416
+
417
+  return ret;
418
+}
419
+
420
+/**
421
+ * Read +n+ bytes from a specified address into +buffer+. Set D7 to 0 to specify a read.
422
+ *
423
+ * @param addr    the first register address
424
+ * @param buffer  storage for the read bytes
425
+ * @param n       the number of bytes to read
426
+ */
427
+void MAX31865::readRegisterN(uint8_t addr, uint8_t buffer[], uint8_t n) {
428
+  addr &= 0x7F; // make sure top bit is not set
429
+  if (_sclk == TERN(LARGE_PINMAP, -1UL, -1))
430
+    SPI.beginTransaction(spiConfig);
431
+  else
432
+    WRITE(_sclk, LOW);
433
+
434
+  WRITE(_cs, LOW);
435
+  spixfer(addr);
436
+
437
+  while (n--) {
438
+    buffer[0] = spixfer(0xFF);
439
+    #ifdef MAX31865_DEBUG_SPI
440
+      SERIAL_ECHOLNPAIR("buffer read ", n, " data: ", buffer[0]);
441
+    #endif
442
+    buffer++;
443
+  }
444
+
445
+  if (_sclk == TERN(LARGE_PINMAP, -1UL, -1))
446
+    SPI.endTransaction();
447
+
448
+  WRITE(_cs, HIGH);
449
+}
450
+
451
+/**
452
+ * Write an 8-bit value to a register. Set D7 to 1 to specify a write.
453
+ *
454
+ * @param addr  the address to write to
455
+ * @param data  the data to write
456
+ */
457
+void MAX31865::writeRegister8(uint8_t addr, uint8_t data) {
458
+  if (_sclk == TERN(LARGE_PINMAP, -1UL, -1))
459
+    SPI.beginTransaction(spiConfig);
460
+  else
461
+    WRITE(_sclk, LOW);
462
+
463
+  WRITE(_cs, LOW);
464
+
465
+  spixfer(addr | 0x80); // make sure top bit is set
466
+  spixfer(data);
467
+
468
+  if (_sclk == TERN(LARGE_PINMAP, -1UL, -1))
469
+    SPI.endTransaction();
470
+
471
+  WRITE(_cs, HIGH);
472
+}
473
+
474
+/**
475
+ * Transfer SPI data +x+ and read the response. From the datasheet...
476
+ * Input data (SDI) is latched on the internal strobe edge and output data (SDO) is
477
+ * shifted out on the shift edge. There is one clock for each bit transferred.
478
+ * Address and data bits are transferred in groups of eight, MSB first.
479
+ *
480
+ * @param  x  an 8-bit chunk of data to write
481
+ * @return    the 8-bit response
482
+ */
483
+uint8_t MAX31865::spixfer(uint8_t x) {
484
+  if (_sclk == TERN(LARGE_PINMAP, -1UL, -1))
485
+    return SPI.transfer(x);
486
+
487
+  uint8_t reply = 0;
488
+  for (int i = 7; i >= 0; i--) {
489
+    reply <<= 1;
490
+    WRITE(_sclk, HIGH);
491
+    WRITE(_mosi, x & (1 << i));
492
+    WRITE(_sclk, LOW);
493
+    if (READ(_miso))
494
+      reply |= 1;
495
+  }
496
+
497
+  return reply;
498
+}
499
+
500
+#endif // HAS_MAX31865 && !LIB_USR_MAX31865

+ 131
- 0
Marlin/src/libs/MAX31865.h View File

@@ -0,0 +1,131 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+/**
24
+ * Based on Adafruit MAX31865 library:
25
+ *
26
+ * This is a library for the Adafruit PT100/P1000 RTD Sensor w/MAX31865
27
+ * Designed specifically to work with the Adafruit RTD Sensor
28
+ * https://www.adafruit.com/products/3328
29
+ *
30
+ * This sensor uses SPI to communicate, 4 pins are required to interface.
31
+ *
32
+ * Adafruit invests time and resources providing this open source code,
33
+ * please support Adafruit and open-source hardware by purchasing
34
+ * products from Adafruit!
35
+ *
36
+ * Written by Limor Fried/Ladyada for Adafruit Industries.
37
+ *
38
+ * Modifications by JoAnn Manges (@GadgetAngel)
39
+ * Copyright (c) 2020, JoAnn Manges
40
+ * All rights reserved.
41
+ */
42
+#pragma once
43
+
44
+#include "../inc/MarlinConfig.h"
45
+#include "../HAL/shared/Delay.h"
46
+#include HAL_PATH(../HAL, MarlinSPI.h)
47
+
48
+#define MAX31856_CONFIG_REG 0x00
49
+#define MAX31856_CONFIG_BIAS 0x80
50
+#define MAX31856_CONFIG_MODEAUTO 0x40
51
+#define MAX31856_CONFIG_MODEOFF 0x00
52
+#define MAX31856_CONFIG_1SHOT 0x20
53
+#define MAX31856_CONFIG_3WIRE 0x10
54
+#define MAX31856_CONFIG_24WIRE 0x00
55
+#define MAX31856_CONFIG_FAULTSTAT 0x02
56
+#define MAX31856_CONFIG_FILT50HZ 0x01
57
+#define MAX31856_CONFIG_FILT60HZ 0x00
58
+
59
+#define MAX31856_RTDMSB_REG 0x01
60
+#define MAX31856_RTDLSB_REG 0x02
61
+#define MAX31856_HFAULTMSB_REG 0x03
62
+#define MAX31856_HFAULTLSB_REG 0x04
63
+#define MAX31856_LFAULTMSB_REG 0x05
64
+#define MAX31856_LFAULTLSB_REG 0x06
65
+#define MAX31856_FAULTSTAT_REG 0x07
66
+
67
+#define MAX31865_FAULT_HIGHTHRESH 0x80  // D7
68
+#define MAX31865_FAULT_LOWTHRESH 0x40   // D6
69
+#define MAX31865_FAULT_REFINLOW 0x20    // D5
70
+#define MAX31865_FAULT_REFINHIGH 0x10   // D4
71
+#define MAX31865_FAULT_RTDINLOW 0x08    // D3
72
+#define MAX31865_FAULT_OVUV 0x04        // D2
73
+
74
+// http://www.analog.com/media/en/technical-documentation/application-notes/AN709_0.pdf
75
+// constants for calulating temperature from the measured RTD resistance.
76
+#define RTD_Z1 -0.0039083
77
+#define RTD_Z2 0.00001758480889
78
+#define RTD_Z3 -0.0000000231
79
+#define RTD_Z4 -0.000001155
80
+
81
+typedef enum max31865_numwires {
82
+  MAX31865_2WIRE = 0,
83
+  MAX31865_3WIRE = 1,
84
+  MAX31865_4WIRE = 0
85
+} max31865_numwires_t;
86
+
87
+/* Interface class for the MAX31865 RTD Sensor reader */
88
+class MAX31865 {
89
+private:
90
+  static SPISettings spiConfig;
91
+
92
+  TERN(LARGE_PINMAP, uint32_t, uint8_t) _sclk, _miso, _mosi, _cs;
93
+  float Rzero, Rref;
94
+
95
+  void setConfig(uint8_t config, bool enable);
96
+
97
+  void readRegisterN(uint8_t addr, uint8_t buffer[], uint8_t n);
98
+  uint8_t readRegister8(uint8_t addr);
99
+  uint16_t readRegister16(uint8_t addr);
100
+
101
+  void writeRegister8(uint8_t addr, uint8_t reg);
102
+  uint8_t spixfer(uint8_t addr);
103
+
104
+public:
105
+  #ifdef LARGE_PINMAP
106
+    MAX31865(uint32_t spi_cs, uint8_t pin_mapping);
107
+    MAX31865(uint32_t spi_cs, uint32_t spi_mosi, uint32_t spi_miso,
108
+             uint32_t spi_clk, uint8_t pin_mapping);
109
+  #else
110
+    MAX31865(int8_t spi_cs);
111
+    MAX31865(int8_t spi_cs, int8_t spi_mosi, int8_t spi_miso,
112
+             int8_t spi_clk);
113
+  #endif
114
+
115
+  void begin(max31865_numwires_t wires, float zero, float ref);
116
+
117
+  uint8_t readFault();
118
+  void clearFault();
119
+
120
+  void setWires(max31865_numwires_t wires);
121
+  void autoConvert(bool b);
122
+  void enable50HzFilter(bool b);
123
+  void enableBias(bool b);
124
+  void oneShot();
125
+
126
+  uint16_t readRaw();
127
+  float readResistance();
128
+  float temperature();
129
+  float temperature(uint16_t adcVal);
130
+  float temperature(float Rrtd);
131
+};

+ 1
- 2
Marlin/src/module/motion.cpp View File

@@ -703,8 +703,7 @@ void restore_feedrate_and_scaling() {
703 703
    * at the same positions relative to the machine.
704 704
    */
705 705
   void update_software_endstops(const AxisEnum axis
706
-    OPTARG(HAS_HOTEND_OFFSET, const uint8_t old_tool_index/*=0*/)
707
-    OPTARG(HAS_HOTEND_OFFSET, const uint8_t new_tool_index/*=0*/)
706
+    OPTARG(HAS_HOTEND_OFFSET, const uint8_t old_tool_index/*=0*/, const uint8_t new_tool_index/*=0*/)
708 707
   ) {
709 708
 
710 709
     #if ENABLED(DUAL_X_CARRIAGE)

+ 303
- 323
Marlin/src/module/temperature.cpp View File

@@ -34,6 +34,7 @@
34 34
 #include "temperature.h"
35 35
 #include "endstops.h"
36 36
 #include "planner.h"
37
+#include "printcounter.h"
37 38
 
38 39
 #if EITHER(HAS_COOLER, LASER_COOLANT_FLOW_METER)
39 40
   #include "../feature/cooler.h"
@@ -56,112 +57,56 @@
56 57
   #include "../feature/host_actions.h"
57 58
 #endif
58 59
 
59
-#define TEMP_SENSOR_IS_ANY_MAX_TC(n) (ENABLED(TEMP_SENSOR_##n##_IS_MAX_TC) || (ENABLED(TEMP_SENSOR_REDUNDANT_IS_MAX_TC) && ENABLED(TEMP_SENSOR_REDUNDANT_SOURCE) && TEMP_SENSOR_REDUNDANT_SOURCE == n))
60
+// MAX TC related macros
61
+#define TEMP_SENSOR_IS_MAX(n, M) (ENABLED(TEMP_SENSOR_##n##_IS_MAX##M) || (ENABLED(TEMP_SENSOR_REDUNDANT_IS_MAX##M) && TEMP_SENSOR_REDUNDANT_SOURCE == (n)))
62
+#define TEMP_SENSOR_IS_ANY_MAX_TC(n) (ENABLED(TEMP_SENSOR_##n##_IS_MAX_TC) || (ENABLED(TEMP_SENSOR_REDUNDANT_IS_MAX_TC) && TEMP_SENSOR_REDUNDANT_SOURCE == n))
60 63
 
61
-// LIB_MAX31855 can be added to the build_flags in platformio.ini to use a user-defined library
62
-#if LIB_USR_MAX31855
64
+// LIB_MAX6675 can be added to the build_flags in platformio.ini to use a user-defined library
65
+// If LIB_MAX6675 is not on the build_flags then raw SPI reads will be used.
66
+#if HAS_MAX6675 && LIB_USR_MAX6675
67
+  #include <max6675.h>
68
+  #define HAS_MAX6675_LIBRARY 1
69
+#endif
70
+
71
+// LIB_MAX31855 can be added to the build_flags in platformio.ini to use a user-defined library.
72
+// If LIB_MAX31855 is not on the build_flags then raw SPI reads will be used.
73
+#if HAS_MAX31855 && LIB_USR_MAX31855
63 74
   #include <Adafruit_MAX31855.h>
64
-  #if PIN_EXISTS(MAX31855_MISO) && PIN_EXISTS(MAX31855_SCK)
65
-    #define MAX31855_USES_SW_SPI 1
66
-  #endif
67
-  #if TEMP_SENSOR_IS_MAX(0, MAX31855) && PIN_EXISTS(MAX31855_CS)
68
-    #define HAS_MAX31855_TEMP 1
69
-    Adafruit_MAX31855 max31855_0 = Adafruit_MAX31855(MAX31855_CS_PIN
70
-      #if MAX31855_USES_SW_SPI
71
-        , MAX31855_MISO_PIN, MAX31855_SCK_PIN  // For software SPI also set MISO/SCK
72
-      #endif
73
-      #if ENABLED(LARGE_PINMAP)
74
-        , HIGH
75
-      #endif
76
-    );
77
-  #endif
78
-  #if TEMP_SENSOR_IS_MAX(1, MAX31855) && PIN_EXISTS(MAX31855_CS2)
79
-    #define HAS_MAX31855_TEMP 1
80
-    Adafruit_MAX31855 max31855_1 = Adafruit_MAX31855(MAX31855_CS2_PIN
81
-      #if MAX31855_USES_SW_SPI
82
-        , MAX31855_MISO_PIN, MAX31855_SCK_PIN  // For software SPI also set MISO/SCK
83
-      #endif
84
-      #if ENABLED(LARGE_PINMAP)
85
-        , HIGH
86
-      #endif
87
-    );
88
-  #endif
75
+  #define HAS_MAX31855_LIBRARY 1
76
+  typedef Adafruit_MAX31855 MAX31855;
89 77
 #endif
90 78
 
91
-// LIB_MAX31865 can be added to the build_flags in platformio.ini to use a user-defined library.
92
-// If LIB_MAX31865 is not on the build_flags then the Adafruit MAX31865 V1.1.0 library is used.
93 79
 #if HAS_MAX31865
94
-  #include <Adafruit_MAX31865.h>
95
-  #ifndef MAX31865_MOSI_PIN
96
-    #define MAX31865_MOSI_PIN SD_MOSI_PIN
97
-  #endif
98
-  #if PIN_EXISTS(MAX31865_MISO) && PIN_EXISTS(MAX31865_SCK)
99
-    #define MAX31865_USES_SW_SPI 1
100
-  #endif
101
-  #if TEMP_SENSOR_IS_MAX(0, MAX31865) && PIN_EXISTS(MAX31865_CS)
102
-    #define HAS_MAX31865_TEMP 1
103
-      Adafruit_MAX31865 max31865_0 = Adafruit_MAX31865(MAX31865_CS_PIN
104
-        #if MAX31865_USES_SW_SPI && PIN_EXISTS(MAX31865_MOSI)
105
-          , MAX31865_MOSI_PIN, MAX31865_MISO_PIN, MAX31865_SCK_PIN  // For software SPI also set MOSI/MISO/SCK
106
-        #endif
107
-        #if ENABLED(LARGE_PINMAP)
108
-          , HIGH
109
-        #endif
110
-      );
111
-  #endif
112
-  #if TEMP_SENSOR_IS_MAX(1, MAX31865) && PIN_EXISTS(MAX31865_CS2)
113
-    #define HAS_MAX31865_TEMP 1
114
-    Adafruit_MAX31865 max31865_1 = Adafruit_MAX31865(MAX31865_CS2_PIN
115
-      #if MAX31865_USES_SW_SPI && PIN_EXISTS(MAX31865_MOSI)
116
-        , MAX31865_MOSI_PIN, MAX31865_MISO_PIN, MAX31865_SCK_PIN  // For software SPI also set MOSI/MISO/SCK
117
-      #endif
118
-      #if ENABLED(LARGE_PINMAP)
119
-        , HIGH
120
-      #endif
121
-    );
80
+  #if LIB_USR_MAX31865
81
+    #include <Adafruit_MAX31865.h>
82
+    typedef Adafruit_MAX31865 MAX31865;
83
+  #else
84
+    #include "../libs/MAX31865.h"
122 85
   #endif
123 86
 #endif
124 87
 
125
-// LIB_MAX6675 can be added to the build_flags in platformio.ini to use a user-defined library
126
-#if LIB_USR_MAX6675
127
-  #include <max6675.h>
128
-  #if PIN_EXISTS(MAX6675_MISO) && PIN_EXISTS(MAX6675_SCK)
129
-    #define MAX6675_USES_SW_SPI 1
130
-  #endif
131
-  #if TEMP_SENSOR_IS_MAX(0, MAX6675) && PIN_EXISTS(MAX6675_CS)
132
-    #define HAS_MAX6675_TEMP 1
133
-    MAX6675 max6675_0 = MAX6675(MAX6675_CS_PIN
134
-      #if MAX6675_USES_SW_SPI
135
-        , MAX6675_MISO_PIN, MAX6675_SCK_PIN   // For software SPI also set MISO/SCK
136
-      #endif
137
-      #if ENABLED(LARGE_PINMAP)
138
-        , HIGH
139
-      #endif
140
-    );
141
-  #endif
142
-  #if TEMP_SENSOR_IS_MAX(1, MAX6675) && PIN_EXISTS(MAX6675_CS2)
143
-    #define HAS_MAX6675_TEMP 1
144
-    MAX6675 max6675_1 = MAX6675(MAX6675_CS2_PIN
145
-      #if MAX6675_USES_SW_SPI
146
-        , MAX6675_MISO_PIN, MAX6675_SCK_PIN   // For software SPI also set MISO/SCK
147
-      #endif
148
-      #if ENABLED(LARGE_PINMAP)
149
-        , HIGH
150
-      #endif
151
-    );
152
-  #endif
88
+#if HAS_MAX6675_LIBRARY || HAS_MAX31855_LIBRARY || HAS_MAX31865
89
+  #define HAS_MAXTC_LIBRARIES 1
153 90
 #endif
154 91
 
155
-#if !HAS_MAX6675_TEMP && !HAS_MAX31855_TEMP && !HAS_MAX31865_TEMP
156
-  #define NO_THERMO_TEMPS 1
92
+// If we have a MAX TC with SCK and MISO pins defined, it's either on a separate/dedicated Hardware
93
+// SPI bus, or some pins for Software SPI. Alternate Hardware SPI buses are not supported yet, so
94
+// your SPI options are:
95
+//
96
+//  1. Only CS pin(s) defined:                  Hardware SPI on the default bus (usually the SD card SPI).
97
+//  2. CS, MISO, and SCK pins defined:          Software SPI on a separate bus, as defined by MISO, SCK.
98
+//  3. CS, MISO, and SCK pins w/ FORCE_HW_SPI:  Hardware SPI on the default bus, ignoring MISO, SCK.
99
+//
100
+#if TEMP_SENSOR_IS_ANY_MAX_TC(0) && TEMP_SENSOR_0_HAS_SPI_PINS && DISABLED(TEMP_SENSOR_FORCE_HW_SPI)
101
+    #define TEMP_SENSOR_0_USES_SW_SPI 1
157 102
 #endif
158
-
159
-#if (TEMP_SENSOR_0_IS_MAX_TC || TEMP_SENSOR_1_IS_MAX_TC || TEMP_SENSOR_REDUNDANT_IS_MAX_TC) && PINS_EXIST(MAX6675_SCK, MAX6675_DO) && NO_THERMO_TEMPS
160
-  #define THERMO_SEPARATE_SPI 1
103
+#if TEMP_SENSOR_IS_ANY_MAX_TC(1) && TEMP_SENSOR_1_HAS_SPI_PINS && DISABLED(TEMP_SENSOR_FORCE_HW_SPI)
104
+    #define TEMP_SENSOR_1_USES_SW_SPI 1
161 105
 #endif
162 106
 
163
-#if THERMO_SEPARATE_SPI
107
+#if (TEMP_SENSOR_0_USES_SW_SPI || TEMP_SENSOR_1_USES_SW_SPI) && !HAS_MAXTC_LIBRARIES
164 108
   #include "../libs/private_spi.h"
109
+  #define HAS_MAXTC_SW_SPI 1
165 110
 #endif
166 111
 
167 112
 #if ENABLED(PID_EXTRUSION_SCALING)
@@ -172,8 +117,6 @@
172 117
   #include "../feature/babystep.h"
173 118
 #endif
174 119
 
175
-#include "printcounter.h"
176
-
177 120
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
178 121
   #include "../feature/filwidth.h"
179 122
 #endif
@@ -246,7 +189,67 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
246 189
 #define _E_PSTR(h,N) ((HOTENDS) > N && (h) == N) ? PSTR(LCD_STR_E##N) :
247 190
 #define HEATER_PSTR(h) _BED_PSTR(h) _CHAMBER_PSTR(h) _COOLER_PSTR(h) _E_PSTR(h,1) _E_PSTR(h,2) _E_PSTR(h,3) _E_PSTR(h,4) _E_PSTR(h,5) PSTR(LCD_STR_E0)
248 191
 
249
-// public:
192
+//
193
+// Initialize MAX TC objects/SPI
194
+//
195
+#if HAS_MAX_TC
196
+
197
+  #if HAS_MAXTC_SW_SPI
198
+    // Initialize SoftSPI for non-lib Software SPI; Libraries take care of it themselves.
199
+    template<uint8_t MisoPin, uint8_t MosiPin, uint8_t SckPin>
200
+      SoftSPI<MisoPin, MosiPin, SckPin> SPIclass<MisoPin, MosiPin, SckPin>::softSPI;
201
+    SPIclass<TEMP_0_MISO_PIN, TEMP_0_MOSI_PIN, TEMP_0_SCK_PIN> max_tc_spi;
202
+  #endif
203
+
204
+  #define MAXTC_INIT(n, M) \
205
+      MAX##M max##M##_##n = MAX##M( \
206
+        TEMP_##n##_CS_PIN \
207
+        OPTARG(_MAX31865_##n##_SW, TEMP_##n##_MOSI_PIN) \
208
+        OPTARG(TEMP_SENSOR_##n##_USES_SW_SPI, TEMP_##n##_MISO_PIN, TEMP_##n##_SCK_PIN) \
209
+        OPTARG(LARGE_PINMAP, HIGH) \
210
+      )
211
+
212
+  #if HAS_MAX6675_LIBRARY
213
+    #if TEMP_SENSOR_IS_MAX(0, 6675)
214
+      MAXTC_INIT(0, 6675);
215
+    #endif
216
+    #if TEMP_SENSOR_IS_MAX(1, 6675)
217
+      MAXTC_INIT(1, 6675);
218
+    #endif
219
+  #endif
220
+
221
+  #if HAS_MAX31855_LIBRARY
222
+    #if TEMP_SENSOR_IS_MAX(0, 31855)
223
+      MAXTC_INIT(0, 31855);
224
+    #endif
225
+    #if TEMP_SENSOR_IS_MAX(1, 31855)
226
+      MAXTC_INIT(1, 31855);
227
+    #endif
228
+  #endif
229
+
230
+  // MAX31865 always uses a library, unlike '55 & 6675
231
+  #if HAS_MAX31865
232
+    #define _MAX31865_0_SW TEMP_SENSOR_0_USES_SW_SPI
233
+    #define _MAX31865_1_SW TEMP_SENSOR_1_USES_SW_SPI
234
+
235
+    #if TEMP_SENSOR_IS_MAX(0, 31865)
236
+      MAXTC_INIT(0, 31865);
237
+    #endif
238
+    #if TEMP_SENSOR_IS_MAX(1, 31865)
239
+      MAXTC_INIT(1, 31865);
240
+    #endif
241
+
242
+    #undef _MAX31865_0_SW
243
+    #undef _MAX31865_1_SW
244
+  #endif
245
+
246
+  #undef MAXTC_INIT
247
+
248
+#endif
249
+
250
+/**
251
+ * public:
252
+ */
250 253
 
251 254
 #if ENABLED(NO_FAN_SLOWING_IN_PID_TUNING)
252 255
   bool Temperature::adaptive_fan_slowing = true;
@@ -274,6 +277,25 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
274 277
   uint8_t Temperature::coolerfan_speed; // = 0
275 278
 #endif
276 279
 
280
+// Init fans according to whether they're native PWM or Software PWM
281
+#ifdef BOARD_OPENDRAIN_MOSFETS
282
+  #define _INIT_SOFT_FAN(P) OUT_WRITE_OD(P, FAN_INVERTING ? LOW : HIGH)
283
+#else
284
+  #define _INIT_SOFT_FAN(P) OUT_WRITE(P, FAN_INVERTING ? LOW : HIGH)
285
+#endif
286
+#if ENABLED(FAN_SOFT_PWM)
287
+  #define _INIT_FAN_PIN(P) _INIT_SOFT_FAN(P)
288
+#else
289
+  #define _INIT_FAN_PIN(P) do{ if (PWM_PIN(P)) SET_PWM(P); else _INIT_SOFT_FAN(P); }while(0)
290
+#endif
291
+#if ENABLED(FAST_PWM_FAN)
292
+  #define SET_FAST_PWM_FREQ(P) set_pwm_frequency(P, FAST_PWM_FAN_FREQUENCY)
293
+#else
294
+  #define SET_FAST_PWM_FREQ(P) NOOP
295
+#endif
296
+#define INIT_FAN_PIN(P) do{ _INIT_FAN_PIN(P); SET_FAST_PWM_FREQ(P); }while(0)
297
+
298
+// HAS_FAN does not include CONTROLLER_FAN
277 299
 #if HAS_FAN
278 300
 
279 301
   uint8_t Temperature::fan_speed[FAN_COUNT]; // = { 0 }
@@ -419,7 +441,18 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
419 441
   celsius_t Temperature::extrude_min_temp = EXTRUDE_MINTEMP;
420 442
 #endif
421 443
 
422
-// private:
444
+#if HAS_ADC_BUTTONS
445
+  uint32_t Temperature::current_ADCKey_raw = HAL_ADC_RANGE;
446
+  uint16_t Temperature::ADCKey_count = 0;
447
+#endif
448
+
449
+#if ENABLED(PID_EXTRUSION_SCALING)
450
+  int16_t Temperature::lpq_len; // Initialized in settings.cpp
451
+#endif
452
+
453
+/**
454
+ * private:
455
+ */
423 456
 
424 457
 volatile bool Temperature::raw_temps_ready = false;
425 458
 
@@ -472,16 +505,10 @@ volatile bool Temperature::raw_temps_ready = false;
472 505
   bool Temperature::paused_for_probing;
473 506
 #endif
474 507
 
475
-// public:
476
-
477
-#if HAS_ADC_BUTTONS
478
-  uint32_t Temperature::current_ADCKey_raw = HAL_ADC_RANGE;
479
-  uint16_t Temperature::ADCKey_count = 0;
480
-#endif
481
-
482
-#if ENABLED(PID_EXTRUSION_SCALING)
483
-  int16_t Temperature::lpq_len; // Initialized in settings.cpp
484
-#endif
508
+/**
509
+ * public:
510
+ * Class and Instance Methods
511
+ */
485 512
 
486 513
 #if HAS_PID_HEATING
487 514
 
@@ -758,10 +785,6 @@ volatile bool Temperature::raw_temps_ready = false;
758 785
 
759 786
 #endif // HAS_PID_HEATING
760 787
 
761
-/**
762
- * Class and Instance Methods
763
- */
764
-
765 788
 int16_t Temperature::getHeaterPower(const heater_id_t heater_id) {
766 789
   switch (heater_id) {
767 790
     #if HAS_HEATED_BED
@@ -781,6 +804,16 @@ int16_t Temperature::getHeaterPower(const heater_id_t heater_id) {
781 804
 #define _EFANOVERLAP(A,B) _FANOVERLAP(E##A,B)
782 805
 
783 806
 #if HAS_AUTO_FAN
807
+  #if EXTRUDER_AUTO_FAN_SPEED != 255
808
+    #define INIT_E_AUTO_FAN_PIN(P) do{ if (P == FAN1_PIN || P == FAN2_PIN) { SET_PWM(P); SET_FAST_PWM_FREQ(P); } else SET_OUTPUT(P); }while(0)
809
+  #else
810
+    #define INIT_E_AUTO_FAN_PIN(P) SET_OUTPUT(P)
811
+  #endif
812
+  #if CHAMBER_AUTO_FAN_SPEED != 255
813
+    #define INIT_CHAMBER_AUTO_FAN_PIN(P) do{ if (P == FAN1_PIN || P == FAN2_PIN) { SET_PWM(P); SET_FAST_PWM_FREQ(P); } else SET_OUTPUT(P); }while(0)
814
+  #else
815
+    #define INIT_CHAMBER_AUTO_FAN_PIN(P) SET_OUTPUT(P)
816
+  #endif
784 817
 
785 818
   #define CHAMBER_FAN_INDEX HOTENDS
786 819
 
@@ -1668,11 +1701,6 @@ void Temperature::manage_heater() {
1668 1701
   }
1669 1702
 
1670 1703
   celsius_float_t Temperature::user_thermistor_to_deg_c(const uint8_t t_index, const int16_t raw) {
1671
-    //#if (MOTHERBOARD == BOARD_RAMPS_14_EFB)
1672
-    //  static uint32_t clocks_total = 0;
1673
-    //  static uint32_t calls = 0;
1674
-    //  uint32_t tcnt5 = TCNT5;
1675
-    //#endif
1676 1704
 
1677 1705
     if (!WITHIN(t_index, 0, COUNT(user_thermistor) - 1)) return 25;
1678 1706
 
@@ -1700,14 +1728,6 @@ void Temperature::manage_heater() {
1700 1728
       value += t.sh_c_coeff * cu(log_resistance);
1701 1729
     value = 1.0f / value;
1702 1730
 
1703
-    //#if (MOTHERBOARD == BOARD_RAMPS_14_EFB)
1704
-    //  int32_t clocks = TCNT5 - tcnt5;
1705
-    //  if (clocks >= 0) {
1706
-    //    clocks_total += clocks;
1707
-    //    calls++;
1708
-    //  }
1709
-    //#endif
1710
-
1711 1731
     // Return degrees C (up to 999, as the LCD only displays 3 digits)
1712 1732
     return _MIN(value + THERMISTOR_ABS_ZERO_C, 999);
1713 1733
   }
@@ -1730,7 +1750,14 @@ void Temperature::manage_heater() {
1730 1750
         #if TEMP_SENSOR_0_IS_CUSTOM
1731 1751
           return user_thermistor_to_deg_c(CTI_HOTEND_0, raw);
1732 1752
         #elif TEMP_SENSOR_0_IS_MAX_TC
1733
-          return TERN(TEMP_SENSOR_0_IS_MAX31865, max31865_0.temperature(MAX31865_SENSOR_OHMS_0, MAX31865_CALIBRATION_OHMS_0), raw * 0.25);
1753
+          #if TEMP_SENSOR_0_IS_MAX31865
1754
+            return TERN(LIB_INTERNAL_MAX31865,
1755
+              max31865_0.temperature((uint16_t)raw),
1756
+              max31865_0.temperature(MAX31865_SENSOR_OHMS_0, MAX31865_CALIBRATION_OHMS_0)
1757
+            );
1758
+          #else
1759
+            return raw * 0.25;
1760
+          #endif
1734 1761
         #elif TEMP_SENSOR_0_IS_AD595
1735 1762
           return TEMP_AD595(raw);
1736 1763
         #elif TEMP_SENSOR_0_IS_AD8495
@@ -1742,7 +1769,14 @@ void Temperature::manage_heater() {
1742 1769
         #if TEMP_SENSOR_1_IS_CUSTOM
1743 1770
           return user_thermistor_to_deg_c(CTI_HOTEND_1, raw);
1744 1771
         #elif TEMP_SENSOR_1_IS_MAX_TC
1745
-          return TERN(TEMP_SENSOR_1_IS_MAX31865, max31865_1.temperature(MAX31865_SENSOR_OHMS_1, MAX31865_CALIBRATION_OHMS_1), raw * 0.25);
1772
+          #if TEMP_SENSOR_0_IS_MAX31865
1773
+            return TERN(LIB_INTERNAL_MAX31865,
1774
+              max31865_1.temperature((uint16_t)raw),
1775
+              max31865_1.temperature(MAX31865_SENSOR_OHMS_1, MAX31865_CALIBRATION_OHMS_1)
1776
+            );
1777
+          #else
1778
+            return raw * 0.25;
1779
+          #endif
1746 1780
         #elif TEMP_SENSOR_1_IS_AD595
1747 1781
           return TEMP_AD595(raw);
1748 1782
         #elif TEMP_SENSOR_1_IS_AD8495
@@ -1901,9 +1935,9 @@ void Temperature::manage_heater() {
1901 1935
     #if TEMP_SENSOR_REDUNDANT_IS_CUSTOM
1902 1936
       return user_thermistor_to_deg_c(CTI_REDUNDANT, raw);
1903 1937
     #elif TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 0
1904
-      return TERN(TEMP_SENSOR_REDUNDANT_IS_MAX31865, max31865_0.temperature(MAX31865_SENSOR_OHMS_0, MAX31865_CALIBRATION_OHMS_0), raw * 0.25);
1938
+      return TERN(TEMP_SENSOR_REDUNDANT_IS_MAX31865, max31865_0.temperature((uint16_t)raw), raw * 0.25);
1905 1939
     #elif TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 1
1906
-      return TERN(TEMP_SENSOR_REDUNDANT_IS_MAX31865, max31865_1.temperature(MAX31865_SENSOR_OHMS_1, MAX31865_CALIBRATION_OHMS_1), raw * 0.25);
1940
+      return TERN(TEMP_SENSOR_REDUNDANT_IS_MAX31865, max31865_1.temperature((uint16_t)raw), raw * 0.25);
1907 1941
     #elif TEMP_SENSOR_REDUNDANT_IS_THERMISTOR
1908 1942
       SCAN_THERMISTOR_TABLE(TEMPTABLE_REDUNDANT, TEMPTABLE_REDUNDANT_LEN);
1909 1943
     #elif TEMP_SENSOR_REDUNDANT_IS_AD595
@@ -1936,6 +1970,7 @@ void Temperature::updateTemperaturesFromRawValues() {
1936 1970
   TERN_(TEMP_SENSOR_0_IS_MAX_TC, temp_hotend[0].raw = READ_MAX_TC(0));
1937 1971
   TERN_(TEMP_SENSOR_1_IS_MAX_TC, temp_hotend[1].raw = READ_MAX_TC(1));
1938 1972
   TERN_(TEMP_SENSOR_REDUNDANT_IS_MAX_TC, temp_redundant.raw = READ_MAX_TC(TEMP_SENSOR_REDUNDANT_SOURCE));
1973
+
1939 1974
   #if HAS_HOTEND
1940 1975
     HOTEND_LOOP() temp_hotend[e].celsius = analog_to_celsius_hotend(temp_hotend[e].raw, e);
1941 1976
   #endif
@@ -2008,40 +2043,7 @@ void Temperature::updateTemperaturesFromRawValues() {
2008 2043
     if (cutter.unitPower > 0 && COOLERCMP(temp_cooler.raw, maxtemp_raw_COOLER)) max_temp_error(H_COOLER);
2009 2044
     if (COOLERCMP(mintemp_raw_COOLER, temp_cooler.raw)) min_temp_error(H_COOLER);
2010 2045
   #endif
2011
-}
2012
-
2013
-#if THERMO_SEPARATE_SPI
2014
-  template<uint8_t MisoPin, uint8_t MosiPin, uint8_t SckPin> SoftSPI<MisoPin, MosiPin, SckPin> SPIclass<MisoPin, MosiPin, SckPin>::softSPI;
2015
-  SPIclass<MAX6675_DO_PIN, SD_MOSI_PIN, MAX6675_SCK_PIN> max_tc_spi;
2016
-#endif
2017
-
2018
-// Init fans according to whether they're native PWM or Software PWM
2019
-#ifdef BOARD_OPENDRAIN_MOSFETS
2020
-  #define _INIT_SOFT_FAN(P) OUT_WRITE_OD(P, FAN_INVERTING ? LOW : HIGH)
2021
-#else
2022
-  #define _INIT_SOFT_FAN(P) OUT_WRITE(P, FAN_INVERTING ? LOW : HIGH)
2023
-#endif
2024
-#if ENABLED(FAN_SOFT_PWM)
2025
-  #define _INIT_FAN_PIN(P) _INIT_SOFT_FAN(P)
2026
-#else
2027
-  #define _INIT_FAN_PIN(P) do{ if (PWM_PIN(P)) SET_PWM(P); else _INIT_SOFT_FAN(P); }while(0)
2028
-#endif
2029
-#if ENABLED(FAST_PWM_FAN)
2030
-  #define SET_FAST_PWM_FREQ(P) set_pwm_frequency(P, FAST_PWM_FAN_FREQUENCY)
2031
-#else
2032
-  #define SET_FAST_PWM_FREQ(P) NOOP
2033
-#endif
2034
-#define INIT_FAN_PIN(P) do{ _INIT_FAN_PIN(P); SET_FAST_PWM_FREQ(P); }while(0)
2035
-#if EXTRUDER_AUTO_FAN_SPEED != 255
2036
-  #define INIT_E_AUTO_FAN_PIN(P) do{ if (P == FAN1_PIN || P == FAN2_PIN) { SET_PWM(P); SET_FAST_PWM_FREQ(P); } else SET_OUTPUT(P); }while(0)
2037
-#else
2038
-  #define INIT_E_AUTO_FAN_PIN(P) SET_OUTPUT(P)
2039
-#endif
2040
-#if CHAMBER_AUTO_FAN_SPEED != 255
2041
-  #define INIT_CHAMBER_AUTO_FAN_PIN(P) do{ if (P == FAN1_PIN || P == FAN2_PIN) { SET_PWM(P); SET_FAST_PWM_FREQ(P); } else SET_OUTPUT(P); }while(0)
2042
-#else
2043
-  #define INIT_CHAMBER_AUTO_FAN_PIN(P) SET_OUTPUT(P)
2044
-#endif
2046
+} // Temperature::updateTemperaturesFromRawValues
2045 2047
 
2046 2048
 /**
2047 2049
  * Initialize the temperature manager
@@ -2070,50 +2072,47 @@ void Temperature::init() {
2070 2072
   #endif
2071 2073
 
2072 2074
   // Init (and disable) SPI thermocouples
2073
-  #if TEMP_SENSOR_IS_MAX(0, MAX6675) && PIN_EXISTS(MAX6675_CS)
2074
-    OUT_WRITE(MAX6675_CS_PIN, HIGH);
2075
-  #endif
2076
-  #if TEMP_SENSOR_IS_MAX(1, MAX6675) && PIN_EXISTS(MAX6675_CS2)
2077
-    OUT_WRITE(MAX6675_CS2_PIN, HIGH);
2078
-  #endif
2079
-  #if TEMP_SENSOR_IS_MAX(0, MAX6675) && PIN_EXISTS(MAX31855_CS)
2080
-    OUT_WRITE(MAX31855_CS_PIN, HIGH);
2081
-  #endif
2082
-  #if TEMP_SENSOR_IS_MAX(1, MAX6675) && PIN_EXISTS(MAX31855_CS2)
2083
-    OUT_WRITE(MAX31855_CS2_PIN, HIGH);
2084
-  #endif
2085
-  #if TEMP_SENSOR_IS_MAX(0, MAX6675) && PIN_EXISTS(MAX31865_CS)
2086
-    OUT_WRITE(MAX31865_CS_PIN, HIGH);
2087
-  #endif
2088
-  #if TEMP_SENSOR_IS_MAX(1, MAX6675) && PIN_EXISTS(MAX31865_CS2)
2089
-    OUT_WRITE(MAX31865_CS2_PIN, HIGH);
2090
-  #endif
2091
-
2092
-  #if HAS_MAX31865_TEMP
2093
-    #if TEMP_SENSOR_IS_MAX(0, MAX31865)
2094
-      max31865_0.begin(MAX31865_2WIRE); // MAX31865_2WIRE, MAX31865_3WIRE, MAX31865_4WIRE
2095
-    #endif
2096
-    #if TEMP_SENSOR_IS_MAX(1, MAX31865)
2097
-      max31865_1.begin(MAX31865_2WIRE);
2098
-    #endif
2099
-  #endif
2100
-
2101
-  #if HAS_MAX31855_TEMP
2102
-    #if TEMP_SENSOR_IS_MAX(0, MAX31855)
2103
-      max31855_0.begin(MAX31855);
2104
-    #endif
2105
-    #if TEMP_SENSOR_IS_MAX(1, MAX31855)
2106
-      max31855_1.begin(MAX31855);
2075
+  #if TEMP_SENSOR_IS_ANY_MAX_TC(0) && PIN_EXISTS(TEMP_0_CS)
2076
+    OUT_WRITE(TEMP_0_CS_PIN, HIGH);
2077
+  #endif
2078
+  #if TEMP_SENSOR_IS_ANY_MAX_TC(1) && PIN_EXISTS(TEMP_1_CS)
2079
+    OUT_WRITE(TEMP_1_CS_PIN, HIGH);
2080
+  #endif
2081
+
2082
+  // Setup objects for library-based polling of MAX TCs
2083
+  #if HAS_MAXTC_LIBRARIES
2084
+    #define _MAX31865_WIRES(n) MAX31865_##n##WIRE
2085
+    #define MAX31865_WIRES(n) _MAX31865_WIRES(n)
2086
+
2087
+    #if TEMP_SENSOR_IS_MAX(0, 6675) && HAS_MAX6675_LIBRARY
2088
+      max6675_0.begin();
2089
+    #elif TEMP_SENSOR_IS_MAX(0, 31855) && HAS_MAX31855_LIBRARY
2090
+      max31855_0.begin();
2091
+    #elif TEMP_SENSOR_IS_MAX(0, 31865)
2092
+      max31865_0.begin(
2093
+        MAX31865_WIRES(MAX31865_SENSOR_WIRES_0) // MAX31865_2WIRE, MAX31865_3WIRE, MAX31865_4WIRE
2094
+        OPTARG(LIB_INTERNAL_MAX31865, MAX31865_SENSOR_OHMS_0, MAX31865_CALIBRATION_OHMS_0)
2095
+      );
2096
+      #if defined(LIB_INTERNAL_MAX31865) && ENABLED(MAX31865_50HZ_FILTER)
2097
+        max31865_0.enable50HzFilter(1);
2098
+      #endif
2107 2099
     #endif
2108
-  #endif
2109 2100
 
2110
-  #if HAS_MAX6675_TEMP
2111
-    #if TEMP_SENSOR_IS_MAX(0, MAX6675)
2112
-      max6675_0.begin(MAX6675);
2113
-    #endif
2114
-    #if TEMP_SENSOR_IS_MAX(1, MAX6675)
2115
-      max6675_1.begin(MAX6675);
2101
+    #if TEMP_SENSOR_IS_MAX(1, 6675) && HAS_MAX6675_LIBRARY
2102
+      max6675_1.begin();
2103
+    #elif TEMP_SENSOR_IS_MAX(1, 31855) && HAS_MAX31855_LIBRARY
2104
+      max31855_1.begin();
2105
+    #elif TEMP_SENSOR_IS_MAX(1, 31865)
2106
+      max31865_1.begin(
2107
+        MAX31865_WIRES(MAX31865_SENSOR_WIRES_1) // MAX31865_2WIRE, MAX31865_3WIRE, MAX31865_4WIRE
2108
+        OPTARG(LIB_INTERNAL_MAX31865, MAX31865_SENSOR_OHMS_1, MAX31865_CALIBRATION_OHMS_1)
2109
+      );
2110
+      #if defined(LIB_INTERNAL_MAX31865) && ENABLED(MAX31865_50HZ_FILTER)
2111
+        max31865_1.enable50HzFilter(1);
2112
+      #endif
2116 2113
     #endif
2114
+    #undef MAX31865_WIRES
2115
+    #undef _MAX31865_WIRES
2117 2116
   #endif
2118 2117
 
2119 2118
   #if MB(RUMBA)
@@ -2152,7 +2151,6 @@ void Temperature::init() {
2152 2151
       OUT_WRITE(HEATER_0_PIN, HEATER_0_INVERTING);
2153 2152
     #endif
2154 2153
   #endif
2155
-
2156 2154
   #if HAS_HEATER_1
2157 2155
     OUT_WRITE(HEATER_1_PIN, HEATER_1_INVERTING);
2158 2156
   #endif
@@ -2219,7 +2217,9 @@ void Temperature::init() {
2219 2217
     INIT_FAN_PIN(CONTROLLER_FAN_PIN);
2220 2218
   #endif
2221 2219
 
2222
-  TERN_(THERMO_SEPARATE_SPI, max_tc_spi.init());
2220
+  #if HAS_MAXTC_SW_SPI
2221
+    max_tc_spi.init();
2222
+  #endif
2223 2223
 
2224 2224
   HAL_adc_init();
2225 2225
 
@@ -2318,11 +2318,7 @@ void Temperature::init() {
2318 2318
     INIT_CHAMBER_AUTO_FAN_PIN(CHAMBER_AUTO_FAN_PIN);
2319 2319
   #endif
2320 2320
 
2321
-  // Wait for temperature measurement to settle
2322
-  //delay(250);
2323
-
2324 2321
   #if HAS_HOTEND
2325
-
2326 2322
     #define _TEMP_MIN_E(NR) do{ \
2327 2323
       const celsius_t tmin = _MAX(HEATER_##NR##_MINTEMP, TERN(TEMP_SENSOR_##NR##_IS_CUSTOM, 0, (int)pgm_read_word(&TEMPTABLE_##NR [TEMP_SENSOR_##NR##_MINTEMP_IND].celsius))); \
2328 2324
       temp_range[NR].mintemp = tmin; \
@@ -2386,7 +2382,6 @@ void Temperature::init() {
2386 2382
     #if _MINMAX_TEST(7, MAX)
2387 2383
       _TEMP_MAX_E(7);
2388 2384
     #endif
2389
-
2390 2385
   #endif // HAS_HOTEND
2391 2386
 
2392 2387
   #if HAS_HEATED_BED
@@ -2520,9 +2515,8 @@ void Temperature::init() {
2520 2515
 
2521 2516
 void Temperature::disable_all_heaters() {
2522 2517
 
2518
+  // Disable autotemp, unpause and reset everything
2523 2519
   TERN_(AUTOTEMP, planner.autotemp_enabled = false);
2524
-
2525
-  // Unpause and reset everything
2526 2520
   TERN_(PROBING_HEATERS_OFF, pause_heaters(false));
2527 2521
 
2528 2522
   #if HAS_HOTEND
@@ -2558,8 +2552,6 @@ void Temperature::disable_all_heaters() {
2558 2552
 
2559 2553
 #if ENABLED(PRINTJOB_TIMER_AUTOSTART)
2560 2554
 
2561
-  #include "printcounter.h"
2562
-
2563 2555
   bool Temperature::auto_job_over_threshold() {
2564 2556
     #if HAS_HOTEND
2565 2557
       HOTEND_LOOP() if (degTargetHotend(e) > (EXTRUDE_MINTEMP) / 2) return true;
@@ -2578,7 +2570,7 @@ void Temperature::disable_all_heaters() {
2578 2570
     }
2579 2571
   }
2580 2572
 
2581
-#endif
2573
+#endif // PRINTJOB_TIMER_AUTOSTART
2582 2574
 
2583 2575
 #if ENABLED(PROBING_HEATERS_OFF)
2584 2576
 
@@ -2616,7 +2608,7 @@ void Temperature::disable_all_heaters() {
2616 2608
     #endif
2617 2609
   }
2618 2610
 
2619
-#endif
2611
+#endif // SINGLENOZZLE_STANDBY_TEMP || SINGLENOZZLE_STANDBY_FAN
2620 2612
 
2621 2613
 #if HAS_MAX_TC
2622 2614
 
@@ -2624,113 +2616,114 @@ void Temperature::disable_all_heaters() {
2624 2616
     #define THERMOCOUPLE_MAX_ERRORS 15
2625 2617
   #endif
2626 2618
 
2627
-  int Temperature::read_max_tc(TERN_(HAS_MULTI_MAX_TC, const uint8_t hindex/*=0*/)) {
2628
-    #define MAX6675_HEAT_INTERVAL 250UL
2619
+  /**
2620
+   * @brief Read MAX Thermocouple temperature.
2621
+   *
2622
+   * Reads the thermocouple board via HW or SW SPI, using a library (LIB_USR_x) or raw SPI reads.
2623
+   * Doesn't strictly return a temperature; returns an "ADC Value" (i.e. raw register content).
2624
+   *
2625
+   * @param  hindex  the hotend we're referencing (if MULTI_MAX_TC)
2626
+   * @return         integer representing the board's buffer, to be converted later if needed
2627
+   */
2628
+  int16_t Temperature::read_max_tc(TERN_(HAS_MULTI_MAX_TC, const uint8_t hindex/*=0*/)) {
2629
+    #define MAXTC_HEAT_INTERVAL 250UL
2629 2630
 
2630
-    #if HAS_MAX31855_TEMP
2631
-      static uint32_t max_tc_temp = 2000;
2632
-      #define MAX_TC_ERROR_MASK    7
2633
-      #define MAX_TC_DISCARD_BITS 18
2634
-      #define MAX_TC_SPEED_BITS    3        // (_BV(SPR1)) // clock ÷ 64
2635
-    #elif HAS_MAX31865_TEMP
2636
-      static uint16_t max_tc_temp = 2000;   // From datasheet 16 bits D15-D0
2637
-      #define MAX_TC_ERROR_MASK    1        // D0 Bit not used
2631
+    #if HAS_MAX31855
2632
+      #define MAX_TC_ERROR_MASK    7        // D2-0: SCV, SCG, OC
2633
+      #define MAX_TC_DISCARD_BITS 18        // Data D31-18; sign bit D31
2634
+      #define MAX_TC_SPEED_BITS    3        // ~1MHz
2635
+    #elif HAS_MAX31865
2636
+      #define MAX_TC_ERROR_MASK    1        // D0 Bit on fault only
2638 2637
       #define MAX_TC_DISCARD_BITS  1        // Data is in D15-D1
2639
-      #define MAX_TC_SPEED_BITS    3        //  (_BV(SPR1)) // clock ÷ 64
2640
-    #else
2641
-      static uint16_t max_tc_temp = 2000;
2642
-      #define MAX_TC_ERROR_MASK    4
2643
-      #define MAX_TC_DISCARD_BITS  3
2644
-      #define MAX_TC_SPEED_BITS    2        // (_BV(SPR0)) // clock ÷ 16
2638
+      #define MAX_TC_SPEED_BITS    3        // ~1MHz
2639
+    #else // MAX6675
2640
+      #define MAX_TC_ERROR_MASK    3        // D2 only; 1 = open circuit
2641
+      #define MAX_TC_DISCARD_BITS  3        // Data D15-D1
2642
+      #define MAX_TC_SPEED_BITS    2        // ~2MHz
2645 2643
     #endif
2646 2644
 
2647 2645
     #if HAS_MULTI_MAX_TC
2648 2646
       // Needed to return the correct temp when this is called between readings
2649
-      static celsius_t max_tc_temp_previous[MAX_TC_COUNT] = { 0 };
2647
+      static int16_t max_tc_temp_previous[MAX_TC_COUNT] = { 0 };
2650 2648
       #define THERMO_TEMP(I) max_tc_temp_previous[I]
2651 2649
       #define THERMO_SEL(A,B) (hindex ? (B) : (A))
2652
-      #define MAX6675_WRITE(V)     do{ switch (hindex) { case 1:      WRITE(MAX6675_SS2_PIN, V); break; default:      WRITE(MAX6675_SS_PIN, V); } }while(0)
2653
-      #define MAX6675_SET_OUTPUT() do{ switch (hindex) { case 1: SET_OUTPUT(MAX6675_SS2_PIN);    break; default: SET_OUTPUT(MAX6675_SS_PIN);    } }while(0)
2650
+      #define MAXTC_CS_WRITE(V) do{ switch (hindex) { case 1: WRITE(TEMP_1_CS_PIN, V); break; default: WRITE(TEMP_0_CS_PIN, V); } }while(0)
2654 2651
     #else
2652
+      // When we have only 1 max tc, THERMO_SEL will pick the appropriate sensor
2653
+      // variable, and MAXTC_*() macros will be hardcoded to the correct CS pin.
2655 2654
       constexpr uint8_t hindex = 0;
2656 2655
       #define THERMO_TEMP(I) max_tc_temp
2657
-      #if TEMP_SENSOR_IS_ANY_MAX_TC(1)
2658
-        #define THERMO_SEL(A,B) B
2659
-      #else
2656
+      #if TEMP_SENSOR_IS_ANY_MAX_TC(0)
2660 2657
         #define THERMO_SEL(A,B) A
2661
-      #endif
2662
-      #if TEMP_SENSOR_IS_MAX(0, MAX6675)
2663
-        #define MAX6675_WRITE(V)          WRITE(MAX6675_SS_PIN, V)
2664
-        #define MAX6675_SET_OUTPUT() SET_OUTPUT(MAX6675_SS_PIN)
2658
+        #define MAXTC_CS_WRITE(V)  WRITE(TEMP_0_CS_PIN, V)
2665 2659
       #else
2666
-        #define MAX6675_WRITE(V)          WRITE(MAX6675_SS2_PIN, V)
2667
-        #define MAX6675_SET_OUTPUT() SET_OUTPUT(MAX6675_SS2_PIN)
2660
+        #define THERMO_SEL(A,B) B
2661
+        #define MAXTC_CS_WRITE(V)  WRITE(TEMP_1_CS_PIN, V)
2668 2662
       #endif
2669
-
2670 2663
     #endif
2671 2664
 
2665
+    static TERN(HAS_MAX31855, uint32_t, uint16_t) max_tc_temp = THERMO_SEL(
2666
+      TEMP_SENSOR_0_MAX_TC_TMAX,
2667
+      TEMP_SENSOR_1_MAX_TC_TMAX
2668
+    );
2669
+
2672 2670
     static uint8_t max_tc_errors[MAX_TC_COUNT] = { 0 };
2671
+    static millis_t next_max_tc_ms[MAX_TC_COUNT] = { 0 };
2673 2672
 
2674 2673
     // Return last-read value between readings
2675
-    static millis_t next_max_tc_ms[MAX_TC_COUNT] = { 0 };
2676 2674
     millis_t ms = millis();
2677
-    if (PENDING(ms, next_max_tc_ms[hindex])) return int(THERMO_TEMP(hindex));
2678
-    next_max_tc_ms[hindex] = ms + MAX6675_HEAT_INTERVAL;
2675
+    if (PENDING(ms, next_max_tc_ms[hindex]))
2676
+      return (int16_t)THERMO_TEMP(hindex);
2679 2677
 
2680
-    //
2681
-    // TODO: spiBegin, spiRec and spiInit doesn't work when soft spi is used.
2682
-    //
2683
-    #if !THERMO_SEPARATE_SPI && NO_THERMO_TEMPS
2684
-      spiBegin();
2685
-      spiInit(MAX_TC_SPEED_BITS);
2686
-    #endif
2678
+    next_max_tc_ms[hindex] = ms + MAXTC_HEAT_INTERVAL;
2687 2679
 
2688
-    #if NO_THERMO_TEMPS
2689
-      MAX6675_WRITE(LOW);  // enable TT_MAX6675
2690
-      DELAY_NS(100);       // Ensure 100ns delay
2691
-    #endif
2680
+    #if !HAS_MAXTC_LIBRARIES
2681
+      max_tc_temp = 0;
2692 2682
 
2693
-    max_tc_temp = 0;
2683
+      #if !HAS_MAXTC_SW_SPI
2684
+        // Initialize SPI using the default Hardware SPI bus.
2685
+        // FIXME: spiBegin, spiRec and spiInit doesn't work when soft spi is used.
2686
+        spiBegin();
2687
+        spiInit(MAX_TC_SPEED_BITS);
2688
+      #endif
2689
+
2690
+      MAXTC_CS_WRITE(LOW);  // enable MAXTC
2691
+      DELAY_NS(100);        // Ensure 100ns delay
2694 2692
 
2695
-    // Read a big-endian temperature value
2696
-    #if NO_THERMO_TEMPS
2693
+      // Read a big-endian temperature value without using a library
2697 2694
       for (uint8_t i = sizeof(max_tc_temp); i--;) {
2698
-        max_tc_temp |= TERN(THERMO_SEPARATE_SPI, max_tc_spi.receive(), spiRec());
2695
+        max_tc_temp |= TERN(HAS_MAXTC_SW_SPI, max_tc_spi.receive(), spiRec());
2699 2696
         if (i > 0) max_tc_temp <<= 8; // shift left if not the last byte
2700 2697
       }
2701
-        MAX6675_WRITE(HIGH); // disable TT_MAX6675
2702
-    #endif
2703 2698
 
2704
-    #if HAS_MAX31855_TEMP
2705
-      Adafruit_MAX31855 &max855ref = THERMO_SEL(max31855_0, max31855_1);
2706
-      max_tc_temp = max855ref.readRaw32();
2707
-    #endif
2708
-
2709
-    #if HAS_MAX31865_TEMP
2710
-      Adafruit_MAX31865 &max865ref = THERMO_SEL(max31865_0, max31865_1);
2711
-      #if ENABLED(LIB_USR_MAX31865)
2712
-        max_tc_temp = max865ref.readRTD_with_Fault();
2699
+      MAXTC_CS_WRITE(HIGH);  // disable MAXTC
2700
+    #else
2701
+      #if HAS_MAX6675_LIBRARY
2702
+        MAX6675 &max6675ref = THERMO_SEL(max6675_0, max6675_1);
2703
+        max_tc_temp = max6675ref.readRaw16();
2713 2704
       #endif
2714
-    #endif
2715 2705
 
2716
-    #if HAS_MAX6675_TEMP
2717
-      MAX6675 &max6675ref = THERMO_SEL(max6675_0, max6675_1);
2718
-      max_tc_temp = max6675ref.readRaw16();
2719
-    #endif
2706
+      #if HAS_MAX31855_LIBRARY
2707
+        MAX31855 &max855ref = THERMO_SEL(max31855_0, max31855_1);
2708
+        max_tc_temp = max855ref.readRaw32();
2709
+      #endif
2720 2710
 
2721
-    #if ENABLED(LIB_ADAFRUIT_MAX31865)
2722
-      const uint8_t fault_31865 = max865ref.readFault() & 0x3FU;
2711
+      #if HAS_MAX31865
2712
+        MAX31865 &max865ref = THERMO_SEL(max31865_0, max31865_1);
2713
+        max_tc_temp = TERN(LIB_INTERNAL_MAX31865, max865ref.readRaw(), max865ref.readRTD_with_Fault());
2714
+      #endif
2723 2715
     #endif
2724 2716
 
2725
-    if (DISABLED(IGNORE_THERMOCOUPLE_ERRORS)
2726
-      && TERN(LIB_ADAFRUIT_MAX31865, fault_31865, (max_tc_temp & MAX_TC_ERROR_MASK))
2727
-    ) {
2717
+    // Handle an error. If there have been more than THERMOCOUPLE_MAX_ERRORS, send an error over serial.
2718
+    // Either way, return the TMAX for the thermocouple to trigger a max_temp_error()
2719
+    if (max_tc_temp & MAX_TC_ERROR_MASK) {
2728 2720
       max_tc_errors[hindex]++;
2721
+
2729 2722
       if (max_tc_errors[hindex] > THERMOCOUPLE_MAX_ERRORS) {
2730 2723
         SERIAL_ERROR_START();
2731 2724
         SERIAL_ECHOPGM("Temp measurement error! ");
2732
-        #if MAX_TC_ERROR_MASK == 7
2733
-          SERIAL_ECHOPGM("MAX31855 Fault : (", max_tc_temp & 0x7, ") >> ");
2725
+        #if HAS_MAX31855
2726
+          SERIAL_ECHOPAIR("MAX31855 Fault: (", max_tc_temp & 0x7, ") >> ");
2734 2727
           if (max_tc_temp & 0x1)
2735 2728
             SERIAL_ECHOLNPGM("Open Circuit");
2736 2729
           else if (max_tc_temp & 0x2)
@@ -2738,59 +2731,46 @@ void Temperature::disable_all_heaters() {
2738 2731
           else if (max_tc_temp & 0x4)
2739 2732
             SERIAL_ECHOLNPGM("Short to VCC");
2740 2733
         #elif HAS_MAX31865
2741
-          #if ENABLED(LIB_USR_MAX31865)
2742
-            // At the present time we do not have the ability to set the MAX31865 HIGH threshold
2743
-            // or thr LOW threshold, so no need to check for them, zero these bits out
2744
-            const uint8_t fault_31865 = max865ref.readFault() & 0x3FU;
2745
-          #endif
2734
+          const uint8_t fault_31865 = max865ref.readFault();
2746 2735
           max865ref.clearFault();
2747 2736
           if (fault_31865) {
2748 2737
             SERIAL_EOL();
2749
-            SERIAL_ECHOLNPAIR("\nMAX31865 Fault :(", fault_31865, ")  >>");
2738
+            SERIAL_ECHOLNPAIR("\nMAX31865 Fault: (", fault_31865, ")  >>");
2750 2739
             if (fault_31865 & MAX31865_FAULT_HIGHTHRESH)
2751 2740
               SERIAL_ECHOLNPGM("RTD High Threshold");
2752 2741
             if (fault_31865 & MAX31865_FAULT_LOWTHRESH)
2753 2742
               SERIAL_ECHOLNPGM("RTD Low Threshold");
2754 2743
             if (fault_31865 & MAX31865_FAULT_REFINLOW)
2755
-              SERIAL_ECHOLNPGM("REFIN- > 0.85 x Bias");
2744
+              SERIAL_ECHOLNPGM("REFIN- > 0.85 x V bias");
2756 2745
             if (fault_31865 & MAX31865_FAULT_REFINHIGH)
2757
-              SERIAL_ECHOLNPGM("REFIN- < 0.85 x Bias - FORCE- open");
2746
+              SERIAL_ECHOLNPGM("REFIN- < 0.85 x V bias (FORCE- open)");
2758 2747
             if (fault_31865 & MAX31865_FAULT_RTDINLOW)
2759
-              SERIAL_ECHOLNPGM("REFIN- < 0.85 x Bias - FORCE- open");
2748
+              SERIAL_ECHOLNPGM("REFIN- < 0.85 x V bias (FORCE- open)");
2760 2749
             if (fault_31865 & MAX31865_FAULT_OVUV)
2761 2750
               SERIAL_ECHOLNPGM("Under/Over voltage");
2762 2751
           }
2763
-        #else
2764
-          SERIAL_ECHOLNPGM("MAX6675 Open Circuit");
2752
+        #else // MAX6675
2753
+          SERIAL_ECHOLNPGM("MAX6675 Fault: Open Circuit");
2765 2754
         #endif
2766 2755
 
2767
-        // Thermocouple open
2768
-        max_tc_temp = 4 * THERMO_SEL(TEMP_SENSOR_0_MAX_TC_TMAX, TEMP_SENSOR_1_MAX_TC_TMAX);
2756
+        // Set thermocouple above max temperature (TMAX)
2757
+        max_tc_temp = THERMO_SEL(TEMP_SENSOR_0_MAX_TC_TMAX, TEMP_SENSOR_1_MAX_TC_TMAX) << (MAX_TC_DISCARD_BITS + 1);
2769 2758
       }
2770
-      else
2771
-        max_tc_temp >>= MAX_TC_DISCARD_BITS;
2772 2759
     }
2773 2760
     else {
2774
-      max_tc_temp >>= MAX_TC_DISCARD_BITS;
2775
-      max_tc_errors[hindex] = 0;
2761
+      max_tc_errors[hindex] = 0; // No error bit, reset error count
2776 2762
     }
2777 2763
 
2778
-    #if HAS_MAX31855
2779
-      if (max_tc_temp & 0x00002000) max_tc_temp |= 0xFFFFC000; // Support negative temperature
2780
-    #endif
2764
+    max_tc_temp >>= MAX_TC_DISCARD_BITS;
2781 2765
 
2782
-    // Return the RTD resistance for MAX31865 for display in SHOW_TEMP_ADC_VALUES
2783
-    #if HAS_MAX31865_TEMP
2784
-      #if ENABLED(LIB_ADAFRUIT_MAX31865)
2785
-        max_tc_temp = (uint32_t(max865ref.readRTD()) * THERMO_SEL(MAX31865_CALIBRATION_OHMS_0, MAX31865_CALIBRATION_OHMS_1)) >> 16;
2786
-      #elif ENABLED(LIB_USR_MAX31865)
2787
-        max_tc_temp = (uint32_t(max_tc_temp) * THERMO_SEL(MAX31865_CALIBRATION_OHMS_0, MAX31865_CALIBRATION_OHMS_1)) >> 16;
2788
-      #endif
2766
+    #if HAS_MAX31855
2767
+      // Support negative temperature for MAX38155
2768
+      if (max_tc_temp & 0x00002000) max_tc_temp |= 0xFFFFC000;
2789 2769
     #endif
2790 2770
 
2791 2771
     THERMO_TEMP(hindex) = max_tc_temp;
2792 2772
 
2793
-    return int(max_tc_temp);
2773
+    return (int16_t)max_tc_temp;
2794 2774
   }
2795 2775
 
2796 2776
 #endif // HAS_MAX_TC
@@ -2815,16 +2795,16 @@ void Temperature::update_raw_temperatures() {
2815 2795
     temp_redundant.update();
2816 2796
   #endif
2817 2797
 
2818
-  TERN_(HAS_TEMP_ADC_2, temp_hotend[2].update());
2819
-  TERN_(HAS_TEMP_ADC_3, temp_hotend[3].update());
2820
-  TERN_(HAS_TEMP_ADC_4, temp_hotend[4].update());
2821
-  TERN_(HAS_TEMP_ADC_5, temp_hotend[5].update());
2822
-  TERN_(HAS_TEMP_ADC_6, temp_hotend[6].update());
2823
-  TERN_(HAS_TEMP_ADC_7, temp_hotend[7].update());
2824
-  TERN_(HAS_TEMP_ADC_BED, temp_bed.update());
2798
+  TERN_(HAS_TEMP_ADC_2,       temp_hotend[2].update());
2799
+  TERN_(HAS_TEMP_ADC_3,       temp_hotend[3].update());
2800
+  TERN_(HAS_TEMP_ADC_4,       temp_hotend[4].update());
2801
+  TERN_(HAS_TEMP_ADC_5,       temp_hotend[5].update());
2802
+  TERN_(HAS_TEMP_ADC_6,       temp_hotend[6].update());
2803
+  TERN_(HAS_TEMP_ADC_7,       temp_hotend[7].update());
2804
+  TERN_(HAS_TEMP_ADC_BED,     temp_bed.update());
2825 2805
   TERN_(HAS_TEMP_ADC_CHAMBER, temp_chamber.update());
2826
-  TERN_(HAS_TEMP_ADC_PROBE, temp_probe.update());
2827
-  TERN_(HAS_TEMP_ADC_COOLER, temp_cooler.update());
2806
+  TERN_(HAS_TEMP_ADC_PROBE,   temp_probe.update());
2807
+  TERN_(HAS_TEMP_ADC_COOLER,  temp_cooler.update());
2828 2808
 
2829 2809
   TERN_(HAS_JOY_ADC_X, joystick.x.update());
2830 2810
   TERN_(HAS_JOY_ADC_Y, joystick.y.update());
@@ -3465,7 +3445,7 @@ void Temperature::isr() {
3465 3445
     SERIAL_PRINT(t, SFP);
3466 3446
     #if ENABLED(SHOW_TEMP_ADC_VALUES)
3467 3447
       // Temperature MAX SPI boards do not have an OVERSAMPLENR defined
3468
-      SERIAL_ECHOPAIR(" (", TERN(NO_THERMO_TEMPS, false, k == 'T') ? r : r * RECIPROCAL(OVERSAMPLENR));
3448
+      SERIAL_ECHOPAIR(" (", TERN(HAS_MAXTC_LIBRARIES, k == 'T', false) ? r : r * RECIPROCAL(OVERSAMPLENR));
3469 3449
       SERIAL_CHAR(')');
3470 3450
     #endif
3471 3451
     delay(2);

+ 10
- 10
Marlin/src/module/temperature.h View File

@@ -428,6 +428,15 @@ class Temperature {
428 428
 
429 429
       static heater_idle_t heater_idle[NR_HEATER_IDLE];
430 430
 
431
+    #endif // HEATER_IDLE_TIMER
432
+
433
+    #if HAS_ADC_BUTTONS
434
+      static uint32_t current_ADCKey_raw;
435
+      static uint16_t ADCKey_count;
436
+    #endif
437
+
438
+    #if ENABLED(PID_EXTRUSION_SCALING)
439
+      static int16_t lpq_len;
431 440
     #endif
432 441
 
433 442
   private:
@@ -486,15 +495,6 @@ class Temperature {
486 495
     #endif
487 496
 
488 497
   public:
489
-    #if HAS_ADC_BUTTONS
490
-      static uint32_t current_ADCKey_raw;
491
-      static uint16_t ADCKey_count;
492
-    #endif
493
-
494
-    #if ENABLED(PID_EXTRUSION_SCALING)
495
-      static int16_t lpq_len;
496
-    #endif
497
-
498 498
     /**
499 499
      * Instance Methods
500 500
      */
@@ -915,7 +915,7 @@ class Temperature {
915 915
       #else
916 916
         #define READ_MAX_TC(N) read_max_tc()
917 917
       #endif
918
-      static int read_max_tc(TERN_(HAS_MULTI_MAX_TC, const uint8_t hindex=0));
918
+      static int16_t read_max_tc(TERN_(HAS_MULTI_MAX_TC, const uint8_t hindex=0));
919 919
     #endif
920 920
 
921 921
     static void checkExtruderAutoFans();

+ 3
- 3
Marlin/src/pins/linux/pins_RAMPS_LINUX.h View File

@@ -133,11 +133,11 @@
133 133
 #define TEMP_1_PIN                             1  // Analog Input
134 134
 #define TEMP_BED_PIN                           2  // Analog Input
135 135
 
136
-// SPI for Max6675 or Max31855 Thermocouple
136
+// SPI for MAX Thermocouple
137 137
 #if DISABLED(SDSUPPORT)
138
-  #define MAX6675_SS_PIN                      66  // Don't use 53 if using Display/SD card
138
+  #define TEMP_0_CS_PIN                       66  // Don't use 53 if using Display/SD card
139 139
 #else
140
-  #define MAX6675_SS_PIN                      66  // Don't use 49 (SD_DETECT_PIN)
140
+  #define TEMP_0_CS_PIN                       66  // Don't use 49 (SD_DETECT_PIN)
141 141
 #endif
142 142
 
143 143
 //

+ 13
- 0
Marlin/src/pins/lpc1768/pins_BTT_SKR_common.h View File

@@ -73,6 +73,19 @@
73 73
   #endif
74 74
 #endif
75 75
 
76
+// CS, MISO, MOSI, and SCK for MAX Thermocouple SPI
77
+#if HAS_MAX_TC
78
+  //#define TEMP_0_CS_PIN   P...
79
+  //#define TEMP_0_MISO_PIN P...
80
+  //#define TEMP_0_MOSI_PIN P...
81
+  //#define TEMP_0_SCK_PIN  P...
82
+
83
+  //#define TEMP_1_CS_PIN   P...
84
+  //#define TEMP_1_MISO_PIN P...
85
+  //#define TEMP_1_MOSI_PIN P...
86
+  //#define TEMP_1_SCK_PIN  P...
87
+#endif
88
+
76 89
 //
77 90
 // Heaters / Fans
78 91
 //

+ 2
- 2
Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h View File

@@ -248,8 +248,8 @@
248 248
 
249 249
 #define PS_ON_PIN                          P2_12  // (12)
250 250
 
251
-#if !defined(MAX6675_SS_PIN) && DISABLED(USE_ZMAX_PLUG)
252
-  #define MAX6675_SS_PIN                   P1_28
251
+#if !defined(TEMP_0_CS_PIN) && DISABLED(USE_ZMAX_PLUG)
252
+  #define TEMP_0_CS_PIN                    P1_28
253 253
 #endif
254 254
 
255 255
 #if ENABLED(CASE_LIGHT_ENABLE) && !PIN_EXISTS(CASE_LIGHT) && !defined(SPINDLE_LASER_ENA_PIN)

+ 9
- 9
Marlin/src/pins/mega/pins_MALYAN_M180.h View File

@@ -72,17 +72,17 @@
72 72
 #define TEMP_BED_PIN                          15  // Analog Input
73 73
 
74 74
 // Extruder thermocouples 0 and 1 are read out by two separate ICs using
75
-// SPI for Max6675 Thermocouple
75
+// SPI for MAX Thermocouple
76 76
 // Uses a separate SPI bus
77
-#define THERMO_SCK_PIN                        78  // E2 - SCK
78
-#define THERMO_DO_PIN                          3  // E5 - DO
79
-#define THERMO_CS1_PIN                         5  // E3 - CS0
80
-#define THERMO_CS2_PIN                         2  // E4 - CS1
77
+#define TEMP_0_CS_PIN                          5  // E3 - CS0
78
+#define TEMP_0_SCK_PIN                        78  // E2 - SCK
79
+#define TEMP_0_MISO_PIN                        3  // E5 - MISO
80
+//#define TEMP_0_MOSI_PIN                    ...  // For MAX31865
81 81
 
82
-#define MAX6675_SS_PIN            THERMO_CS1_PIN
83
-#define MAX6675_SS2_PIN           THERMO_CS2_PIN
84
-#define MAX6675_SCK_PIN           THERMO_SCK_PIN
85
-#define MAX6675_DO_PIN             THERMO_DO_PIN
82
+#define TEMP_1_CS_PIN                          2  // E4 - CS1
83
+#define TEMP_1_SCK_PIN            TEMP_0_SCK_PIN
84
+#define TEMP_1_MISO_PIN          TEMP_0_MISO_PIN
85
+//#define TEMP_1_MOSI_PIN        TEMP_0_MOSI_PIN
86 86
 
87 87
 //
88 88
 // Heaters / Fans

+ 10
- 10
Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h View File

@@ -125,7 +125,7 @@
125 125
 // K7 - 69 / ADC15 - 15
126 126
 #define TEMP_BED_PIN                          15
127 127
 
128
-// SPI for Max6675 or Max31855 Thermocouple
128
+// SPI for MAX Thermocouple
129 129
 // Uses a separate SPI bus
130 130
 //
131 131
 //  3 E5 DO (SO)
@@ -133,15 +133,15 @@
133 133
 //  2 E4 CS2
134 134
 // 78 E2 SCK
135 135
 //
136
-#define THERMO_SCK_PIN                        78  // E2
137
-#define THERMO_DO_PIN                          3  // E5
138
-#define THERMO_CS1_PIN                         5  // E3
139
-#define THERMO_CS2_PIN                         2  // E4
140
-
141
-#define MAX6675_SS_PIN            THERMO_CS1_PIN
142
-#define MAX6675_SS2_PIN           THERMO_CS2_PIN
143
-#define MAX6675_SCK_PIN           THERMO_SCK_PIN
144
-#define MAX6675_DO_PIN             THERMO_DO_PIN
136
+#define TEMP_0_CS_PIN                          5  // E3
137
+#define TEMP_0_SCK_PIN                        78  // E2
138
+#define TEMP_0_MISO_PIN                        3  // E5
139
+//#define TEMP_0_MOSI_PIN                    ...  // For MAX31865
140
+
141
+#define TEMP_1_CS_PIN                          2  // E4
142
+#define TEMP_1_SCK_PIN            TEMP_0_SCK_PIN
143
+#define TEMP_1_MISO_PIN          TEMP_0_MISO_PIN
144
+//#define TEMP_1_MOSI_PIN        TEMP_0_MOSI_PIN
145 145
 
146 146
 //
147 147
 // Augmentation for auto-assigning plugs

+ 3
- 3
Marlin/src/pins/mega/pins_PICA.h View File

@@ -118,11 +118,11 @@
118 118
 
119 119
 #define SSR_PIN                                6
120 120
 
121
-// SPI for Max6675 or Max31855 Thermocouple
121
+// SPI for MAX Thermocouple
122 122
 #if DISABLED(SDSUPPORT)
123
-  #define MAX6675_SS_PIN                      66  // Don't use 53 if using Display/SD card
123
+  #define TEMP_0_CS_PIN                       66  // Don't use 53 if using Display/SD card
124 124
 #else
125
-  #define MAX6675_SS_PIN                      66  // Don't use 49 (SD_DETECT_PIN)
125
+  #define TEMP_0_CS_PIN                       66  // Don't use 49 (SD_DETECT_PIN)
126 126
 #endif
127 127
 
128 128
 //

+ 20
- 20
Marlin/src/pins/pinsDebug_list.h View File

@@ -760,17 +760,29 @@
760 760
 #if PIN_EXISTS(LED_RED)
761 761
   REPORT_NAME_DIGITAL(__LINE__, LED_RED_PIN)
762 762
 #endif
763
-#if PIN_EXISTS(MAX6675_DO)
764
-  REPORT_NAME_DIGITAL(__LINE__, MAX6675_DO_PIN)
763
+#if PIN_EXISTS(TEMP_0_CS)
764
+  REPORT_NAME_DIGITAL(__LINE__, TEMP_0_CS_PIN)
765 765
 #endif
766
-#if PIN_EXISTS(MAX6675_SCK)
767
-  REPORT_NAME_DIGITAL(__LINE__, MAX6675_SCK_PIN)
766
+#if PIN_EXISTS(TEMP_0_SCK)
767
+  REPORT_NAME_DIGITAL(__LINE__, TEMP_0_SCK_PIN)
768 768
 #endif
769
-#if PIN_EXISTS(MAX6675_SS)
770
-  REPORT_NAME_DIGITAL(__LINE__, MAX6675_SS_PIN)
769
+#if PIN_EXISTS(TEMP_0_MOSI)
770
+  REPORT_NAME_DIGITAL(__LINE__, TEMP_0_MOSI_PIN)
771 771
 #endif
772
-#if PIN_EXISTS(MAX6675_SS2)
773
-  REPORT_NAME_DIGITAL(__LINE__, MAX6675_SS2_PIN)
772
+#if PIN_EXISTS(TEMP_0_MISO)
773
+  REPORT_NAME_DIGITAL(__LINE__, TEMP_0_MISO_PIN)
774
+#endif
775
+#if PIN_EXISTS(TEMP_1_CS)
776
+  REPORT_NAME_DIGITAL(__LINE__, TEMP_1_CS_PIN)
777
+#endif
778
+#if PIN_EXISTS(TEMP_1_SCK)
779
+  REPORT_NAME_DIGITAL(__LINE__, TEMP_1_SCK_PIN)
780
+#endif
781
+#if PIN_EXISTS(TEMP_1_MOSI)
782
+  REPORT_NAME_DIGITAL(__LINE__, TEMP_1_MOSI_PIN)
783
+#endif
784
+#if PIN_EXISTS(TEMP_1_MISO)
785
+  REPORT_NAME_DIGITAL(__LINE__, TEMP_1_MISO_PIN)
774 786
 #endif
775 787
 #if PIN_EXISTS(MAX7219_CLK)
776 788
   REPORT_NAME_DIGITAL(__LINE__, MAX7219_CLK_PIN)
@@ -1010,18 +1022,6 @@
1010 1022
 #if PIN_EXISTS(SUICIDE)
1011 1023
   REPORT_NAME_DIGITAL(__LINE__, SUICIDE_PIN)
1012 1024
 #endif
1013
-#if PIN_EXISTS(THERMO_CS1)
1014
-  REPORT_NAME_DIGITAL(__LINE__, THERMO_CS1_PIN)
1015
-#endif
1016
-#if PIN_EXISTS(THERMO_CS2)
1017
-  REPORT_NAME_DIGITAL(__LINE__, THERMO_CS2_PIN)
1018
-#endif
1019
-#if PIN_EXISTS(THERMO_DO)
1020
-  REPORT_NAME_DIGITAL(__LINE__, THERMO_DO_PIN)
1021
-#endif
1022
-#if PIN_EXISTS(THERMO_SCK)
1023
-  REPORT_NAME_DIGITAL(__LINE__, THERMO_SCK_PIN)
1024
-#endif
1025 1025
 #if PIN_EXISTS(TLC_BLANK)
1026 1026
   REPORT_NAME_DIGITAL(__LINE__, TLC_BLANK_PIN)
1027 1027
 #endif

+ 3
- 3
Marlin/src/pins/rambo/pins_RAMBO.h View File

@@ -171,10 +171,10 @@
171 171
 #define SPINDLE_DIR_PIN                       32
172 172
 
173 173
 //
174
-// SPI for Max6675 or Max31855 Thermocouple
174
+// SPI for MAX Thermocouple
175 175
 //
176
-#ifndef MAX6675_SS_PIN
177
-  #define MAX6675_SS_PIN                      32  // SPINDLE_DIR_PIN / STAT_LED_BLUE_PIN
176
+#ifndef TEMP_0_CS_PIN
177
+  #define TEMP_0_CS_PIN                       32  // SPINDLE_DIR_PIN / STAT_LED_BLUE_PIN
178 178
 #endif
179 179
 
180 180
 //

+ 3
- 3
Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR.h View File

@@ -114,11 +114,11 @@
114 114
 #define TEMP_1_PIN                            15  // Analog Input
115 115
 #define TEMP_BED_PIN                          14  // Analog Input
116 116
 
117
-// SPI for Max6675 or Max31855 Thermocouple
117
+// SPI for MAX Thermocouple
118 118
 #if DISABLED(SDSUPPORT)
119
-  #define MAX6675_SS_PIN                      66  // Don't use 53 if using Display/SD card
119
+  #define TEMP_0_CS_PIN                       66  // Don't use 53 if using Display/SD card
120 120
 #else
121
-  #define MAX6675_SS_PIN                      66  // Don't use 49 (SD_DETECT_PIN)
121
+  #define TEMP_0_CS_PIN                       66  // Don't use 49 (SD_DETECT_PIN)
122 122
 #endif
123 123
 
124 124
 //

+ 3
- 3
Marlin/src/pins/ramps/pins_FORMBOT_TREX2PLUS.h View File

@@ -111,11 +111,11 @@
111 111
 #define TEMP_1_PIN                            15  // Analog Input
112 112
 #define TEMP_BED_PIN                           3  // Analog Input
113 113
 
114
-// SPI for Max6675 or Max31855 Thermocouple
114
+// SPI for MAX Thermocouple
115 115
 #if DISABLED(SDSUPPORT)
116
-  #define MAX6675_SS_PIN                      66  // Don't use 53 if using Display/SD card
116
+  #define TEMP_0_CS_PIN                       66  // Don't use 53 if using Display/SD card
117 117
 #else
118
-  #define MAX6675_SS_PIN                      66  // Don't use 49 (SD_DETECT_PIN)
118
+  #define TEMP_0_CS_PIN                       66  // Don't use 49 (SD_DETECT_PIN)
119 119
 #endif
120 120
 
121 121
 //

+ 3
- 3
Marlin/src/pins/ramps/pins_FORMBOT_TREX3.h View File

@@ -111,11 +111,11 @@
111 111
 #define TEMP_1_PIN                            15  // Analog Input
112 112
 #define TEMP_BED_PIN                          14  // Analog Input
113 113
 
114
-// SPI for Max6675 or Max31855 Thermocouple
114
+// SPI for MAX Thermocouple
115 115
 #if DISABLED(SDSUPPORT)
116
-  #define MAX6675_SS_PIN                      66  // Don't use 53 if using Display/SD card
116
+  #define TEMP_0_CS_PIN                       66  // Don't use 53 if using Display/SD card
117 117
 #else
118
-  #define MAX6675_SS_PIN                      66  // Don't use 49 (SD_DETECT_PIN)
118
+  #define TEMP_0_CS_PIN                       66  // Don't use 49 (SD_DETECT_PIN)
119 119
 #endif
120 120
 
121 121
 //

+ 3
- 3
Marlin/src/pins/ramps/pins_RAMPS.h View File

@@ -167,10 +167,10 @@
167 167
 #endif
168 168
 
169 169
 //
170
-// SPI for Max6675 or Max31855 Thermocouple
170
+// SPI for MAX Thermocouple
171 171
 //
172
-#ifndef MAX6675_SS_PIN
173
-  #define MAX6675_SS_PIN                      66  // Don't use 53 if using Display/SD card (SDSS) or 49 (SD_DETECT_PIN)
172
+#ifndef TEMP_0_CS_PIN
173
+  #define TEMP_0_CS_PIN                       66  // Don't use 53 if using Display/SD card (SDSS) or 49 (SD_DETECT_PIN)
174 174
 #endif
175 175
 
176 176
 //

+ 3
- 3
Marlin/src/pins/ramps/pins_RAMPS_OLD.h View File

@@ -74,11 +74,11 @@
74 74
 #define TEMP_0_PIN                             2  // Analog Input
75 75
 #define TEMP_BED_PIN                           1  // Analog Input
76 76
 
77
-// SPI for Max6675 or Max31855 Thermocouple
77
+// SPI for MAX Thermocouple
78 78
 #if DISABLED(SDSUPPORT)
79
-  #define MAX6675_SS_PIN                      66  // Don't use 53 if using Display/SD card
79
+  #define TEMP_0_CS_PIN                       66  // Don't use 53 if using Display/SD card
80 80
 #else
81
-  #define MAX6675_SS_PIN                      66  // Don't use 49 (SD_DETECT_PIN)
81
+  #define TEMP_0_CS_PIN                       66  // Don't use 49 (SD_DETECT_PIN)
82 82
 #endif
83 83
 
84 84
 //

+ 4
- 4
Marlin/src/pins/ramps/pins_RIGIDBOARD.h View File

@@ -75,12 +75,12 @@
75 75
 #define TEMP_1_PIN                            13  // Analog Input
76 76
 #define TEMP_BED_PIN                          15  // Analog Input
77 77
 
78
-// SPI for Max6675 or Max31855 Thermocouple
79
-#undef MAX6675_SS_PIN
78
+// SPI for MAX Thermocouple
79
+#undef TEMP_0_CS_PIN
80 80
 #if DISABLED(SDSUPPORT)
81
-  #define MAX6675_SS_PIN                      53  // Don't use pin 53 if there is even the remote possibility of using Display/SD card
81
+  #define TEMP_0_CS_PIN                       53  // Don't use pin 53 if there is even the remote possibility of using Display/SD card
82 82
 #else
83
-  #define MAX6675_SS_PIN                      49  // Don't use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
83
+  #define TEMP_0_CS_PIN                       49  // Don't use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
84 84
 #endif
85 85
 
86 86
 //

+ 3
- 3
Marlin/src/pins/ramps/pins_TENLOG_D3_HERO.h View File

@@ -123,11 +123,11 @@
123 123
 #define TEMP_1_PIN                            15  // Analog Input
124 124
 #define TEMP_BED_PIN                          14  // Analog Input
125 125
 
126
-// SPI for Max6675 or Max31855 Thermocouple
126
+// SPI for MAX Thermocouple
127 127
 #if DISABLED(SDSUPPORT)
128
-  #define MAX6675_SS_PIN                      -1  // Don't use 53 if using Display/SD card
128
+  #define TEMP_0_CS_PIN                       -1  // Don't use 53 if using Display/SD card
129 129
 #else
130
-  #define MAX6675_SS_PIN                      -1  // Don't use 49 (SD_DETECT_PIN)
130
+  #define TEMP_0_CS_PIN                       -1  // Don't use 49 (SD_DETECT_PIN)
131 131
 #endif
132 132
 
133 133
 //

+ 3
- 3
Marlin/src/pins/ramps/pins_TT_OSCAR.h View File

@@ -181,11 +181,11 @@
181 181
   #define TEMP_4_PIN                          12
182 182
 #endif
183 183
 
184
-// SPI for Max6675 or Max31855 Thermocouple
184
+// SPI for MAX Thermocouple
185 185
 //#if DISABLED(SDSUPPORT)
186
-//  #define MAX6675_SS_PIN   66   // Don't use 53 if using Display/SD card
186
+//  #define TEMP_0_CS_PIN    66   // Don't use 53 if using Display/SD card
187 187
 //#else
188
-//  #define MAX6675_SS_PIN   66   // Don't use 49 (SD_DETECT_PIN)
188
+//  #define TEMP_0_CS_PIN    66   // Don't use 49 (SD_DETECT_PIN)
189 189
 //#endif
190 190
 
191 191
 //

+ 3
- 3
Marlin/src/pins/sam/pins_DUE3DOM.h View File

@@ -82,11 +82,11 @@
82 82
 #define TEMP_2_PIN                             5  // Analog Input (unused)
83 83
 #define TEMP_BED_PIN                           1  // Analog Input (BED thermistor)
84 84
 
85
-// SPI for Max6675 or Max31855 Thermocouple
85
+// SPI for MAX Thermocouple
86 86
 #if DISABLED(SDSUPPORT)
87
-  #define MAX6675_SS_PIN                      -1
87
+  #define TEMP_0_CS_PIN                       -1
88 88
 #else
89
-  #define MAX6675_SS_PIN                      -1
89
+  #define TEMP_0_CS_PIN                       -1
90 90
 #endif
91 91
 
92 92
 //

+ 3
- 3
Marlin/src/pins/sam/pins_DUE3DOM_MINI.h View File

@@ -71,11 +71,11 @@
71 71
 #define TEMP_2_PIN                             5  // Analog Input (OnBoard thermistor beta 3950)
72 72
 #define TEMP_BED_PIN                           1  // Analog Input (BED thermistor)
73 73
 
74
-// SPI for Max6675 or Max31855 Thermocouple
74
+// SPI for MAX Thermocouple
75 75
 #if DISABLED(SDSUPPORT)
76
-  #define MAX6675_SS_PIN                      53
76
+  #define TEMP_0_CS_PIN                       53
77 77
 #else
78
-  #define MAX6675_SS_PIN                      53
78
+  #define TEMP_0_CS_PIN                       53
79 79
 #endif
80 80
 
81 81
 //

+ 3
- 3
Marlin/src/pins/sam/pins_RADDS.h View File

@@ -179,11 +179,11 @@
179 179
 #define TEMP_4_PIN                             5  // dummy so will compile when PINS_DEBUGGING is enabled
180 180
 #define TEMP_BED_PIN                           4  // Analog Input
181 181
 
182
-// SPI for Max6675 or Max31855 Thermocouple
182
+// SPI for MAX Thermocouple
183 183
 #if DISABLED(SDSUPPORT)
184
-  #define MAX6675_SS_PIN                      53
184
+  #define TEMP_0_CS_PIN                       53
185 185
 #else
186
-  #define MAX6675_SS_PIN                      49
186
+  #define TEMP_0_CS_PIN                       49
187 187
 #endif
188 188
 
189 189
 //

+ 4
- 4
Marlin/src/pins/sam/pins_RAMPS_DUO.h View File

@@ -60,12 +60,12 @@
60 60
 #undef TEMP_BED_PIN
61 61
 #define TEMP_BED_PIN                          10  // Analog Input
62 62
 
63
-// SPI for Max6675 or Max31855 Thermocouple
64
-#undef MAX6675_SS_PIN
63
+// SPI for MAX Thermocouple
64
+#undef TEMP_0_CS_PIN
65 65
 #if DISABLED(SDSUPPORT)
66
-  #define MAX6675_SS_PIN                      69  // Don't use 53 if using Display/SD card
66
+  #define TEMP_0_CS_PIN                       69  // Don't use 53 if using Display/SD card
67 67
 #else
68
-  #define MAX6675_SS_PIN                      69  // Don't use 49 (SD_DETECT_PIN)
68
+  #define TEMP_0_CS_PIN                       69  // Don't use 49 (SD_DETECT_PIN)
69 69
 #endif
70 70
 
71 71
 //

+ 3
- 3
Marlin/src/pins/sam/pins_RAMPS_FD_V1.h View File

@@ -109,11 +109,11 @@
109 109
 #define TEMP_2_PIN                             3  // Analog Input
110 110
 #define TEMP_BED_PIN                           0  // Analog Input
111 111
 
112
-// SPI for Max6675 or Max31855 Thermocouple
112
+// SPI for MAX Thermocouple
113 113
 #if DISABLED(SDSUPPORT)
114
-  #define MAX6675_SS_PIN                      53
114
+  #define TEMP_0_CS_PIN                       53
115 115
 #else
116
-  #define MAX6675_SS_PIN                      49
116
+  #define TEMP_0_CS_PIN                       49
117 117
 #endif
118 118
 
119 119
 //

+ 4
- 4
Marlin/src/pins/sam/pins_RAMPS_SMART.h View File

@@ -94,12 +94,12 @@
94 94
 #undef TEMP_BED_PIN
95 95
 #define TEMP_BED_PIN                          11  // Analog Input
96 96
 
97
-// SPI for Max6675 or Max31855 Thermocouple
98
-#undef MAX6675_SS_PIN
97
+// SPI for MAX Thermocouple
98
+#undef TEMP_0_CS_PIN
99 99
 #if DISABLED(SDSUPPORT)
100
-  #define MAX6675_SS_PIN                      67  // Don't use 53 if using Display/SD card
100
+  #define TEMP_0_CS_PIN                       67  // Don't use 53 if using Display/SD card
101 101
 #else
102
-  #define MAX6675_SS_PIN                      67  // Don't use 49 (SD_DETECT_PIN)
102
+  #define TEMP_0_CS_PIN                       67  // Don't use 49 (SD_DETECT_PIN)
103 103
 #endif
104 104
 
105 105
 //

+ 3
- 3
Marlin/src/pins/sam/pins_RURAMPS4D_11.h View File

@@ -156,12 +156,12 @@
156 156
   #define TEMP_5_PIN                           6  // A6 (Marlin 2.0 not support)
157 157
 #endif
158 158
 
159
-// SPI for Max6675 or Max31855 Thermocouple
159
+// SPI for MAX Thermocouple
160 160
 /*
161 161
 #if DISABLED(SDSUPPORT)
162
-  #define MAX6675_SS_PIN                      53
162
+  #define TEMP_0_CS_PIN                       53
163 163
 #else
164
-  #define MAX6675_SS_PIN                      49
164
+  #define TEMP_0_CS_PIN                       49
165 165
 #endif
166 166
 */
167 167
 

+ 3
- 3
Marlin/src/pins/sam/pins_RURAMPS4D_13.h View File

@@ -142,12 +142,12 @@
142 142
   #define TEMP_5_PIN                           6  // A6 (Marlin 2.0 not support)
143 143
 #endif
144 144
 
145
-// SPI for Max6675 or Max31855 Thermocouple
145
+// SPI for MAX Thermocouple
146 146
 /*
147 147
 #if DISABLED(SDSUPPORT)
148
-  #define MAX6675_SS_PIN                      53
148
+  #define TEMP_0_CS_PIN                       53
149 149
 #else
150
-  #define MAX6675_SS_PIN                      49
150
+  #define TEMP_0_CS_PIN                       49
151 151
 #endif
152 152
 */
153 153
 

+ 5
- 6
Marlin/src/pins/sam/pins_ULTRATRONICS_PRO.h View File

@@ -149,12 +149,11 @@
149 149
 #define SD_MISO_PIN                           74
150 150
 #define SD_MOSI_PIN                           75
151 151
 
152
-// SPI for Max6675 or Max31855 Thermocouple
153
-#define MAX6675_SS_PIN                        65
154
-#define MAX31855_SS0                          65
155
-#define MAX31855_SS1                          52
156
-#define MAX31855_SS2                          50
157
-#define MAX31855_SS3                          51
152
+// SPI for MAX Thermocouple
153
+#define TEMP_0_CS_PIN                         65
154
+#define TEMP_1_CS_PIN                         52
155
+#define TEMP_2_CS_PIN                         50
156
+#define TEMP_3_CS_PIN                         51
158 157
 
159 158
 #define ENC424_SS                             61
160 159
 

+ 4
- 4
Marlin/src/pins/stm32f1/pins_MINGDA_MPX_ARM_MINI.h View File

@@ -100,10 +100,10 @@
100 100
 //#define TEMP_0_PIN                        PB3   // E0 K+
101 101
 #define TEMP_BED_PIN                        PF7   // THERM_BED
102 102
 
103
-#define MAX6675_SS_PIN                      PB5
104
-#define MAX6675_SCK_PIN                     PB3
105
-#define MAX6675_DO_PIN                      PB4
106
-#define MAX6675_MOSI_PIN                    PA14
103
+#define TEMP_0_CS_PIN                       PB5
104
+#define TEMP_0_SCK_PIN                      PB3
105
+#define TEMP_0_MISO_PIN                     PB4
106
+#define TEMP_0_MOSI_PIN                     PA14
107 107
 
108 108
 //
109 109
 // Heaters / Fans

+ 2
- 2
Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h View File

@@ -121,8 +121,8 @@
121 121
 //
122 122
 // Thermocouples
123 123
 //
124
-//#define MAX6675_SS_PIN                    PE5   // TC1 - CS1
125
-//#define MAX6675_SS_PIN                    PE6   // TC2 - CS2
124
+//#define TEMP_0_CS_PIN                     PE5   // TC1 - CS1
125
+//#define TEMP_0_CS_PIN                     PE6   // TC2 - CS2
126 126
 
127 127
 //
128 128
 // Filament runout sensor

+ 2
- 2
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h View File

@@ -124,8 +124,8 @@
124 124
 //
125 125
 // Thermocouples
126 126
 //
127
-//#define MAX6675_SS_PIN                    PE5   // TC1 - CS1
128
-//#define MAX6675_SS_PIN                    PE6   // TC2 - CS2
127
+//#define TEMP_0_CS_PIN                     PE5   // TC1 - CS1
128
+//#define TEMP_0_CS_PIN                     PE6   // TC2 - CS2
129 129
 
130 130
 //
131 131
 // Misc. Functions

+ 2
- 2
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h View File

@@ -188,8 +188,8 @@
188 188
 //
189 189
 // Thermocouples
190 190
 //
191
-//#define MAX6675_SS_PIN                    PE5   // TC1 - CS1
192
-//#define MAX6675_SS_PIN                    PE6   // TC2 - CS2
191
+//#define TEMP_0_CS_PIN                     PE5   // TC1 - CS1
192
+//#define TEMP_0_CS_PIN                     PE6   // TC2 - CS2
193 193
 
194 194
 //
195 195
 // Misc. Functions

+ 2
- 2
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h View File

@@ -175,8 +175,8 @@
175 175
 /**
176 176
  * Note: MKS Robin Pro board is using SPI2 interface. Make sure your stm32duino library is configured accordingly
177 177
  */
178
-//#define MAX6675_SS_PIN                    PE5   // TC1 - CS1
179
-//#define MAX6675_SS_PIN                    PF11  // TC2 - CS2
178
+//#define TEMP_0_CS_PIN                     PE5   // TC1 - CS1
179
+//#define TEMP_0_CS_PIN                     PF11  // TC2 - CS2
180 180
 
181 181
 #define POWER_LOSS_PIN                      PA2   // PW_DET
182 182
 #define PS_ON_PIN                           PG11  // PW_OFF

+ 10
- 10
Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h View File

@@ -298,19 +298,19 @@
298 298
 
299 299
 #define TEMP_BED_PIN                        PC0   // T0 <-> Bed
300 300
 
301
-// SPI for Max6675 or Max31855 Thermocouple
301
+// SPI for MAX Thermocouple
302 302
 // Uses a separate SPI bus
303
-// If you have a two-way thermocouple, you can customize two THERMO_CSx_PIN pins (x:1~2)
303
+// If you have a two-way thermocouple, you can customize two TEMP_x_CS_PIN pins (x:0~1)
304 304
 
305
-#define THERMO_SCK_PIN                      PI1   // SCK
306
-#define THERMO_DO_PIN                       PI2   // MISO
307
-#define THERMO_CS1_PIN                      PH9   // GTR K-TEMP
308
-#define THERMO_CS2_PIN                      PH2   // M5 K-TEMP
305
+#define TEMP_0_CS_PIN                       PH9   // GTR K-TEMP
306
+#define TEMP_0_SCK_PIN                      PI1   // SCK
307
+#define TEMP_0_MISO_PIN                     PI2   // MISO
308
+//#define TEMP_0_MOSI_PIN                   ...   // For MAX31865
309 309
 
310
-#define MAX6675_SS_PIN            THERMO_CS1_PIN
311
-#define MAX6675_SS2_PIN           THERMO_CS2_PIN
312
-#define MAX6675_SCK_PIN           THERMO_SCK_PIN
313
-#define MAX6675_DO_PIN             THERMO_DO_PIN
310
+#define TEMP_1_CS_PIN                       PH2   // M5 K-TEMP
311
+#define TEMP_1_SCK_PIN           TEMP_0_SCK_PIN
312
+#define TEMP_1_MISO_PIN         TEMP_0_MISO_PIN
313
+//#define TEMP_1_MOSI_PIN       TEMP_0_MOSI_PIN
314 314
 
315 315
 //
316 316
 // Heaters / Fans

+ 6
- 6
Marlin/src/pins/stm32f4/pins_LERDGE_S.h View File

@@ -104,16 +104,16 @@
104 104
 // MAX6675 Cold-Junction-Compensated K-Thermocouple to Digital Converter (0°C to +1024°C)
105 105
 // https://datasheets.maximintegrated.com/en/ds/MAX6675.pdf
106 106
 
107
-#define MAX6675_SCK_PIN                     PB3   // max6675 datasheet: SCK pin, found with multimeter, not tested
108
-#define MAX6675_DO_PIN                      PB4   // max6675 datasheet: SO pin, found with multimeter, not tested
109
-#define MAX6675_SS_PIN                      PC4   // max6675 datasheet: /CS pin, found with multimeter, not tested and likely wrong
107
+#define TEMP_0_CS_PIN                       PC4   // max6675 datasheet: /CS pin, found with multimeter, not tested and likely wrong
108
+#define TEMP_0_SCK_PIN                      PB3   // max6675 datasheet: SCK pin, found with multimeter, not tested
109
+#define TEMP_0_MISO_PIN                     PB4   // max6675 datasheet: SO pin, found with multimeter, not tested
110 110
 
111 111
 // Expansion board with second max6675
112 112
 // Warning: Some boards leave the slot unpopulated.
113 113
 
114
-//#define MAX6675_SCK2_PIN                  PB3   // max6675 datasheet: SCK pin, found with multimeter, not tested
115
-//#define MAX6675_DO2_PIN                   PB4   // max6675 datasheet: SO pin, found with multimeter, not tested
116
-//#define MAX6675_SS2_PIN                   PF1   // max6675 datasheet: /CS pin, found with multimeter, not tested
114
+//#define TEMP_1_CS_PIN                     PF1   // max6675 datasheet: /CS pin, found with multimeter, not tested
115
+//#define TEMP_1_SCK_PIN                    PB3   // max6675 datasheet: SCK pin, found with multimeter, not tested
116
+//#define TEMP_1_MISO_PIN                   PB4   // max6675 datasheet: SO pin, found with multimeter, not tested
117 117
 
118 118
 //
119 119
 // Heaters / Fans

+ 2
- 2
Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h View File

@@ -172,8 +172,8 @@
172 172
 //
173 173
 // Thermocouples
174 174
 //
175
-//#define MAX6675_SS_PIN            HEATER_0_PIN  // TC1 - CS1
176
-//#define MAX6675_SS_PIN            HEATER_1_PIN  // TC2 - CS2
175
+//#define TEMP_0_CS_PIN             HEATER_0_PIN  // TC1 - CS1
176
+//#define TEMP_0_CS_PIN             HEATER_1_PIN  // TC2 - CS2
177 177
 
178 178
 //
179 179
 // Misc. Functions

+ 2
- 2
Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h View File

@@ -189,8 +189,8 @@
189 189
 //
190 190
 // Thermocouples
191 191
 //
192
-//#define MAX6675_SS_PIN                    PE5   // TC1 - CS1
193
-//#define MAX6675_SS_PIN                    PE6   // TC2 - CS2
192
+//#define TEMP_0_CS_PIN                     PE5   // TC1 - CS1
193
+//#define TEMP_0_CS_PIN                     PE6   // TC2 - CS2
194 194
 
195 195
 //
196 196
 // Misc. Functions

+ 1
- 1
ini/features.ini View File

@@ -27,9 +27,9 @@ HAS_TMC26X                             = TMC26XStepper=https://github.com/trinam
27 27
                                          src_filter=+<src/module/TMC26X.cpp>
28 28
 HAS_L64XX                              = Arduino-L6470@0.8.0
29 29
                                          src_filter=+<src/libs/L64XX> +<src/module/stepper/L64xx.cpp> +<src/gcode/feature/L6470> +<src/HAL/shared/HAL_spi_L6470.cpp>
30
+LIB_INTERNAL_MAX31865                  = src_filter=+<src/libs/MAX31865.cpp>
30 31
 NEOPIXEL_LED                           = adafruit/Adafruit NeoPixel@~1.8.0
31 32
                                          src_filter=+<src/feature/leds/neopixel.cpp>
32
-TEMP_.+_IS_MAX31865                    = Adafruit MAX31865 library@~1.1.0
33 33
 I2C_AMMETER                            = peterus/INA226Lib@1.1.2
34 34
 USES_LIQUIDCRYSTAL                     = fmalpartida/LiquidCrystal@1.5.0
35 35
 USES_LIQUIDCRYSTAL_I2C                 = marcoschwartz/LiquidCrystal_I2C@1.1.4

+ 1
- 0
platformio.ini View File

@@ -230,6 +230,7 @@ default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared>
230 230
   -<src/gcode/units/M149.cpp>
231 231
   -<src/libs/BL24CXX.cpp> -<src/libs/W25Qxx.cpp>
232 232
   -<src/libs/L64XX> -<src/module/stepper/L64xx.cpp> -<src/HAL/shared/HAL_spi_L6470.cpp>
233
+  -<src/libs/MAX31865.cpp>
233 234
   -<src/libs/hex_print.cpp>
234 235
   -<src/libs/least_squares_fit.cpp>
235 236
   -<src/libs/nozzle.cpp> -<src/gcode/feature/clean>

Loading…
Cancel
Save