Browse Source

✨ More flexible redundant temp sensor (#22085)

Katelyn Schiesser 3 years ago
parent
commit
629551d9bc
No account linked to committer's email address
65 changed files with 573 additions and 254 deletions
  1. 23
    5
      Marlin/Configuration.h
  2. 6
    0
      Marlin/Configuration_adv.h
  3. 1
    1
      Marlin/src/HAL/LPC1768/tft/xpt2046.h
  4. 1
    1
      Marlin/src/HAL/STM32/tft/xpt2046.h
  5. 1
    1
      Marlin/src/HAL/STM32F1/tft/xpt2046.h
  6. 2
    2
      Marlin/src/MarlinCore.cpp
  7. 1
    5
      Marlin/src/gcode/temp/M105.cpp
  8. 166
    27
      Marlin/src/inc/Conditionals_post.h
  9. 79
    12
      Marlin/src/inc/SanityCheck.h
  10. 145
    72
      Marlin/src/module/temperature.cpp
  11. 33
    13
      Marlin/src/module/temperature.h
  12. 1
    1
      Marlin/src/module/thermistor/thermistor_1.h
  13. 1
    1
      Marlin/src/module/thermistor/thermistor_10.h
  14. 1
    1
      Marlin/src/module/thermistor/thermistor_1010.h
  15. 1
    1
      Marlin/src/module/thermistor/thermistor_1047.h
  16. 1
    1
      Marlin/src/module/thermistor/thermistor_11.h
  17. 1
    1
      Marlin/src/module/thermistor/thermistor_110.h
  18. 1
    1
      Marlin/src/module/thermistor/thermistor_12.h
  19. 1
    1
      Marlin/src/module/thermistor/thermistor_13.h
  20. 1
    1
      Marlin/src/module/thermistor/thermistor_147.h
  21. 1
    1
      Marlin/src/module/thermistor/thermistor_15.h
  22. 1
    1
      Marlin/src/module/thermistor/thermistor_17.h
  23. 1
    1
      Marlin/src/module/thermistor/thermistor_18.h
  24. 1
    1
      Marlin/src/module/thermistor/thermistor_2.h
  25. 1
    1
      Marlin/src/module/thermistor/thermistor_20.h
  26. 1
    1
      Marlin/src/module/thermistor/thermistor_201.h
  27. 1
    1
      Marlin/src/module/thermistor/thermistor_202.h
  28. 1
    1
      Marlin/src/module/thermistor/thermistor_21.h
  29. 1
    1
      Marlin/src/module/thermistor/thermistor_22.h
  30. 1
    1
      Marlin/src/module/thermistor/thermistor_23.h
  31. 1
    1
      Marlin/src/module/thermistor/thermistor_3.h
  32. 1
    1
      Marlin/src/module/thermistor/thermistor_30.h
  33. 1
    1
      Marlin/src/module/thermistor/thermistor_331.h
  34. 1
    1
      Marlin/src/module/thermistor/thermistor_332.h
  35. 1
    1
      Marlin/src/module/thermistor/thermistor_4.h
  36. 1
    1
      Marlin/src/module/thermistor/thermistor_5.h
  37. 1
    1
      Marlin/src/module/thermistor/thermistor_501.h
  38. 1
    1
      Marlin/src/module/thermistor/thermistor_502.h
  39. 1
    1
      Marlin/src/module/thermistor/thermistor_503.h
  40. 1
    1
      Marlin/src/module/thermistor/thermistor_51.h
  41. 1
    1
      Marlin/src/module/thermistor/thermistor_512.h
  42. 1
    1
      Marlin/src/module/thermistor/thermistor_52.h
  43. 1
    1
      Marlin/src/module/thermistor/thermistor_55.h
  44. 1
    1
      Marlin/src/module/thermistor/thermistor_6.h
  45. 1
    1
      Marlin/src/module/thermistor/thermistor_60.h
  46. 1
    1
      Marlin/src/module/thermistor/thermistor_61.h
  47. 1
    1
      Marlin/src/module/thermistor/thermistor_66.h
  48. 1
    1
      Marlin/src/module/thermistor/thermistor_666.h
  49. 1
    1
      Marlin/src/module/thermistor/thermistor_67.h
  50. 1
    1
      Marlin/src/module/thermistor/thermistor_7.h
  51. 1
    1
      Marlin/src/module/thermistor/thermistor_70.h
  52. 1
    1
      Marlin/src/module/thermistor/thermistor_71.h
  53. 1
    1
      Marlin/src/module/thermistor/thermistor_75.h
  54. 1
    1
      Marlin/src/module/thermistor/thermistor_8.h
  55. 1
    1
      Marlin/src/module/thermistor/thermistor_9.h
  56. 1
    1
      Marlin/src/module/thermistor/thermistor_99.h
  57. 1
    1
      Marlin/src/module/thermistor/thermistor_998.h
  58. 1
    1
      Marlin/src/module/thermistor/thermistor_999.h
  59. 62
    62
      Marlin/src/module/thermistor/thermistors.h
  60. 1
    1
      buildroot/bin/mftest
  61. 1
    1
      buildroot/bin/opt_disable
  62. 1
    1
      buildroot/bin/opt_enable
  63. 1
    1
      buildroot/bin/opt_set
  64. 1
    1
      buildroot/bin/pins_set
  65. 1
    1
      buildroot/share/git/mfconfig

+ 23
- 5
Marlin/Configuration.h View File

472
 #define TEMP_SENSOR_PROBE 0
472
 #define TEMP_SENSOR_PROBE 0
473
 #define TEMP_SENSOR_CHAMBER 0
473
 #define TEMP_SENSOR_CHAMBER 0
474
 #define TEMP_SENSOR_COOLER 0
474
 #define TEMP_SENSOR_COOLER 0
475
+#define TEMP_SENSOR_REDUNDANT 0
475
 
476
 
476
 // Dummy thermistor constant temperature readings, for use with 998 and 999
477
 // Dummy thermistor constant temperature readings, for use with 998 and 999
477
 #define DUMMY_THERMISTOR_998_VALUE  25
478
 #define DUMMY_THERMISTOR_998_VALUE  25
483
 //#define MAX31865_SENSOR_OHMS_1      100
484
 //#define MAX31865_SENSOR_OHMS_1      100
484
 //#define MAX31865_CALIBRATION_OHMS_1 430
485
 //#define MAX31865_CALIBRATION_OHMS_1 430
485
 
486
 
486
-// Use temp sensor 1 as a redundant sensor with sensor 0. If the readings
487
-// from the two sensors differ too much the print will be aborted.
488
-//#define TEMP_SENSOR_1_AS_REDUNDANT
489
-#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10
490
-
491
 #define TEMP_RESIDENCY_TIME         10  // (seconds) Time to wait for hotend to "settle" in M109
487
 #define TEMP_RESIDENCY_TIME         10  // (seconds) Time to wait for hotend to "settle" in M109
492
 #define TEMP_WINDOW                  1  // (°C) Temperature proximity for the "temperature reached" timer
488
 #define TEMP_WINDOW                  1  // (°C) Temperature proximity for the "temperature reached" timer
493
 #define TEMP_HYSTERESIS              3  // (°C) Temperature proximity considered "close enough" to the target
489
 #define TEMP_HYSTERESIS              3  // (°C) Temperature proximity considered "close enough" to the target
500
 #define TEMP_CHAMBER_WINDOW          1  // (°C) Temperature proximity for the "temperature reached" timer
496
 #define TEMP_CHAMBER_WINDOW          1  // (°C) Temperature proximity for the "temperature reached" timer
501
 #define TEMP_CHAMBER_HYSTERESIS      3  // (°C) Temperature proximity considered "close enough" to the target
497
 #define TEMP_CHAMBER_HYSTERESIS      3  // (°C) Temperature proximity considered "close enough" to the target
502
 
498
 
499
+/**
500
+ * Redundant Temperature Sensor (TEMP_SENSOR_REDUNDANT)
501
+ *
502
+ * Use a temp sensor as a redundant sensor for another reading. Select an unused temperature sensor, and another
503
+ * sensor you'd like it to be redundant for. If the two thermistors differ by TEMP_SENSOR_REDUNDANT_MAX_DIFF (°C),
504
+ * the print will be aborted. Whichever sensor is selected will have its normal functions disabled; i.e. selecting
505
+ * the Bed sensor (-1) will disable bed heating/monitoring.
506
+ *
507
+ * Use the following to select temp sensors:
508
+ *    -5 : Cooler
509
+ *    -4 : Probe
510
+ *    -3 : not used
511
+ *    -2 : Chamber
512
+ *    -1 : Bed
513
+ *   0-7 : E0 through E7
514
+ */
515
+#if TEMP_SENSOR_REDUNDANT
516
+  #define TEMP_SENSOR_REDUNDANT_SOURCE     1  // The sensor that will provide the redundant reading.
517
+  #define TEMP_SENSOR_REDUNDANT_TARGET     0  // The sensor that we are providing a redundant reading for.
518
+  #define TEMP_SENSOR_REDUNDANT_MAX_DIFF  10  // (°C) Temperature difference that will trigger a print abort.
519
+#endif
520
+
503
 // Below this temperature the heater will be switched off
521
 // Below this temperature the heater will be switched off
504
 // because it probably indicates a broken thermistor wire.
522
 // because it probably indicates a broken thermistor wire.
505
 #define HEATER_0_MINTEMP   5
523
 #define HEATER_0_MINTEMP   5

+ 6
- 0
Marlin/Configuration_adv.h View File

125
   #define PROBE_BETA                   3950    // Beta value
125
   #define PROBE_BETA                   3950    // Beta value
126
 #endif
126
 #endif
127
 
127
 
128
+#if TEMP_SENSOR_REDUNDANT == 1000
129
+  #define REDUNDANT_PULLUP_RESISTOR_OHMS   4700    // Pullup resistor
130
+  #define REDUNDANT_RESISTANCE_25C_OHMS    100000  // Resistance at 25C
131
+  #define REDUNDANT_BETA                   3950    // Beta value
132
+#endif
133
+
128
 //
134
 //
129
 // Hephestos 2 24V heated bed upgrade kit.
135
 // Hephestos 2 24V heated bed upgrade kit.
130
 // https://store.bq.com/en/heated-bed-kit-hephestos2
136
 // https://store.bq.com/en/heated-bed-kit-hephestos2

+ 1
- 1
Marlin/src/HAL/LPC1768/tft/xpt2046.h View File

54
   XPT2046_Z2 = 0x40 | XPT2046_CONTROL | XPT2046_DFR_MODE,
54
   XPT2046_Z2 = 0x40 | XPT2046_CONTROL | XPT2046_DFR_MODE,
55
 };
55
 };
56
 
56
 
57
-#if !defined(XPT2046_Z1_THRESHOLD)
57
+#ifndef XPT2046_Z1_THRESHOLD
58
   #define XPT2046_Z1_THRESHOLD 10
58
   #define XPT2046_Z1_THRESHOLD 10
59
 #endif
59
 #endif
60
 
60
 

+ 1
- 1
Marlin/src/HAL/STM32/tft/xpt2046.h View File

56
   XPT2046_Z2 = 0x40 | XPT2046_CONTROL | XPT2046_DFR_MODE,
56
   XPT2046_Z2 = 0x40 | XPT2046_CONTROL | XPT2046_DFR_MODE,
57
 };
57
 };
58
 
58
 
59
-#if !defined(XPT2046_Z1_THRESHOLD)
59
+#ifndef XPT2046_Z1_THRESHOLD
60
   #define XPT2046_Z1_THRESHOLD 10
60
   #define XPT2046_Z1_THRESHOLD 10
61
 #endif
61
 #endif
62
 
62
 

+ 1
- 1
Marlin/src/HAL/STM32F1/tft/xpt2046.h View File

54
   XPT2046_Z2 = 0x40 | XPT2046_CONTROL | XPT2046_DFR_MODE,
54
   XPT2046_Z2 = 0x40 | XPT2046_CONTROL | XPT2046_DFR_MODE,
55
 };
55
 };
56
 
56
 
57
-#if !defined(XPT2046_Z1_THRESHOLD)
57
+#ifndef XPT2046_Z1_THRESHOLD
58
   #define XPT2046_Z1_THRESHOLD 10
58
   #define XPT2046_Z1_THRESHOLD 10
59
 #endif
59
 #endif
60
 
60
 

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

1157
   SETUP_RUN(HAL_init());
1157
   SETUP_RUN(HAL_init());
1158
 
1158
 
1159
   // Init and disable SPI thermocouples; this is still needed
1159
   // Init and disable SPI thermocouples; this is still needed
1160
-  #if TEMP_SENSOR_0_IS_MAX_TC
1160
+  #if TEMP_SENSOR_0_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 0)
1161
     OUT_WRITE(MAX6675_SS_PIN, HIGH);  // Disable
1161
     OUT_WRITE(MAX6675_SS_PIN, HIGH);  // Disable
1162
   #endif
1162
   #endif
1163
-  #if TEMP_SENSOR_1_IS_MAX_TC
1163
+  #if TEMP_SENSOR_1_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 1)
1164
     OUT_WRITE(MAX6675_SS2_PIN, HIGH); // Disable
1164
     OUT_WRITE(MAX6675_SS2_PIN, HIGH); // Disable
1165
   #endif
1165
   #endif
1166
 
1166
 

+ 1
- 5
Marlin/src/gcode/temp/M105.cpp View File

35
 
35
 
36
   #if HAS_TEMP_SENSOR
36
   #if HAS_TEMP_SENSOR
37
 
37
 
38
-    thermalManager.print_heater_states(target_extruder
39
-      #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
40
-        , parser.boolval('R')
41
-      #endif
42
-    );
38
+    thermalManager.print_heater_states(target_extruder OPTARG(HAS_TEMP_REDUNDANT, parser.boolval('R')));
43
 
39
 
44
     SERIAL_EOL();
40
     SERIAL_EOL();
45
 
41
 

+ 166
- 27
Marlin/src/inc/Conditionals_post.h View File

512
  * Temp Sensor defines
512
  * Temp Sensor defines
513
  */
513
  */
514
 
514
 
515
-#define ANY_TEMP_SENSOR_IS(n) (TEMP_SENSOR_0 == (n) || TEMP_SENSOR_1 == (n) || TEMP_SENSOR_2 == (n) || TEMP_SENSOR_3 == (n) || TEMP_SENSOR_4 == (n) || TEMP_SENSOR_5 == (n) || TEMP_SENSOR_6 == (n) || TEMP_SENSOR_7 == (n) || TEMP_SENSOR_BED == (n) || TEMP_SENSOR_PROBE == (n) || TEMP_SENSOR_CHAMBER == (n) || TEMP_SENSOR_COOLER == (n))
516
-
515
+#define ANY_TEMP_SENSOR_IS(n) ( \
516
+     n == TEMP_SENSOR_0 || n == TEMP_SENSOR_1 || n == TEMP_SENSOR_2 || n == TEMP_SENSOR_3 \
517
+  || n == TEMP_SENSOR_4 || n == TEMP_SENSOR_5 || n == TEMP_SENSOR_6 || n == TEMP_SENSOR_7 \
518
+  || n == TEMP_SENSOR_BED \
519
+  || n == TEMP_SENSOR_PROBE \
520
+  || n == TEMP_SENSOR_CHAMBER \
521
+  || n == TEMP_SENSOR_COOLER \
522
+  || n == TEMP_SENSOR_REDUNDANT )
517
 #if ANY_TEMP_SENSOR_IS(1000)
523
 #if ANY_TEMP_SENSOR_IS(1000)
518
   #define HAS_USER_THERMISTORS 1
524
   #define HAS_USER_THERMISTORS 1
519
 #endif
525
 #endif
526
+#undef ANY_TEMP_SENSOR_IS
527
+
528
+// Usurp a sensor to do redundant readings
529
+#if TEMP_SENSOR_REDUNDANT && !PIN_EXISTS(TEMP_REDUNDANT)
530
+  #if TEMP_SENSOR_REDUNDANT_SOURCE == -5
531
+    #if !PIN_EXISTS(TEMP_COOLER)
532
+      #error "TEMP_SENSOR_REDUNDANT_SOURCE set to COOLER requires TEMP_COOLER_PIN."
533
+    #else
534
+      #define TEMP_REDUNDANT_PIN TEMP_COOLER_PIN
535
+    #endif
536
+  #elif TEMP_SENSOR_REDUNDANT_SOURCE == -4
537
+    #if !PIN_EXISTS(TEMP_PROBE)
538
+      #error "TEMP_SENSOR_REDUNDANT_SOURCE set to PROBE requires TEMP_PROBE_PIN."
539
+    #else
540
+      #define TEMP_REDUNDANT_PIN TEMP_PROBE_PIN
541
+    #endif
542
+  #elif TEMP_SENSOR_REDUNDANT_SOURCE == -2
543
+    #if !PIN_EXISTS(TEMP_CHAMBER)
544
+      #error "TEMP_SENSOR_REDUNDANT_SOURCE set to CHAMBER requires TEMP_CHAMBER_PIN."
545
+    #else
546
+      #define TEMP_REDUNDANT_PIN TEMP_CHAMBER_PIN
547
+    #endif
548
+  #elif TEMP_SENSOR_REDUNDANT_SOURCE == -1
549
+    #if !PIN_EXISTS(TEMP_BED)
550
+      #error "TEMP_SENSOR_REDUNDANT_SOURCE set to BED requires TEMP_BED_PIN."
551
+    #else
552
+      #define TEMP_REDUNDANT_PIN TEMP_BED_PIN
553
+    #endif
554
+  #elif TEMP_SENSOR_REDUNDANT_SOURCE == 0
555
+    #if !PIN_EXISTS(TEMP_0)
556
+      #error "TEMP_SENSOR_REDUNDANT_SOURCE set to 0 requires TEMP_0_PIN."
557
+    #else
558
+      #define TEMP_REDUNDANT_PIN TEMP_0_PIN
559
+    #endif
560
+  #elif TEMP_SENSOR_REDUNDANT_SOURCE == 1
561
+    #if !PIN_EXISTS(TEMP_1)
562
+      #error "TEMP_SENSOR_REDUNDANT_SOURCE set to 1 requires TEMP_1_PIN."
563
+    #else
564
+      #define TEMP_REDUNDANT_PIN TEMP_1_PIN
565
+    #endif
566
+  #elif TEMP_SENSOR_REDUNDANT_SOURCE == 2
567
+    #if !PIN_EXISTS(TEMP_2)
568
+      #error "TEMP_SENSOR_REDUNDANT_SOURCE set to 2 requires TEMP_2_PIN."
569
+    #else
570
+      #define TEMP_REDUNDANT_PIN TEMP_2_PIN
571
+    #endif
572
+  #elif TEMP_SENSOR_REDUNDANT_SOURCE == 3
573
+    #if !PIN_EXISTS(TEMP_3)
574
+      #error "TEMP_SENSOR_REDUNDANT_SOURCE set to 3 requires TEMP_3_PIN."
575
+    #else
576
+      #define TEMP_REDUNDANT_PIN TEMP_3_PIN
577
+    #endif
578
+  #elif TEMP_SENSOR_REDUNDANT_SOURCE == 4
579
+    #if !PIN_EXISTS(TEMP_4)
580
+      #error "TEMP_SENSOR_REDUNDANT_SOURCE set to 4 requires TEMP_4_PIN."
581
+    #else
582
+      #define TEMP_REDUNDANT_PIN TEMP_4_PIN
583
+    #endif
584
+  #elif TEMP_SENSOR_REDUNDANT_SOURCE == 5
585
+    #if !PIN_EXISTS(TEMP_5)
586
+      #error "TEMP_SENSOR_REDUNDANT_SOURCE set to 5 requires TEMP_5_PIN."
587
+    #else
588
+      #define TEMP_REDUNDANT_PIN TEMP_5_PIN
589
+    #endif
590
+  #elif TEMP_SENSOR_REDUNDANT_SOURCE == 6
591
+    #if !PIN_EXISTS(TEMP_6)
592
+      #error "TEMP_SENSOR_REDUNDANT_SOURCE set to 6 requires TEMP_6_PIN."
593
+    #else
594
+      #define TEMP_REDUNDANT_PIN TEMP_6_PIN
595
+    #endif
596
+  #elif TEMP_SENSOR_REDUNDANT_SOURCE == 7
597
+    #if !PIN_EXISTS(TEMP_7)
598
+      #error "TEMP_SENSOR_REDUNDANT_SOURCE set to 7 requires TEMP_7_PIN."
599
+    #else
600
+      #define TEMP_REDUNDANT_PIN TEMP_7_PIN
601
+    #endif
602
+  #endif
603
+
604
+  #ifndef TEMP_SENSOR_REDUNDANT_MAX_DIFF
605
+    #define TEMP_SENSOR_REDUNDANT_MAX_DIFF 10
606
+  #endif
607
+#endif
520
 
608
 
521
 #if TEMP_SENSOR_0 == -5 || TEMP_SENSOR_0 == -3 || TEMP_SENSOR_0 == -2
609
 #if TEMP_SENSOR_0 == -5 || TEMP_SENSOR_0 == -3 || TEMP_SENSOR_0 == -2
522
   #define TEMP_SENSOR_0_IS_MAX_TC 1
610
   #define TEMP_SENSOR_0_IS_MAX_TC 1
540
 #elif TEMP_SENSOR_0 == -1
628
 #elif TEMP_SENSOR_0 == -1
541
   #define TEMP_SENSOR_0_IS_AD595 1
629
   #define TEMP_SENSOR_0_IS_AD595 1
542
 #elif TEMP_SENSOR_0 > 0
630
 #elif TEMP_SENSOR_0 > 0
543
-  #define TEMP_SENSOR_0_THERMISTOR_ID TEMP_SENSOR_0
544
   #define TEMP_SENSOR_0_IS_THERMISTOR 1
631
   #define TEMP_SENSOR_0_IS_THERMISTOR 1
545
   #if TEMP_SENSOR_0 == 1000
632
   #if TEMP_SENSOR_0 == 1000
546
     #define TEMP_SENSOR_0_IS_CUSTOM 1
633
     #define TEMP_SENSOR_0_IS_CUSTOM 1
583
 #elif TEMP_SENSOR_1 == -1
670
 #elif TEMP_SENSOR_1 == -1
584
   #define TEMP_SENSOR_1_IS_AD595 1
671
   #define TEMP_SENSOR_1_IS_AD595 1
585
 #elif TEMP_SENSOR_1 > 0
672
 #elif TEMP_SENSOR_1 > 0
586
-  #define TEMP_SENSOR_1_THERMISTOR_ID TEMP_SENSOR_1
587
   #define TEMP_SENSOR_1_IS_THERMISTOR 1
673
   #define TEMP_SENSOR_1_IS_THERMISTOR 1
588
   #if TEMP_SENSOR_1 == 1000
674
   #if TEMP_SENSOR_1 == 1000
589
     #define TEMP_SENSOR_1_IS_CUSTOM 1
675
     #define TEMP_SENSOR_1_IS_CUSTOM 1
595
   #undef HEATER_1_MAXTEMP
681
   #undef HEATER_1_MAXTEMP
596
 #endif
682
 #endif
597
 
683
 
598
-#if TEMP_SENSOR_0_IS_MAX31855 || TEMP_SENSOR_1_IS_MAX31855
684
+#if TEMP_SENSOR_REDUNDANT == -5 || TEMP_SENSOR_REDUNDANT == -3 || TEMP_SENSOR_REDUNDANT == -2
685
+  #define TEMP_SENSOR_REDUNDANT_IS_MAX_TC 1
686
+  #define HAS_MAX_TC 1
687
+  #if TEMP_SENSOR_REDUNDANT == -3
688
+    #define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN -270
689
+    #define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1800
690
+  #else
691
+    #define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN    0
692
+    #define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1024
693
+  #endif
694
+  #if TEMP_SENSOR_REDUNDANT_SOURCE == 0
695
+    #define TEMP_SENSOR_0_MAX_TC_TMIN TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN
696
+    #define TEMP_SENSOR_0_MAX_TC_TMAX TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX
697
+  #elif TEMP_SENSOR_REDUNDANT_SOURCE == 1
698
+    #define TEMP_SENSOR_1_MAX_TC_TMIN TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN
699
+    #define TEMP_SENSOR_1_MAX_TC_TMAX TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX
700
+  #endif
701
+  #if TEMP_SENSOR_REDUNDANT == -5
702
+    #if TEMP_SENSOR_REDUNDANT_SOURCE != 0 && TEMP_SENSOR_REDUNDANT_SOURCE != 1
703
+      #error "MAX31865 Thermocouples (-5) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
704
+    #endif
705
+    #define TEMP_SENSOR_REDUNDANT_IS_MAX31865 1
706
+  #elif TEMP_SENSOR_REDUNDANT == -3
707
+    #if TEMP_SENSOR_REDUNDANT_SOURCE != 0 && TEMP_SENSOR_REDUNDANT_SOURCE != 1
708
+      #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
709
+    #endif
710
+    #define TEMP_SENSOR_REDUNDANT_IS_MAX31855 1
711
+  #elif TEMP_SENSOR_REDUNDANT == -2
712
+    #if TEMP_SENSOR_REDUNDANT_SOURCE != 0 && TEMP_SENSOR_REDUNDANT_SOURCE != 1
713
+      #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
714
+    #endif
715
+    #define TEMP_SENSOR_REDUNDANT_IS_MAX6675 1
716
+  #endif
717
+  #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)
718
+    #if   TEMP_SENSOR_REDUNDANT == -5
719
+      #error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match."
720
+    #elif TEMP_SENSOR_REDUNDANT == -3
721
+      #error "If MAX31855 Thermocouple (-3) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match."
722
+    #elif TEMP_SENSOR_REDUNDANT == -2
723
+      #error "If MAX6675 Thermocouple (-2) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match."
724
+    #endif
725
+  #endif
726
+#elif TEMP_SENSOR_REDUNDANT == -4
727
+  #define TEMP_SENSOR_REDUNDANT_IS_AD8495 1
728
+#elif TEMP_SENSOR_REDUNDANT == -1
729
+  #define TEMP_SENSOR_REDUNDANT_IS_AD595 1
730
+#elif TEMP_SENSOR_REDUNDANT > 0
731
+  #define TEMP_SENSOR_REDUNDANT_IS_THERMISTOR 1
732
+  #if TEMP_SENSOR_REDUNDANT == 1000
733
+    #define TEMP_SENSOR_REDUNDANT_IS_CUSTOM 1
734
+  #elif TEMP_SENSOR_REDUNDANT == 998 || TEMP_SENSOR_REDUNDANT == 999
735
+    #error "Dummy sensors are not supported for TEMP_SENSOR_REDUNDANT."
736
+  #endif
737
+#endif
738
+
739
+#if TEMP_SENSOR_0_IS_MAX31855 || TEMP_SENSOR_1_IS_MAX31855 || TEMP_SENSOR_REDUNDANT_IS_MAX31855
599
   #define HAS_MAX31855 1
740
   #define HAS_MAX31855 1
600
 #endif
741
 #endif
601
-#if TEMP_SENSOR_0_IS_MAX31865 || TEMP_SENSOR_1_IS_MAX31865
742
+#if TEMP_SENSOR_0_IS_MAX31865 || TEMP_SENSOR_1_IS_MAX31865 || TEMP_SENSOR_REDUNDANT_IS_MAX31865
602
   #define HAS_MAX31865 1
743
   #define HAS_MAX31865 1
603
 #endif
744
 #endif
604
-#if TEMP_SENSOR_0_IS_MAX6675 || TEMP_SENSOR_1_IS_MAX6675
745
+#if TEMP_SENSOR_0_IS_MAX6675 || TEMP_SENSOR_1_IS_MAX6675 || TEMP_SENSOR_REDUNDANT_IS_MAX6675
605
   #define HAS_MAX6675 1
746
   #define HAS_MAX6675 1
606
 #endif
747
 #endif
607
 
748
 
608
 //
749
 //
609
 // Compatibility layer for MAX (SPI) temp boards
750
 // Compatibility layer for MAX (SPI) temp boards
610
 //
751
 //
752
+#define TEMP_SENSOR_IS_MAX(n, M) (ENABLED(TEMP_SENSOR_##n##_IS_##M) || (ENABLED(TEMP_SENSOR_REDUNDANT_IS_##M) && TEMP_SENSOR_REDUNDANT_SOURCE == (n)))
753
+
611
 #if PIN_EXISTS(MAX6675_SS)
754
 #if PIN_EXISTS(MAX6675_SS)
612
-  #if TEMP_SENSOR_0_IS_MAX31855
755
+  #if TEMP_SENSOR_IS_MAX(0, MAX31855)
613
     #define MAX31855_CS_PIN MAX6675_SS_PIN
756
     #define MAX31855_CS_PIN MAX6675_SS_PIN
614
-  #elif TEMP_SENSOR_0_IS_MAX31865
757
+  #elif TEMP_SENSOR_IS_MAX(0, MAX31865)
615
     #define MAX31865_CS_PIN MAX6675_SS_PIN
758
     #define MAX31865_CS_PIN MAX6675_SS_PIN
616
-  #elif TEMP_SENSOR_0_IS_MAX6675
759
+  #elif TEMP_SENSOR_IS_MAX(0, MAX6675)
617
     #define MAX6675_CS_PIN MAX6675_SS_PIN
760
     #define MAX6675_CS_PIN MAX6675_SS_PIN
618
   #endif
761
   #endif
619
 #endif
762
 #endif
620
 
763
 
621
 #if PIN_EXISTS(MAX6675_SS2)
764
 #if PIN_EXISTS(MAX6675_SS2)
622
-  #if TEMP_SENSOR_1_IS_MAX31855
765
+  #if TEMP_SENSOR_IS_MAX(1, MAX31855)
623
     #define MAX31855_CS2_PIN MAX6675_SS2_PIN
766
     #define MAX31855_CS2_PIN MAX6675_SS2_PIN
624
-  #elif TEMP_SENSOR_1_IS_MAX31865
767
+  #elif TEMP_SENSOR_IS_MAX(1, MAX31865)
625
     #define MAX31865_CS2_PIN MAX6675_SS2_PIN
768
     #define MAX31865_CS2_PIN MAX6675_SS2_PIN
626
-  #elif TEMP_SENSOR_1_IS_MAX6675
769
+  #elif TEMP_SENSOR_IS_MAX(1, MAX6675)
627
     #define MAX6675_CS2_PIN MAX6675_SS2_PIN
770
     #define MAX6675_CS2_PIN MAX6675_SS2_PIN
628
   #endif
771
   #endif
629
 #endif
772
 #endif
698
 #elif TEMP_SENSOR_2 == -1
841
 #elif TEMP_SENSOR_2 == -1
699
   #define TEMP_SENSOR_2_IS_AD595 1
842
   #define TEMP_SENSOR_2_IS_AD595 1
700
 #elif TEMP_SENSOR_2 > 0
843
 #elif TEMP_SENSOR_2 > 0
701
-  #define TEMP_SENSOR_2_THERMISTOR_ID TEMP_SENSOR_2
702
   #define TEMP_SENSOR_2_IS_THERMISTOR 1
844
   #define TEMP_SENSOR_2_IS_THERMISTOR 1
703
   #if TEMP_SENSOR_2 == 1000
845
   #if TEMP_SENSOR_2 == 1000
704
     #define TEMP_SENSOR_2_IS_CUSTOM 1
846
     #define TEMP_SENSOR_2_IS_CUSTOM 1
719
 #elif TEMP_SENSOR_3 == -1
861
 #elif TEMP_SENSOR_3 == -1
720
   #define TEMP_SENSOR_3_IS_AD595 1
862
   #define TEMP_SENSOR_3_IS_AD595 1
721
 #elif TEMP_SENSOR_3 > 0
863
 #elif TEMP_SENSOR_3 > 0
722
-  #define TEMP_SENSOR_3_THERMISTOR_ID TEMP_SENSOR_3
723
   #define TEMP_SENSOR_3_IS_THERMISTOR 1
864
   #define TEMP_SENSOR_3_IS_THERMISTOR 1
724
   #if TEMP_SENSOR_3 == 1000
865
   #if TEMP_SENSOR_3 == 1000
725
     #define TEMP_SENSOR_3_IS_CUSTOM 1
866
     #define TEMP_SENSOR_3_IS_CUSTOM 1
740
 #elif TEMP_SENSOR_4 == -1
881
 #elif TEMP_SENSOR_4 == -1
741
   #define TEMP_SENSOR_4_IS_AD595 1
882
   #define TEMP_SENSOR_4_IS_AD595 1
742
 #elif TEMP_SENSOR_4 > 0
883
 #elif TEMP_SENSOR_4 > 0
743
-  #define TEMP_SENSOR_4_THERMISTOR_ID TEMP_SENSOR_4
744
   #define TEMP_SENSOR_4_IS_THERMISTOR 1
884
   #define TEMP_SENSOR_4_IS_THERMISTOR 1
745
   #if TEMP_SENSOR_4 == 1000
885
   #if TEMP_SENSOR_4 == 1000
746
     #define TEMP_SENSOR_4_IS_CUSTOM 1
886
     #define TEMP_SENSOR_4_IS_CUSTOM 1
761
 #elif TEMP_SENSOR_5 == -1
901
 #elif TEMP_SENSOR_5 == -1
762
   #define TEMP_SENSOR_5_IS_AD595 1
902
   #define TEMP_SENSOR_5_IS_AD595 1
763
 #elif TEMP_SENSOR_5 > 0
903
 #elif TEMP_SENSOR_5 > 0
764
-  #define TEMP_SENSOR_5_THERMISTOR_ID TEMP_SENSOR_5
765
   #define TEMP_SENSOR_5_IS_THERMISTOR 1
904
   #define TEMP_SENSOR_5_IS_THERMISTOR 1
766
   #if TEMP_SENSOR_5 == 1000
905
   #if TEMP_SENSOR_5 == 1000
767
     #define TEMP_SENSOR_5_IS_CUSTOM 1
906
     #define TEMP_SENSOR_5_IS_CUSTOM 1
782
 #elif TEMP_SENSOR_6 == -1
921
 #elif TEMP_SENSOR_6 == -1
783
   #define TEMP_SENSOR_6_IS_AD595 1
922
   #define TEMP_SENSOR_6_IS_AD595 1
784
 #elif TEMP_SENSOR_6 > 0
923
 #elif TEMP_SENSOR_6 > 0
785
-  #define TEMP_SENSOR_6_THERMISTOR_ID TEMP_SENSOR_6
786
   #define TEMP_SENSOR_6_IS_THERMISTOR 1
924
   #define TEMP_SENSOR_6_IS_THERMISTOR 1
787
   #if TEMP_SENSOR_6 == 1000
925
   #if TEMP_SENSOR_6 == 1000
788
     #define TEMP_SENSOR_6_IS_CUSTOM 1
926
     #define TEMP_SENSOR_6_IS_CUSTOM 1
803
 #elif TEMP_SENSOR_7 == -1
941
 #elif TEMP_SENSOR_7 == -1
804
   #define TEMP_SENSOR_7_IS_AD595 1
942
   #define TEMP_SENSOR_7_IS_AD595 1
805
 #elif TEMP_SENSOR_7 > 0
943
 #elif TEMP_SENSOR_7 > 0
806
-  #define TEMP_SENSOR_7_THERMISTOR_ID TEMP_SENSOR_7
807
   #define TEMP_SENSOR_7_IS_THERMISTOR 1
944
   #define TEMP_SENSOR_7_IS_THERMISTOR 1
808
   #if TEMP_SENSOR_7 == 1000
945
   #if TEMP_SENSOR_7 == 1000
809
     #define TEMP_SENSOR_7_IS_CUSTOM 1
946
     #define TEMP_SENSOR_7_IS_CUSTOM 1
824
 #elif TEMP_SENSOR_BED == -1
961
 #elif TEMP_SENSOR_BED == -1
825
   #define TEMP_SENSOR_BED_IS_AD595 1
962
   #define TEMP_SENSOR_BED_IS_AD595 1
826
 #elif TEMP_SENSOR_BED > 0
963
 #elif TEMP_SENSOR_BED > 0
827
-  #define TEMP_SENSOR_BED_THERMISTOR_ID TEMP_SENSOR_BED
828
   #define TEMP_SENSOR_BED_IS_THERMISTOR 1
964
   #define TEMP_SENSOR_BED_IS_THERMISTOR 1
829
   #if TEMP_SENSOR_BED == 1000
965
   #if TEMP_SENSOR_BED == 1000
830
     #define TEMP_SENSOR_BED_IS_CUSTOM 1
966
     #define TEMP_SENSOR_BED_IS_CUSTOM 1
845
 #elif TEMP_SENSOR_CHAMBER == -1
981
 #elif TEMP_SENSOR_CHAMBER == -1
846
   #define TEMP_SENSOR_CHAMBER_IS_AD595 1
982
   #define TEMP_SENSOR_CHAMBER_IS_AD595 1
847
 #elif TEMP_SENSOR_CHAMBER > 0
983
 #elif TEMP_SENSOR_CHAMBER > 0
848
-  #define TEMP_SENSOR_CHAMBER_THERMISTOR_ID TEMP_SENSOR_CHAMBER
849
   #define TEMP_SENSOR_CHAMBER_IS_THERMISTOR 1
984
   #define TEMP_SENSOR_CHAMBER_IS_THERMISTOR 1
850
   #if TEMP_SENSOR_CHAMBER == 1000
985
   #if TEMP_SENSOR_CHAMBER == 1000
851
     #define TEMP_SENSOR_CHAMBER_IS_CUSTOM 1
986
     #define TEMP_SENSOR_CHAMBER_IS_CUSTOM 1
858
 #endif
993
 #endif
859
 
994
 
860
 #if TEMP_SENSOR_COOLER == -4
995
 #if TEMP_SENSOR_COOLER == -4
861
-  #define COOLER_USES_AD8495 1
996
+  #define TEMP_SENSOR_COOLER_IS_AD8495 1
862
 #elif TEMP_SENSOR_COOLER == -3
997
 #elif TEMP_SENSOR_COOLER == -3
863
   #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_COOLER."
998
   #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_COOLER."
864
 #elif TEMP_SENSOR_COOLER == -2
999
 #elif TEMP_SENSOR_COOLER == -2
865
   #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_COOLER."
1000
   #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_COOLER."
866
 #elif TEMP_SENSOR_COOLER == -1
1001
 #elif TEMP_SENSOR_COOLER == -1
867
-  #define COOLER_USES_AD595 1
1002
+  #define TEMP_SENSOR_COOLER_IS_AD595 1
868
 #elif TEMP_SENSOR_COOLER > 0
1003
 #elif TEMP_SENSOR_COOLER > 0
869
-  #define TEMP_SENSOR_COOLER_THERMISTOR_ID TEMP_SENSOR_COOLER
870
   #define TEMP_SENSOR_COOLER_IS_THERMISTOR 1
1004
   #define TEMP_SENSOR_COOLER_IS_THERMISTOR 1
871
   #if TEMP_SENSOR_COOLER == 1000
1005
   #if TEMP_SENSOR_COOLER == 1000
872
-    #define COOLER_USER_THERMISTOR 1
1006
+    #define TEMP_SENSOR_COOLER_IS_CUSTOM 1
873
   #elif TEMP_SENSOR_COOLER == 998 || TEMP_SENSOR_COOLER == 999
1007
   #elif TEMP_SENSOR_COOLER == 998 || TEMP_SENSOR_COOLER == 999
874
-    #define COOLER_DUMMY_THERMISTOR 1
1008
+    #define TEMP_SENSOR_COOLER_IS_DUMMY 1
875
   #endif
1009
   #endif
876
 #else
1010
 #else
877
   #undef COOLER_MINTEMP
1011
   #undef COOLER_MINTEMP
887
 #elif TEMP_SENSOR_PROBE == -1
1021
 #elif TEMP_SENSOR_PROBE == -1
888
   #define TEMP_SENSOR_PROBE_IS_AD595 1
1022
   #define TEMP_SENSOR_PROBE_IS_AD595 1
889
 #elif TEMP_SENSOR_PROBE > 0
1023
 #elif TEMP_SENSOR_PROBE > 0
890
-  #define TEMP_SENSOR_PROBE_THERMISTOR_ID TEMP_SENSOR_PROBE
891
   #define TEMP_SENSOR_PROBE_IS_THERMISTOR 1
1024
   #define TEMP_SENSOR_PROBE_IS_THERMISTOR 1
892
   #if TEMP_SENSOR_PROBE == 1000
1025
   #if TEMP_SENSOR_PROBE == 1000
893
     #define TEMP_SENSOR_PROBE_IS_CUSTOM 1
1026
     #define TEMP_SENSOR_PROBE_IS_CUSTOM 1
2345
 #if HAS_ADC_TEST(COOLER)
2478
 #if HAS_ADC_TEST(COOLER)
2346
   #define HAS_TEMP_ADC_COOLER 1
2479
   #define HAS_TEMP_ADC_COOLER 1
2347
 #endif
2480
 #endif
2481
+#if HAS_ADC_TEST(REDUNDANT)
2482
+  #define HAS_TEMP_ADC_REDUNDANT 1
2483
+#endif
2348
 
2484
 
2349
 #define HAS_TEMP(N) ANY(HAS_TEMP_ADC_##N, TEMP_SENSOR_##N##_IS_MAX_TC, TEMP_SENSOR_##N##_IS_DUMMY)
2485
 #define HAS_TEMP(N) ANY(HAS_TEMP_ADC_##N, TEMP_SENSOR_##N##_IS_MAX_TC, TEMP_SENSOR_##N##_IS_DUMMY)
2350
 #if HAS_HOTEND && HAS_TEMP(0)
2486
 #if HAS_HOTEND && HAS_TEMP(0)
2362
 #if HAS_TEMP(COOLER)
2498
 #if HAS_TEMP(COOLER)
2363
   #define HAS_TEMP_COOLER 1
2499
   #define HAS_TEMP_COOLER 1
2364
 #endif
2500
 #endif
2501
+#if HAS_TEMP(REDUNDANT)
2502
+  #define HAS_TEMP_REDUNDANT 1
2503
+#endif
2365
 
2504
 
2366
 #if ENABLED(JOYSTICK)
2505
 #if ENABLED(JOYSTICK)
2367
   #if PIN_EXISTS(JOY_X)
2506
   #if PIN_EXISTS(JOY_X)

+ 79
- 12
Marlin/src/inc/SanityCheck.h View File

568
   #error "MKS_LCD12864 is now MKS_LCD12864A or MKS_LCD12864B."
568
   #error "MKS_LCD12864 is now MKS_LCD12864A or MKS_LCD12864B."
569
 #elif defined(NEOPIXEL_BKGD_LED_INDEX)
569
 #elif defined(NEOPIXEL_BKGD_LED_INDEX)
570
   #error "NEOPIXEL_BKGD_LED_INDEX is now NEOPIXEL_BKGD_INDEX_FIRST."
570
   #error "NEOPIXEL_BKGD_LED_INDEX is now NEOPIXEL_BKGD_INDEX_FIRST."
571
+#elif defined(TEMP_SENSOR_1_AS_REDUNDANT)
572
+  #error "TEMP_SENSOR_1_AS_REDUNDANT is now TEMP_SENSOR_REDUNDANT, with associated TEMP_SENSOR_REDUNDANT_* config."
573
+#elif defined(MAX_REDUNDANT_TEMP_SENSOR_DIFF)
574
+  #error "MAX_REDUNDANT_TEMP_SENSOR_DIFF is now TEMP_SENSOR_REDUNDANT_MAX_DIFF"
571
 #endif
575
 #endif
572
 
576
 
573
 constexpr float arm[] = AXIS_RELATIVE_MODES;
577
 constexpr float arm[] = AXIS_RELATIVE_MODES;
1887
   #error "TEMP_SENSOR_CHAMBER 1000 requires CHAMBER_PULLUP_RESISTOR_OHMS, CHAMBER_RESISTANCE_25C_OHMS and CHAMBER_BETA in Configuration_adv.h."
1891
   #error "TEMP_SENSOR_CHAMBER 1000 requires CHAMBER_PULLUP_RESISTOR_OHMS, CHAMBER_RESISTANCE_25C_OHMS and CHAMBER_BETA in Configuration_adv.h."
1888
 #elif TEMP_SENSOR_PROBE_IS_CUSTOM && !(defined(PROBE_PULLUP_RESISTOR_OHMS) && defined(PROBE_RESISTANCE_25C_OHMS) && defined(PROBE_BETA))
1892
 #elif TEMP_SENSOR_PROBE_IS_CUSTOM && !(defined(PROBE_PULLUP_RESISTOR_OHMS) && defined(PROBE_RESISTANCE_25C_OHMS) && defined(PROBE_BETA))
1889
   #error "TEMP_SENSOR_PROBE 1000 requires PROBE_PULLUP_RESISTOR_OHMS, PROBE_RESISTANCE_25C_OHMS and PROBE_BETA in Configuration_adv.h."
1893
   #error "TEMP_SENSOR_PROBE 1000 requires PROBE_PULLUP_RESISTOR_OHMS, PROBE_RESISTANCE_25C_OHMS and PROBE_BETA in Configuration_adv.h."
1894
+#elif TEMP_SENSOR_REDUNDANT_IS_CUSTOM && !(defined(REDUNDANT_PULLUP_RESISTOR_OHMS) && defined(REDUNDANT_RESISTANCE_25C_OHMS) && defined(REDUNDANT_BETA))
1895
+  #error "TEMP_SENSOR_REDUNDANT 1000 requires REDUNDANT_PULLUP_RESISTOR_OHMS, REDUNDANT_RESISTANCE_25C_OHMS and REDUNDANT_BETA in Configuration_adv.h."
1890
 #endif
1896
 #endif
1891
 
1897
 
1892
 /**
1898
 /**
1893
  * Pins and Sensor IDs must be set for each heater
1899
  * Pins and Sensor IDs must be set for each heater
1894
  */
1900
  */
1895
 #if TEMP_SENSOR_0_IS_MAX6675 && !ANY_PIN(MAX6675_SS, MAX31855_CS, MAX31865_CS, MAX6675_CS)
1901
 #if TEMP_SENSOR_0_IS_MAX6675 && !ANY_PIN(MAX6675_SS, MAX31855_CS, MAX31865_CS, MAX6675_CS)
1896
-  #error "TEMP_SENSOR_0 requires a MAX6675_SS_PIN, MAX6675_CS_PIN, MAX31855_CS_PIN, or MAX31865_CS_PIN."
1902
+  #error "TEMP_SENSOR_0 -2 requires a MAX6675_SS_PIN, MAX6675_CS_PIN, MAX31855_CS_PIN, or MAX31865_CS_PIN."
1897
 #elif HAS_HOTEND && !HAS_TEMP_HOTEND && !TEMP_SENSOR_0_IS_DUMMY
1903
 #elif HAS_HOTEND && !HAS_TEMP_HOTEND && !TEMP_SENSOR_0_IS_DUMMY
1898
   #error "TEMP_0_PIN (required for TEMP_SENSOR_0) not defined for this board."
1904
   #error "TEMP_0_PIN (required for TEMP_SENSOR_0) not defined for this board."
1899
 #elif EITHER(HAS_MULTI_HOTEND, HEATERS_PARALLEL) && !HAS_HEATER_1
1905
 #elif EITHER(HAS_MULTI_HOTEND, HEATERS_PARALLEL) && !HAS_HEATER_1
1900
   #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."
1906
   #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."
1901
 #endif
1907
 #endif
1902
 
1908
 
1909
+/**
1910
+ * Redundant temperature sensor config
1911
+ */
1912
+#if HAS_TEMP_REDUNDANT
1913
+  #if !defined(TEMP_SENSOR_REDUNDANT_SOURCE)
1914
+    #error "TEMP_SENSOR_REDUNDANT requires TEMP_SENSOR_REDUNDANT_SOURCE."
1915
+  #elif !defined(TEMP_SENSOR_REDUNDANT_TARGET)
1916
+    #error "TEMP_SENSOR_REDUNDANT requires TEMP_SENSOR_REDUNDANT_TARGET."
1917
+  #elif TEMP_SENSOR_REDUNDANT_SOURCE == TEMP_SENSOR_REDUNDANT_TARGET
1918
+    #error "TEMP_SENSOR_REDUNDANT_SOURCE can't be the same as TEMP_SENSOR_REDUNDANT_TARGET."
1919
+  #elif TEMP_SENSOR_REDUNDANT_SOURCE < -5 || TEMP_SENSOR_REDUNDANT_SOURCE > 7
1920
+    #error "TEMP_SENSOR_REDUNDANT_SOURCE must be between -5 and 7."
1921
+  #elif TEMP_SENSOR_REDUNDANT_TARGET < -5 || TEMP_SENSOR_REDUNDANT_TARGET > 7
1922
+    #error "TEMP_SENSOR_REDUNDANT_TARGET must be between -5 and 7."
1923
+  #elif TEMP_SENSOR_REDUNDANT_SOURCE == -3
1924
+    #error "TEMP_SENSOR_REDUNDANT_SOURCE can't be -3 (not used)."
1925
+  #elif TEMP_SENSOR_REDUNDANT_TARGET == -3
1926
+    #error "TEMP_SENSOR_REDUNDANT_TARGET can't be -3 (not used)."
1927
+  #elif HAS_MULTI_HOTEND && TEMP_SENSOR_REDUNDANT_SOURCE < HOTENDS
1928
+    #error "TEMP_SENSOR_REDUNDANT_SOURCE must be after the last TEMP_SENSOR used with a hotend; you can't use a sensor in the middle of two hotends."
1929
+  #endif
1930
+
1931
+  #if TEMP_SENSOR_REDUNDANT_SOURCE == 0 && HAS_HOTEND
1932
+    #error "TEMP_SENSOR_REDUNDANT_SOURCE can not be 0 if a hotend is used. E0 always uses TEMP_SENSOR_0."
1933
+  #elif TEMP_SENSOR_REDUNDANT_SOURCE == -5 && HAS_TEMP_COOLER
1934
+    #error "TEMP_SENSOR_REDUNDANT_SOURCE can't be Cooler (-5): TEMP_SENSOR_COOLER has already defined the sensor."
1935
+  #elif TEMP_SENSOR_REDUNDANT_SOURCE == -4 && HAS_TEMP_PROBE
1936
+    #error "TEMP_SENSOR_REDUNDANT_SOURCE can't be Probe (-4): TEMP_SENSOR_PROBE has already defined the sensor."
1937
+  #elif TEMP_SENSOR_REDUNDANT_SOURCE == -2 && HAS_TEMP_CHAMBER
1938
+    #error "TEMP_SENSOR_REDUNDANT_SOURCE can't be Chamber (-2): TEMP_SENSOR_CHAMBER has already defined the sensor."
1939
+  #elif TEMP_SENSOR_REDUNDANT_SOURCE == -1 && HAS_TEMP_BED
1940
+    #error "TEMP_SENSOR_REDUNDANT_SOURCE can't be Bed (-1): TEMP_SENSOR_BED has already defined the sensor."
1941
+  #endif
1942
+
1943
+  #if TEMP_SENSOR_REDUNDANT_TARGET == 0 && !PIN_EXISTS(TEMP_0)
1944
+    #error "TEMP_SENSOR_REDUNDANT_TARGET can't be E0 (0): requires TEMP_0_PIN"
1945
+  #elif TEMP_SENSOR_REDUNDANT_TARGET == 1 && !PIN_EXISTS(TEMP_1)
1946
+    #error "TEMP_SENSOR_REDUNDANT_TARGET can't be E1 (1): requires TEMP_1_PIN"
1947
+  #elif TEMP_SENSOR_REDUNDANT_TARGET == 2 && !PIN_EXISTS(TEMP_2)
1948
+    #error "TEMP_SENSOR_REDUNDANT_TARGET can't be E2 (2): requires TEMP_2_PIN"
1949
+  #elif TEMP_SENSOR_REDUNDANT_TARGET == 3 && !PIN_EXISTS(TEMP_3)
1950
+    #error "TEMP_SENSOR_REDUNDANT_TARGET can't be E3 (3): requires TEMP_3_PIN"
1951
+  #elif TEMP_SENSOR_REDUNDANT_TARGET == 4 && !PIN_EXISTS(TEMP_4)
1952
+    #error "TEMP_SENSOR_REDUNDANT_TARGET can't be E4 (4): requires TEMP_4_PIN"
1953
+  #elif TEMP_SENSOR_REDUNDANT_TARGET == 5 && !PIN_EXISTS(TEMP_5)
1954
+    #error "TEMP_SENSOR_REDUNDANT_TARGET can't be E5 (5): requires TEMP_5_PIN"
1955
+  #elif TEMP_SENSOR_REDUNDANT_TARGET == 6 && !PIN_EXISTS(TEMP_6)
1956
+    #error "TEMP_SENSOR_REDUNDANT_TARGET can't be E6 (6): requires TEMP_6_PIN"
1957
+  #elif TEMP_SENSOR_REDUNDANT_TARGET == 7 && !PIN_EXISTS(TEMP_7)
1958
+    #error "TEMP_SENSOR_REDUNDANT_TARGET can't be E7 (7): requires TEMP_7_PIN"
1959
+  #elif TEMP_SENSOR_REDUNDANT_TARGET == -1 && !PIN_EXISTS(TEMP_BED)
1960
+    #error "TEMP_SENSOR_REDUNDANT_TARGET can't be Bed (-1): requires TEMP_BED_PIN"
1961
+  #elif TEMP_SENSOR_REDUNDANT_TARGET == -2 && !PIN_EXISTS(TEMP_CHAMBER)
1962
+    #error "TEMP_SENSOR_REDUNDANT_TARGET can't be Chamber (-2): requires TEMP_CHAMBER_PIN"
1963
+  #elif TEMP_SENSOR_REDUNDANT_TARGET == -4 && !PIN_EXISTS(TEMP_PROBE)
1964
+    #error "TEMP_SENSOR_REDUNDANT_TARGET can't be Probe (-4): requires TEMP_PROBE_PIN"
1965
+  #elif TEMP_SENSOR_REDUNDANT_TARGET == -5 && !PIN_EXISTS(TEMP_COOLER)
1966
+    #error "TEMP_SENSOR_REDUNDANT_TARGET can't be Cooler (-5): requires TEMP_COOLER_PIN"
1967
+  #endif
1968
+
1969
+  #if TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 0 && !PIN_EXISTS(MAX6675_SS)
1970
+    #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."
1971
+  #elif TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 1 && !PIN_EXISTS(MAX6675_SS2)
1972
+    #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."
1973
+  #endif
1974
+#endif
1975
+
1903
 #if HAS_MULTI_HOTEND
1976
 #if HAS_MULTI_HOTEND
1904
   #if TEMP_SENSOR_1_IS_MAX6675 && !ANY_PIN(MAX6675_SS2, MAX31855_CS2, MAX31865_CS2, MAX6675_CS2)
1977
   #if TEMP_SENSOR_1_IS_MAX6675 && !ANY_PIN(MAX6675_SS2, MAX31855_CS2, MAX31865_CS2, MAX6675_CS2)
1905
     #error "TEMP_SENSOR_1 requires a MAX6675_SS2_PIN, MAX6675_CS2_PIN, MAX31855_CS2_PIN, or MAX31865_CS2_PIN."
1978
     #error "TEMP_SENSOR_1 requires a MAX6675_SS2_PIN, MAX6675_CS2_PIN, MAX31855_CS2_PIN, or MAX31865_CS2_PIN."
1907
     #error "TEMP_SENSOR_1 is required with 2 or more HOTENDS."
1980
     #error "TEMP_SENSOR_1 is required with 2 or more HOTENDS."
1908
   #elif !ANY_PIN(TEMP_1, MAX6675_SS2) && !TEMP_SENSOR_1_IS_DUMMY
1981
   #elif !ANY_PIN(TEMP_1, MAX6675_SS2) && !TEMP_SENSOR_1_IS_DUMMY
1909
     #error "TEMP_1_PIN or MAX6675_SS2_PIN not defined for this board."
1982
     #error "TEMP_1_PIN or MAX6675_SS2_PIN not defined for this board."
1910
-  #elif ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
1911
-    #error "HOTENDS must be 1 with TEMP_SENSOR_1_AS_REDUNDANT."
1912
   #endif
1983
   #endif
1913
   #if HOTENDS > 2
1984
   #if HOTENDS > 2
1914
     #if TEMP_SENSOR_2 == 0
1985
     #if TEMP_SENSOR_2 == 0
2006
   #elif TEMP_SENSOR_7 != 0
2077
   #elif TEMP_SENSOR_7 != 0
2007
     #error "TEMP_SENSOR_7 shouldn't be set with only 2 HOTENDS."
2078
     #error "TEMP_SENSOR_7 shouldn't be set with only 2 HOTENDS."
2008
   #endif
2079
   #endif
2009
-#elif TEMP_SENSOR_1 != 0 && DISABLED(TEMP_SENSOR_1_AS_REDUNDANT)
2080
+#elif TEMP_SENSOR_1 != 0
2010
   #error "TEMP_SENSOR_1 shouldn't be set with only 1 HOTEND."
2081
   #error "TEMP_SENSOR_1 shouldn't be set with only 1 HOTEND."
2011
 #elif TEMP_SENSOR_2 != 0
2082
 #elif TEMP_SENSOR_2 != 0
2012
   #error "TEMP_SENSOR_2 shouldn't be set with only 1 HOTEND."
2083
   #error "TEMP_SENSOR_2 shouldn't be set with only 1 HOTEND."
2068
   #endif
2139
   #endif
2069
 #endif
2140
 #endif
2070
 
2141
 
2071
-#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) && TEMP_SENSOR_1 == 0
2072
-  #error "TEMP_SENSOR_1 is required with TEMP_SENSOR_1_AS_REDUNDANT."
2073
-#endif
2074
-
2075
-#if TEMP_SENSOR_0_IS_MAX31865 && !(defined(MAX31865_SENSOR_OHMS_0) && defined(MAX31865_CALIBRATION_OHMS_0))
2076
-  #error "MAX31865_SENSOR_OHMS_0 and MAX31865_CALIBRATION_OHMS_0 must be set if TEMP_SENSOR_0 is MAX31865."
2077
-#elif TEMP_SENSOR_1_IS_MAX31865 && !(defined(MAX31865_SENSOR_OHMS_1) && defined(MAX31865_CALIBRATION_OHMS_1))
2078
-  #error "MAX31865_SENSOR_OHMS_1 and MAX31865_CALIBRATION_OHMS_1 must be set if TEMP_SENSOR_1 is MAX31865."
2142
+#if TEMP_SENSOR_IS_MAX(0, MAX31865) && !(defined(MAX31865_SENSOR_OHMS_0) && defined(MAX31865_CALIBRATION_OHMS_0))
2143
+  #error "MAX31865_SENSOR_OHMS_0 and MAX31865_CALIBRATION_OHMS_0 must be set if TEMP_SENSOR_0/TEMP_SENSOR_REDUNDANT is MAX31865."
2144
+#elif TEMP_SENSOR_IS_MAX(1, MAX31865) && !(defined(MAX31865_SENSOR_OHMS_1) && defined(MAX31865_CALIBRATION_OHMS_1))
2145
+  #error "MAX31865_SENSOR_OHMS_1 and MAX31865_CALIBRATION_OHMS_1 must be set if TEMP_SENSOR_1/TEMP_SENSOR_REDUNDANT is MAX31865."
2079
 #endif
2146
 #endif
2080
 
2147
 
2081
 /**
2148
 /**

+ 145
- 72
Marlin/src/module/temperature.cpp View File

56
   #include "../feature/host_actions.h"
56
   #include "../feature/host_actions.h"
57
 #endif
57
 #endif
58
 
58
 
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
+
59
 // LIB_MAX31855 can be added to the build_flags in platformio.ini to use a user-defined library
61
 // LIB_MAX31855 can be added to the build_flags in platformio.ini to use a user-defined library
60
 #if LIB_USR_MAX31855
62
 #if LIB_USR_MAX31855
61
   #include <Adafruit_MAX31855.h>
63
   #include <Adafruit_MAX31855.h>
62
   #if PIN_EXISTS(MAX31855_MISO) && PIN_EXISTS(MAX31855_SCK)
64
   #if PIN_EXISTS(MAX31855_MISO) && PIN_EXISTS(MAX31855_SCK)
63
     #define MAX31855_USES_SW_SPI 1
65
     #define MAX31855_USES_SW_SPI 1
64
   #endif
66
   #endif
65
-  #if TEMP_SENSOR_0_IS_MAX31855 && PIN_EXISTS(MAX31855_CS)
67
+  #if TEMP_SENSOR_IS_MAX(0, MAX31855) && PIN_EXISTS(MAX31855_CS)
66
     #define HAS_MAX31855_TEMP 1
68
     #define HAS_MAX31855_TEMP 1
67
     Adafruit_MAX31855 max31855_0 = Adafruit_MAX31855(MAX31855_CS_PIN
69
     Adafruit_MAX31855 max31855_0 = Adafruit_MAX31855(MAX31855_CS_PIN
68
       #if MAX31855_USES_SW_SPI
70
       #if MAX31855_USES_SW_SPI
73
       #endif
75
       #endif
74
     );
76
     );
75
   #endif
77
   #endif
76
-  #if TEMP_SENSOR_1_IS_MAX31855 && PIN_EXISTS(MAX31855_CS2)
78
+  #if TEMP_SENSOR_IS_MAX(1, MAX31855) && PIN_EXISTS(MAX31855_CS2)
77
     #define HAS_MAX31855_TEMP 1
79
     #define HAS_MAX31855_TEMP 1
78
     Adafruit_MAX31855 max31855_1 = Adafruit_MAX31855(MAX31855_CS2_PIN
80
     Adafruit_MAX31855 max31855_1 = Adafruit_MAX31855(MAX31855_CS2_PIN
79
       #if MAX31855_USES_SW_SPI
81
       #if MAX31855_USES_SW_SPI
96
   #if PIN_EXISTS(MAX31865_MISO) && PIN_EXISTS(MAX31865_SCK)
98
   #if PIN_EXISTS(MAX31865_MISO) && PIN_EXISTS(MAX31865_SCK)
97
     #define MAX31865_USES_SW_SPI 1
99
     #define MAX31865_USES_SW_SPI 1
98
   #endif
100
   #endif
99
-  #if TEMP_SENSOR_0_IS_MAX31865 && PIN_EXISTS(MAX31865_CS)
101
+  #if TEMP_SENSOR_IS_MAX(0, MAX31865) && PIN_EXISTS(MAX31865_CS)
100
     #define HAS_MAX31865_TEMP 1
102
     #define HAS_MAX31865_TEMP 1
101
       Adafruit_MAX31865 max31865_0 = Adafruit_MAX31865(MAX31865_CS_PIN
103
       Adafruit_MAX31865 max31865_0 = Adafruit_MAX31865(MAX31865_CS_PIN
102
         #if MAX31865_USES_SW_SPI && PIN_EXISTS(MAX31865_MOSI)
104
         #if MAX31865_USES_SW_SPI && PIN_EXISTS(MAX31865_MOSI)
107
         #endif
109
         #endif
108
       );
110
       );
109
   #endif
111
   #endif
110
-  #if TEMP_SENSOR_1_IS_MAX31865 && PIN_EXISTS(MAX31865_CS2)
112
+  #if TEMP_SENSOR_IS_MAX(1, MAX31865) && PIN_EXISTS(MAX31865_CS2)
111
     #define HAS_MAX31865_TEMP 1
113
     #define HAS_MAX31865_TEMP 1
112
     Adafruit_MAX31865 max31865_1 = Adafruit_MAX31865(MAX31865_CS2_PIN
114
     Adafruit_MAX31865 max31865_1 = Adafruit_MAX31865(MAX31865_CS2_PIN
113
       #if MAX31865_USES_SW_SPI && PIN_EXISTS(MAX31865_MOSI)
115
       #if MAX31865_USES_SW_SPI && PIN_EXISTS(MAX31865_MOSI)
126
   #if PIN_EXISTS(MAX6675_MISO) && PIN_EXISTS(MAX6675_SCK)
128
   #if PIN_EXISTS(MAX6675_MISO) && PIN_EXISTS(MAX6675_SCK)
127
     #define MAX6675_USES_SW_SPI 1
129
     #define MAX6675_USES_SW_SPI 1
128
   #endif
130
   #endif
129
-  #if TEMP_SENSOR_0_IS_MAX6675 && PIN_EXISTS(MAX6675_CS)
131
+  #if TEMP_SENSOR_IS_MAX(0, MAX6675) && PIN_EXISTS(MAX6675_CS)
130
     #define HAS_MAX6675_TEMP 1
132
     #define HAS_MAX6675_TEMP 1
131
     MAX6675 max6675_0 = MAX6675(MAX6675_CS_PIN
133
     MAX6675 max6675_0 = MAX6675(MAX6675_CS_PIN
132
       #if MAX6675_USES_SW_SPI
134
       #if MAX6675_USES_SW_SPI
137
       #endif
139
       #endif
138
     );
140
     );
139
   #endif
141
   #endif
140
-  #if TEMP_SENSOR_1_IS_MAX6675 && PIN_EXISTS(MAX6675_CS2)
142
+  #if TEMP_SENSOR_IS_MAX(1, MAX6675) && PIN_EXISTS(MAX6675_CS2)
141
     #define HAS_MAX6675_TEMP 1
143
     #define HAS_MAX6675_TEMP 1
142
     MAX6675 max6675_1 = MAX6675(MAX6675_CS2_PIN
144
     MAX6675 max6675_1 = MAX6675(MAX6675_CS2_PIN
143
       #if MAX6675_USES_SW_SPI
145
       #if MAX6675_USES_SW_SPI
154
   #define NO_THERMO_TEMPS 1
156
   #define NO_THERMO_TEMPS 1
155
 #endif
157
 #endif
156
 
158
 
157
-#if (TEMP_SENSOR_0_IS_MAX_TC || TEMP_SENSOR_1_IS_MAX_TC) && PINS_EXIST(MAX6675_SCK, MAX6675_DO) && NO_THERMO_TEMPS
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
158
   #define THERMO_SEPARATE_SPI 1
160
   #define THERMO_SEPARATE_SPI 1
159
 #endif
161
 #endif
160
 
162
 
210
 #endif
212
 #endif
211
 
213
 
212
 #if HAS_HOTEND_THERMISTOR
214
 #if HAS_HOTEND_THERMISTOR
213
-  #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
214
-    static const temp_entry_t* heater_ttbl_map[2] = { TEMPTABLE_0, TEMPTABLE_1 };
215
-    static constexpr uint8_t heater_ttbllen_map[2] = { TEMPTABLE_0_LEN, TEMPTABLE_1_LEN };
216
-  #else
217
-    #define NEXT_TEMPTABLE(N) ,TEMPTABLE_##N
218
-    #define NEXT_TEMPTABLE_LEN(N) ,TEMPTABLE_##N##_LEN
219
-    static const temp_entry_t* heater_ttbl_map[HOTENDS] = ARRAY_BY_HOTENDS(TEMPTABLE_0 REPEAT_S(1, HOTENDS, NEXT_TEMPTABLE));
220
-    static constexpr uint8_t heater_ttbllen_map[HOTENDS] = ARRAY_BY_HOTENDS(TEMPTABLE_0_LEN REPEAT_S(1, HOTENDS, NEXT_TEMPTABLE_LEN));
221
-  #endif
215
+  #define NEXT_TEMPTABLE(N) ,TEMPTABLE_##N
216
+  #define NEXT_TEMPTABLE_LEN(N) ,TEMPTABLE_##N##_LEN
217
+  static const temp_entry_t* heater_ttbl_map[HOTENDS] = ARRAY_BY_HOTENDS(TEMPTABLE_0 REPEAT_S(1, HOTENDS, NEXT_TEMPTABLE));
218
+  static constexpr uint8_t heater_ttbllen_map[HOTENDS] = ARRAY_BY_HOTENDS(TEMPTABLE_0_LEN REPEAT_S(1, HOTENDS, NEXT_TEMPTABLE_LEN));
222
 #endif
219
 #endif
223
 
220
 
224
 Temperature thermalManager;
221
 Temperature thermalManager;
257
 
254
 
258
 #if HAS_HOTEND
255
 #if HAS_HOTEND
259
   hotend_info_t Temperature::temp_hotend[HOTENDS];
256
   hotend_info_t Temperature::temp_hotend[HOTENDS];
260
-  #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
261
-    temp_info_t Temperature::temp_redundant;
262
-  #endif
263
   #define _HMT(N) HEATER_##N##_MAXTEMP,
257
   #define _HMT(N) HEATER_##N##_MAXTEMP,
264
   const celsius_t Temperature::hotend_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP, HEATER_5_MAXTEMP, HEATER_6_MAXTEMP, HEATER_7_MAXTEMP);
258
   const celsius_t Temperature::hotend_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP, HEATER_5_MAXTEMP, HEATER_6_MAXTEMP, HEATER_7_MAXTEMP);
265
 #endif
259
 #endif
266
 
260
 
261
+#if HAS_TEMP_REDUNDANT
262
+  redundant_temp_info_t Temperature::temp_redundant;
263
+#endif
264
+
267
 #if ENABLED(AUTO_POWER_E_FANS)
265
 #if ENABLED(AUTO_POWER_E_FANS)
268
   uint8_t Temperature::autofan_speed[HOTENDS]; // = { 0 }
266
   uint8_t Temperature::autofan_speed[HOTENDS]; // = { 0 }
269
 #endif
267
 #endif
1219
       if (degHotend(0) < _MAX(HEATER_0_MINTEMP, TEMP_SENSOR_0_MAX_TC_TMIN + .01)) min_temp_error(H_E0);
1217
       if (degHotend(0) < _MAX(HEATER_0_MINTEMP, TEMP_SENSOR_0_MAX_TC_TMIN + .01)) min_temp_error(H_E0);
1220
     #endif
1218
     #endif
1221
     #if TEMP_SENSOR_1_IS_MAX_TC
1219
     #if TEMP_SENSOR_1_IS_MAX_TC
1222
-      if (TERN(TEMP_SENSOR_1_AS_REDUNDANT, degHotendRedundant(), degHotend(1)) > _MIN(HEATER_1_MAXTEMP, TEMP_SENSOR_1_MAX_TC_TMAX - 1.0)) max_temp_error(H_E1);
1223
-      if (TERN(TEMP_SENSOR_1_AS_REDUNDANT, degHotendRedundant(), degHotend(1)) < _MAX(HEATER_1_MINTEMP, TEMP_SENSOR_1_MAX_TC_TMIN + .01)) min_temp_error(H_E1);
1220
+      if (degHotend(1) > _MIN(HEATER_1_MAXTEMP, TEMP_SENSOR_1_MAX_TC_TMAX - 1.0)) max_temp_error(H_E1);
1221
+      if (degHotend(1) < _MAX(HEATER_1_MINTEMP, TEMP_SENSOR_1_MAX_TC_TMIN + .01)) min_temp_error(H_E1);
1222
+    #endif
1223
+    #if TEMP_SENSOR_REDUNDANT_IS_MAX_TC
1224
+      if (degRedundant() > TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX - 1.0) max_temp_error(H_REDUNDANT);
1225
+      if (degRedundant() < TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN + .01) min_temp_error(H_REDUNDANT);
1224
     #endif
1226
     #endif
1225
   #endif
1227
   #endif
1226
 
1228
 
1254
         }
1256
         }
1255
       #endif
1257
       #endif
1256
 
1258
 
1257
-      #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
1258
-        // Make sure measured temperatures are close together
1259
-        if (ABS(degHotend(0) - degHotendRedundant()) > MAX_REDUNDANT_TEMP_SENSOR_DIFF)
1260
-          _temp_error(H_E0, PSTR(STR_REDUNDANCY), GET_TEXT(MSG_ERR_REDUNDANT_TEMP));
1261
-      #endif
1262
-
1263
     } // HOTEND_LOOP
1259
     } // HOTEND_LOOP
1264
 
1260
 
1265
   #endif // HAS_HOTEND
1261
   #endif // HAS_HOTEND
1266
 
1262
 
1263
+  #if HAS_TEMP_REDUNDANT
1264
+    // Make sure measured temperatures are close together
1265
+    if (ABS(degRedundantTarget() - degRedundant()) > TEMP_SENSOR_REDUNDANT_MAX_DIFF)
1266
+      _temp_error((heater_id_t)TEMP_SENSOR_REDUNDANT_TARGET, PSTR(STR_REDUNDANCY), GET_TEXT(MSG_ERR_REDUNDANT_TEMP));
1267
+  #endif
1268
+
1267
   #if HAS_AUTO_FAN
1269
   #if HAS_AUTO_FAN
1268
     if (ELAPSED(ms, next_auto_fan_check_ms)) { // only need to check fan state very infrequently
1270
     if (ELAPSED(ms, next_auto_fan_check_ms)) { // only need to check fan state very infrequently
1269
       checkExtruderAutoFans();
1271
       checkExtruderAutoFans();
1613
         { true, 0, 0, BED_PULLUP_RESISTOR_OHMS, BED_RESISTANCE_25C_OHMS, 0, 0, BED_BETA, 0 },
1615
         { true, 0, 0, BED_PULLUP_RESISTOR_OHMS, BED_RESISTANCE_25C_OHMS, 0, 0, BED_BETA, 0 },
1614
       #endif
1616
       #endif
1615
       #if TEMP_SENSOR_CHAMBER_IS_CUSTOM
1617
       #if TEMP_SENSOR_CHAMBER_IS_CUSTOM
1616
-        { true, 0, 0, CHAMBER_PULLUP_RESISTOR_OHMS, CHAMBER_RESISTANCE_25C_OHMS, 0, 0, CHAMBER_BETA, 0 }
1618
+        { true, 0, 0, CHAMBER_PULLUP_RESISTOR_OHMS, CHAMBER_RESISTANCE_25C_OHMS, 0, 0, CHAMBER_BETA, 0 },
1617
       #endif
1619
       #endif
1618
       #if TEMP_SENSOR_COOLER_IS_CUSTOM
1620
       #if TEMP_SENSOR_COOLER_IS_CUSTOM
1619
-        { true, 0, 0, COOLER_PULLUP_RESISTOR_OHMS, COOLER_RESISTANCE_25C_OHMS, 0, 0, COOLER_BETA, 0 }
1621
+        { true, 0, 0, COOLER_PULLUP_RESISTOR_OHMS, COOLER_RESISTANCE_25C_OHMS, 0, 0, COOLER_BETA, 0 },
1620
       #endif
1622
       #endif
1621
       #if TEMP_SENSOR_PROBE_IS_CUSTOM
1623
       #if TEMP_SENSOR_PROBE_IS_CUSTOM
1622
-        { true, 0, 0, PROBE_PULLUP_RESISTOR_OHMS, PROBE_RESISTANCE_25C_OHMS, 0, 0, PROBE_BETA, 0 }
1624
+        { true, 0, 0, PROBE_PULLUP_RESISTOR_OHMS, PROBE_RESISTANCE_25C_OHMS, 0, 0, PROBE_BETA, 0 },
1625
+      #endif
1626
+      #if TEMP_SENSOR_REDUNDANT_IS_CUSTOM
1627
+        { true, 0, 0, REDUNDANT_PULLUP_RESISTOR_OHMS, REDUNDANT_RESISTANCE_25C_OHMS, 0, 0, REDUNDANT_BETA, 0 },
1623
       #endif
1628
       #endif
1624
     };
1629
     };
1625
     COPY(user_thermistor, default_user_thermistor);
1630
     COPY(user_thermistor, default_user_thermistor);
1653
       TERN_(TEMP_SENSOR_CHAMBER_IS_CUSTOM, t_index == CTI_CHAMBER ? PSTR("CHAMBER") :)
1658
       TERN_(TEMP_SENSOR_CHAMBER_IS_CUSTOM, t_index == CTI_CHAMBER ? PSTR("CHAMBER") :)
1654
       TERN_(TEMP_SENSOR_COOLER_IS_CUSTOM, t_index == CTI_COOLER ? PSTR("COOLER") :)
1659
       TERN_(TEMP_SENSOR_COOLER_IS_CUSTOM, t_index == CTI_COOLER ? PSTR("COOLER") :)
1655
       TERN_(TEMP_SENSOR_PROBE_IS_CUSTOM, t_index == CTI_PROBE ? PSTR("PROBE") :)
1660
       TERN_(TEMP_SENSOR_PROBE_IS_CUSTOM, t_index == CTI_PROBE ? PSTR("PROBE") :)
1661
+      TERN_(TEMP_SENSOR_REDUNDANT_IS_CUSTOM, t_index == CTI_REDUNDANT ? PSTR("REDUNDANT") :)
1656
       nullptr
1662
       nullptr
1657
     );
1663
     );
1658
     SERIAL_EOL();
1664
     SERIAL_EOL();
1708
   // Derived from RepRap FiveD extruder::getTemperature()
1714
   // Derived from RepRap FiveD extruder::getTemperature()
1709
   // For hot end temperature measurement.
1715
   // For hot end temperature measurement.
1710
   celsius_float_t Temperature::analog_to_celsius_hotend(const int16_t raw, const uint8_t e) {
1716
   celsius_float_t Temperature::analog_to_celsius_hotend(const int16_t raw, const uint8_t e) {
1711
-      if (e >= HOTENDS + ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)) {
1717
+      if (e >= HOTENDS) {
1712
         SERIAL_ERROR_START();
1718
         SERIAL_ERROR_START();
1713
         SERIAL_ECHO(e);
1719
         SERIAL_ECHO(e);
1714
         SERIAL_ECHOLNPGM(STR_INVALID_EXTRUDER_NUM);
1720
         SERIAL_ECHOLNPGM(STR_INVALID_EXTRUDER_NUM);
1886
   }
1892
   }
1887
 #endif // HAS_TEMP_PROBE
1893
 #endif // HAS_TEMP_PROBE
1888
 
1894
 
1895
+#if HAS_TEMP_REDUNDANT
1896
+  // For redundant temperature measurement.
1897
+  celsius_float_t Temperature::analog_to_celsius_redundant(const int16_t raw) {
1898
+    #if TEMP_SENSOR_REDUNDANT_IS_CUSTOM
1899
+      return user_thermistor_to_deg_c(CTI_REDUNDANT, raw);
1900
+    #elif TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 0
1901
+      return TERN(TEMP_SENSOR_REDUNDANT_IS_MAX31865, max31865_0.temperature(MAX31865_SENSOR_OHMS_0, MAX31865_CALIBRATION_OHMS_0), raw * 0.25);
1902
+    #elif TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 1
1903
+      return TERN(TEMP_SENSOR_REDUNDANT_IS_MAX31865, max31865_1.temperature(MAX31865_SENSOR_OHMS_1, MAX31865_CALIBRATION_OHMS_1), raw * 0.25);
1904
+    #elif TEMP_SENSOR_REDUNDANT_IS_THERMISTOR
1905
+      SCAN_THERMISTOR_TABLE(TEMPTABLE_REDUNDANT, TEMPTABLE_REDUNDANT_LEN);
1906
+    #elif TEMP_SENSOR_REDUNDANT_IS_AD595
1907
+      return TEMP_AD595(raw);
1908
+    #elif TEMP_SENSOR_REDUNDANT_IS_AD8495
1909
+      return TEMP_AD8495(raw);
1910
+    #else
1911
+      UNUSED(raw);
1912
+      return 0;
1913
+    #endif
1914
+  }
1915
+#endif // HAS_TEMP_REDUNDANT
1916
+
1889
 /**
1917
 /**
1890
  * Convert the raw sensor readings into actual Celsius temperatures and
1918
  * Convert the raw sensor readings into actual Celsius temperatures and
1891
  * validate raw temperatures. Bad readings generate min/maxtemp errors.
1919
  * validate raw temperatures. Bad readings generate min/maxtemp errors.
1903
   watchdog_refresh(); // Reset because raw_temps_ready was set by the interrupt
1931
   watchdog_refresh(); // Reset because raw_temps_ready was set by the interrupt
1904
 
1932
 
1905
   TERN_(TEMP_SENSOR_0_IS_MAX_TC, temp_hotend[0].raw = READ_MAX_TC(0));
1933
   TERN_(TEMP_SENSOR_0_IS_MAX_TC, temp_hotend[0].raw = READ_MAX_TC(0));
1906
-  TERN_(TEMP_SENSOR_1_IS_MAX_TC, TERN(TEMP_SENSOR_1_AS_REDUNDANT, temp_redundant, temp_hotend[1]).raw = READ_MAX_TC(1));
1934
+  TERN_(TEMP_SENSOR_1_IS_MAX_TC, temp_hotend[1].raw = READ_MAX_TC(1));
1935
+  TERN_(TEMP_SENSOR_REDUNDANT_IS_MAX_TC, temp_redundant.raw = READ_MAX_TC(TEMP_SENSOR_REDUNDANT_SOURCE));
1907
   #if HAS_HOTEND
1936
   #if HAS_HOTEND
1908
     HOTEND_LOOP() temp_hotend[e].celsius = analog_to_celsius_hotend(temp_hotend[e].raw, e);
1937
     HOTEND_LOOP() temp_hotend[e].celsius = analog_to_celsius_hotend(temp_hotend[e].raw, e);
1909
   #endif
1938
   #endif
1910
-  TERN_(TEMP_SENSOR_1_AS_REDUNDANT, temp_redundant.celsius = analog_to_celsius_hotend(temp_redundant.raw, 1));
1911
 
1939
 
1912
-  TERN_(HAS_HEATED_BED,   temp_bed.celsius     = analog_to_celsius_bed(temp_bed.raw));
1913
-  TERN_(HAS_TEMP_CHAMBER, temp_chamber.celsius = analog_to_celsius_chamber(temp_chamber.raw));
1914
-  TERN_(HAS_TEMP_COOLER,  temp_cooler.celsius  = analog_to_celsius_cooler(temp_cooler.raw));
1915
-  TERN_(HAS_TEMP_PROBE,   temp_probe.celsius   = analog_to_celsius_probe(temp_probe.raw));
1940
+  TERN_(HAS_HEATED_BED,     temp_bed.celsius       = analog_to_celsius_bed(temp_bed.raw));
1941
+  TERN_(HAS_TEMP_CHAMBER,   temp_chamber.celsius   = analog_to_celsius_chamber(temp_chamber.raw));
1942
+  TERN_(HAS_TEMP_COOLER,    temp_cooler.celsius    = analog_to_celsius_cooler(temp_cooler.raw));
1943
+  TERN_(HAS_TEMP_PROBE,     temp_probe.celsius     = analog_to_celsius_probe(temp_probe.raw));
1944
+  TERN_(HAS_TEMP_REDUNDANT, temp_redundant.celsius = analog_to_celsius_redundant(temp_redundant.raw));
1916
 
1945
 
1917
   TERN_(FILAMENT_WIDTH_SENSOR, filwidth.update_measured_mm());
1946
   TERN_(FILAMENT_WIDTH_SENSOR, filwidth.update_measured_mm());
1918
   TERN_(HAS_POWER_MONITOR,     power_monitor.capture_values());
1947
   TERN_(HAS_POWER_MONITOR,     power_monitor.capture_values());
1919
 
1948
 
1920
   #if HAS_HOTEND
1949
   #if HAS_HOTEND
1921
-
1922
     static constexpr int8_t temp_dir[] = {
1950
     static constexpr int8_t temp_dir[] = {
1923
-      TERN(TEMP_SENSOR_0_IS_MAX_TC, 0, TEMPDIR(0))
1951
+      #if TEMP_SENSOR_IS_ANY_MAX_TC(0)
1952
+        0
1953
+      #else
1954
+        TEMPDIR(0)
1955
+      #endif
1924
       #if HAS_MULTI_HOTEND
1956
       #if HAS_MULTI_HOTEND
1925
-        , TERN(TEMP_SENSOR_1_IS_MAX_TC, 0, TEMPDIR(1))
1957
+        #if TEMP_SENSOR_IS_ANY_MAX_TC(1)
1958
+          , 0
1959
+        #else
1960
+          , TEMPDIR(1)
1961
+        #endif
1926
         #if HOTENDS > 2
1962
         #if HOTENDS > 2
1927
           #define _TEMPDIR(N) , TEMPDIR(N)
1963
           #define _TEMPDIR(N) , TEMPDIR(N)
1928
           REPEAT_S(2, HOTENDS, _TEMPDIR)
1964
           REPEAT_S(2, HOTENDS, _TEMPDIR)
2031
   #endif
2067
   #endif
2032
 
2068
 
2033
   // Init (and disable) SPI thermocouples
2069
   // Init (and disable) SPI thermocouples
2034
-  #if TEMP_SENSOR_0_IS_MAX6675 && PIN_EXISTS(MAX6675_CS)
2070
+  #if TEMP_SENSOR_IS_MAX(0, MAX6675) && PIN_EXISTS(MAX6675_CS)
2035
     OUT_WRITE(MAX6675_CS_PIN, HIGH);
2071
     OUT_WRITE(MAX6675_CS_PIN, HIGH);
2036
   #endif
2072
   #endif
2037
-  #if TEMP_SENSOR_1_IS_MAX6675 && PIN_EXISTS(MAX6675_CS2)
2073
+  #if TEMP_SENSOR_IS_MAX(1, MAX6675) && PIN_EXISTS(MAX6675_CS2)
2038
     OUT_WRITE(MAX6675_CS2_PIN, HIGH);
2074
     OUT_WRITE(MAX6675_CS2_PIN, HIGH);
2039
   #endif
2075
   #endif
2040
-  #if TEMP_SENSOR_0_IS_MAX6675 && PIN_EXISTS(MAX31855_CS)
2076
+  #if TEMP_SENSOR_IS_MAX(0, MAX6675) && PIN_EXISTS(MAX31855_CS)
2041
     OUT_WRITE(MAX31855_CS_PIN, HIGH);
2077
     OUT_WRITE(MAX31855_CS_PIN, HIGH);
2042
   #endif
2078
   #endif
2043
-  #if TEMP_SENSOR_1_IS_MAX6675 && PIN_EXISTS(MAX31855_CS2)
2079
+  #if TEMP_SENSOR_IS_MAX(1, MAX6675) && PIN_EXISTS(MAX31855_CS2)
2044
     OUT_WRITE(MAX31855_CS2_PIN, HIGH);
2080
     OUT_WRITE(MAX31855_CS2_PIN, HIGH);
2045
   #endif
2081
   #endif
2046
-  #if TEMP_SENSOR_0_IS_MAX6675 && PIN_EXISTS(MAX31865_CS)
2082
+  #if TEMP_SENSOR_IS_MAX(0, MAX6675) && PIN_EXISTS(MAX31865_CS)
2047
     OUT_WRITE(MAX31865_CS_PIN, HIGH);
2083
     OUT_WRITE(MAX31865_CS_PIN, HIGH);
2048
   #endif
2084
   #endif
2049
-  #if TEMP_SENSOR_1_IS_MAX6675 && PIN_EXISTS(MAX31865_CS2)
2085
+  #if TEMP_SENSOR_IS_MAX(1, MAX6675) && PIN_EXISTS(MAX31865_CS2)
2050
     OUT_WRITE(MAX31865_CS2_PIN, HIGH);
2086
     OUT_WRITE(MAX31865_CS2_PIN, HIGH);
2051
   #endif
2087
   #endif
2052
 
2088
 
2053
   #if HAS_MAX31865_TEMP
2089
   #if HAS_MAX31865_TEMP
2054
-    TERN_(TEMP_SENSOR_0_IS_MAX31865, max31865_0.begin(MAX31865_2WIRE)); // MAX31865_2WIRE, MAX31865_3WIRE, MAX31865_4WIRE
2055
-    TERN_(TEMP_SENSOR_1_IS_MAX31865, max31865_1.begin(MAX31865_2WIRE));
2090
+    TERN_(TEMP_SENSOR_IS_MAX(0, MAX31865), max31865_0.begin(MAX31865_2WIRE)); // MAX31865_2WIRE, MAX31865_3WIRE, MAX31865_4WIRE
2091
+    TERN_(TEMP_SENSOR_IS_MAX(1, MAX31865), max31865_1.begin(MAX31865_2WIRE));
2056
   #endif
2092
   #endif
2057
   #if HAS_MAX31855_TEMP
2093
   #if HAS_MAX31855_TEMP
2058
-    TERN_(TEMP_SENSOR_0_IS_MAX31855, max31855_0.begin());
2059
-    TERN_(TEMP_SENSOR_1_IS_MAX31855, max31855_1.begin());
2094
+    TERN_(TEMP_SENSOR_IS_MAX(0, MAX31855), max31855_0.begin());
2095
+    TERN_(TEMP_SENSOR_IS_MAX(1, MAX31855), max31855_1.begin());
2060
   #endif
2096
   #endif
2061
   #if HAS_MAX6675_TEMP
2097
   #if HAS_MAX6675_TEMP
2062
-    TERN_(TEMP_SENSOR_0_IS_MAX6675, max6675_0.begin());
2063
-    TERN_(TEMP_SENSOR_1_IS_MAX6675, max6675_1.begin());
2098
+    TERN_(TEMP_SENSOR_IS_MAX(0, MAX6675), max6675_0.begin());
2099
+    TERN_(TEMP_SENSOR_IS_MAX(1, MAX6675), max6675_1.begin());
2064
   #endif
2100
   #endif
2065
 
2101
 
2066
   #if MB(RUMBA)
2102
   #if MB(RUMBA)
2067
     // Disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector
2103
     // Disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector
2068
     #define _AD(N) (TEMP_SENSOR_##N##_IS_AD595 || TEMP_SENSOR_##N##_IS_AD8495)
2104
     #define _AD(N) (TEMP_SENSOR_##N##_IS_AD595 || TEMP_SENSOR_##N##_IS_AD8495)
2069
-    #if _AD(0) || _AD(1) || _AD(2) || _AD(BED) || _AD(CHAMBER)
2105
+    #if _AD(0) || _AD(1) || _AD(2) || _AD(BED) || _AD(CHAMBER) || _AD(REDUNDANT)
2070
       MCUCR = _BV(JTD);
2106
       MCUCR = _BV(JTD);
2071
       MCUCR = _BV(JTD);
2107
       MCUCR = _BV(JTD);
2072
     #endif
2108
     #endif
2074
 
2110
 
2075
   // Thermistor activation by MCU pin
2111
   // Thermistor activation by MCU pin
2076
   #if PIN_EXISTS(TEMP_0_TR_ENABLE)
2112
   #if PIN_EXISTS(TEMP_0_TR_ENABLE)
2077
-    OUT_WRITE(TEMP_0_TR_ENABLE_PIN, ENABLED(TEMP_SENSOR_0_IS_MAX_TC));
2113
+    OUT_WRITE(TEMP_0_TR_ENABLE_PIN,
2114
+      #if TEMP_SENSOR_IS_ANY_MAX_TC(0)
2115
+        1
2116
+      #else
2117
+        0
2118
+      #endif
2119
+    );
2078
   #endif
2120
   #endif
2079
   #if PIN_EXISTS(TEMP_1_TR_ENABLE)
2121
   #if PIN_EXISTS(TEMP_1_TR_ENABLE)
2080
-    OUT_WRITE(TEMP_1_TR_ENABLE_PIN, ENABLED(TEMP_SENSOR_1_IS_MAX_TC));
2122
+    OUT_WRITE(TEMP_1_TR_ENABLE_PIN,
2123
+      #if TEMP_SENSOR_IS_ANY_MAX_TC(1)
2124
+        1
2125
+      #else
2126
+        0
2127
+      #endif
2128
+    );
2081
   #endif
2129
   #endif
2082
 
2130
 
2083
   #if HAS_HEATER_0
2131
   #if HAS_HEATER_0
2206
   #if HAS_TEMP_ADC_PROBE
2254
   #if HAS_TEMP_ADC_PROBE
2207
     HAL_ANALOG_SELECT(TEMP_PROBE_PIN);
2255
     HAL_ANALOG_SELECT(TEMP_PROBE_PIN);
2208
   #endif
2256
   #endif
2257
+  #if HAS_TEMP_ADC_REDUNDANT
2258
+    HAL_ANALOG_SELECT(TEMP_REDUNDANT_PIN);
2259
+  #endif
2209
   #if ENABLED(FILAMENT_WIDTH_SENSOR)
2260
   #if ENABLED(FILAMENT_WIDTH_SENSOR)
2210
     HAL_ANALOG_SELECT(FILWIDTH_PIN);
2261
     HAL_ANALOG_SELECT(FILWIDTH_PIN);
2211
   #endif
2262
   #endif
2268
         temp_range[NR].raw_max -= TEMPDIR(NR) * (OVERSAMPLENR); \
2319
         temp_range[NR].raw_max -= TEMPDIR(NR) * (OVERSAMPLENR); \
2269
     }while(0)
2320
     }while(0)
2270
 
2321
 
2271
-    #define _MINMAX_TEST(N,M) (HOTENDS > N && TEMP_SENSOR_ ##N## _THERMISTOR_ID && TEMP_SENSOR_ ##N## _THERMISTOR_ID != 998 && TEMP_SENSOR_ ##N## _THERMISTOR_ID != 999 && defined(HEATER_##N##_##M##TEMP))
2322
+    #define _MINMAX_TEST(N,M) (HOTENDS > N && TEMP_SENSOR_##N > 0 && TEMP_SENSOR_##N != 998 && TEMP_SENSOR_##N != 999 && defined(HEATER_##N##_##M##TEMP))
2272
 
2323
 
2273
     #if _MINMAX_TEST(0, MIN)
2324
     #if _MINMAX_TEST(0, MIN)
2274
       _TEMP_MIN_E(0);
2325
       _TEMP_MIN_E(0);
2335
     while (analog_to_celsius_cooler(mintemp_raw_COOLER) > COOLER_MINTEMP) mintemp_raw_COOLER += TEMPDIR(COOLER) * (OVERSAMPLENR);
2386
     while (analog_to_celsius_cooler(mintemp_raw_COOLER) > COOLER_MINTEMP) mintemp_raw_COOLER += TEMPDIR(COOLER) * (OVERSAMPLENR);
2336
     while (analog_to_celsius_cooler(maxtemp_raw_COOLER) < COOLER_MAXTEMP) maxtemp_raw_COOLER -= TEMPDIR(COOLER) * (OVERSAMPLENR);
2387
     while (analog_to_celsius_cooler(maxtemp_raw_COOLER) < COOLER_MAXTEMP) maxtemp_raw_COOLER -= TEMPDIR(COOLER) * (OVERSAMPLENR);
2337
   #endif
2388
   #endif
2389
+
2390
+  #if HAS_TEMP_REDUNDANT
2391
+    temp_redundant.target = &(
2392
+      #if TEMP_SENSOR_REDUNDANT_TARGET == -5 && HAS_TEMP_COOLER
2393
+        temp_cooler
2394
+      #elif TEMP_SENSOR_REDUNDANT_TARGET == -4 && HAS_TEMP_PROBE
2395
+        temp_probe
2396
+      #elif TEMP_SENSOR_REDUNDANT_TARGET == -2 && HAS_TEMP_CHAMBER
2397
+        temp_chamber
2398
+      #elif TEMP_SENSOR_REDUNDANT_TARGET == -1 && HAS_TEMP_BED
2399
+        temp_bed
2400
+      #else
2401
+        temp_hotend[TEMP_SENSOR_REDUNDANT_TARGET]
2402
+      #endif
2403
+    );
2404
+  #endif
2338
 }
2405
 }
2339
 
2406
 
2340
 #if HAS_THERMAL_PROTECTION
2407
 #if HAS_THERMAL_PROTECTION
2373
           , " ;  Idle Timeout:", heater_idle[idle_index].timed_out
2440
           , " ;  Idle Timeout:", heater_idle[idle_index].timed_out
2374
         #endif
2441
         #endif
2375
       );
2442
       );
2376
-    //*/
2443
+    */
2377
 
2444
 
2378
     #if HEATER_IDLE_HANDLER
2445
     #if HEATER_IDLE_HANDLER
2379
       // If the heater idle timeout expires, restart
2446
       // If the heater idle timeout expires, restart
2570
     #else
2637
     #else
2571
       constexpr uint8_t hindex = 0;
2638
       constexpr uint8_t hindex = 0;
2572
       #define THERMO_TEMP(I) max_tc_temp
2639
       #define THERMO_TEMP(I) max_tc_temp
2573
-      #if TEMP_SENSOR_1_IS_MAX31865
2640
+      #if TEMP_SENSOR_IS_ANY_MAX_TC(1)
2574
         #define THERMO_SEL(A,B) B
2641
         #define THERMO_SEL(A,B) B
2575
       #else
2642
       #else
2576
         #define THERMO_SEL(A,B) A
2643
         #define THERMO_SEL(A,B) A
2577
       #endif
2644
       #endif
2578
-      #if TEMP_SENSOR_0_IS_MAX6675
2645
+      #if TEMP_SENSOR_IS_MAX(0, MAX6675)
2579
         #define MAX6675_WRITE(V)          WRITE(MAX6675_SS_PIN, V)
2646
         #define MAX6675_WRITE(V)          WRITE(MAX6675_SS_PIN, V)
2580
         #define MAX6675_SET_OUTPUT() SET_OUTPUT(MAX6675_SS_PIN)
2647
         #define MAX6675_SET_OUTPUT() SET_OUTPUT(MAX6675_SS_PIN)
2581
       #else
2648
       #else
2723
     temp_hotend[0].update();
2790
     temp_hotend[0].update();
2724
   #endif
2791
   #endif
2725
 
2792
 
2726
-  #if HAS_TEMP_ADC_1
2727
-    #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
2728
-      temp_redundant.update();
2729
-    #elif !TEMP_SENSOR_1_IS_MAX_TC
2730
-      temp_hotend[1].update();
2731
-    #endif
2793
+  #if HAS_TEMP_ADC_1 && !TEMP_SENSOR_1_IS_MAX_TC
2794
+    temp_hotend[1].update();
2795
+  #endif
2796
+
2797
+  #if HAS_TEMP_ADC_REDUNDANT && !TEMP_SENSOR_REDUNDANT_IS_MAX_TC
2798
+    temp_redundant.update();
2732
   #endif
2799
   #endif
2733
 
2800
 
2734
   TERN_(HAS_TEMP_ADC_2, temp_hotend[2].update());
2801
   TERN_(HAS_TEMP_ADC_2, temp_hotend[2].update());
2764
 
2831
 
2765
   #if HAS_HOTEND
2832
   #if HAS_HOTEND
2766
     HOTEND_LOOP() temp_hotend[e].reset();
2833
     HOTEND_LOOP() temp_hotend[e].reset();
2767
-    TERN_(TEMP_SENSOR_1_AS_REDUNDANT, temp_redundant.reset());
2768
   #endif
2834
   #endif
2769
 
2835
 
2770
   TERN_(HAS_HEATED_BED, temp_bed.reset());
2836
   TERN_(HAS_HEATED_BED, temp_bed.reset());
2771
   TERN_(HAS_TEMP_CHAMBER, temp_chamber.reset());
2837
   TERN_(HAS_TEMP_CHAMBER, temp_chamber.reset());
2772
   TERN_(HAS_TEMP_PROBE, temp_probe.reset());
2838
   TERN_(HAS_TEMP_PROBE, temp_probe.reset());
2773
   TERN_(HAS_TEMP_COOLER, temp_cooler.reset());
2839
   TERN_(HAS_TEMP_COOLER, temp_cooler.reset());
2840
+  TERN_(HAS_TEMP_REDUNDANT, temp_redundant.reset());
2774
 
2841
 
2775
   TERN_(HAS_JOY_ADC_X, joystick.x.reset());
2842
   TERN_(HAS_JOY_ADC_X, joystick.x.reset());
2776
   TERN_(HAS_JOY_ADC_Y, joystick.y.reset());
2843
   TERN_(HAS_JOY_ADC_Y, joystick.y.reset());
3196
       case MeasureTemp_PROBE: ACCUMULATE_ADC(temp_probe); break;
3263
       case MeasureTemp_PROBE: ACCUMULATE_ADC(temp_probe); break;
3197
     #endif
3264
     #endif
3198
 
3265
 
3266
+    #if HAS_TEMP_ADC_REDUNDANT
3267
+      case PrepareTemp_REDUNDANT: HAL_START_ADC(TEMP_REDUNDANT_PIN); break;
3268
+      case MeasureTemp_REDUNDANT: ACCUMULATE_ADC(temp_redundant); break;
3269
+    #endif
3270
+
3199
     #if HAS_TEMP_ADC_1
3271
     #if HAS_TEMP_ADC_1
3200
       case PrepareTemp_1: HAL_START_ADC(TEMP_1_PIN); break;
3272
       case PrepareTemp_1: HAL_START_ADC(TEMP_1_PIN); break;
3201
-      case MeasureTemp_1: ACCUMULATE_ADC(TERN(TEMP_SENSOR_1_AS_REDUNDANT, temp_redundant, temp_hotend[1])); break;
3273
+      case MeasureTemp_1: ACCUMULATE_ADC(temp_hotend[1]); break;
3202
     #endif
3274
     #endif
3203
 
3275
 
3204
     #if HAS_TEMP_ADC_2
3276
     #if HAS_TEMP_ADC_2
3332
    *    Chamber: " C:nnn.nn /nnn.nn"
3404
    *    Chamber: " C:nnn.nn /nnn.nn"
3333
    *      Probe: " P:nnn.nn /nnn.nn"
3405
    *      Probe: " P:nnn.nn /nnn.nn"
3334
    *     Cooler: " L:nnn.nn /nnn.nn"
3406
    *     Cooler: " L:nnn.nn /nnn.nn"
3407
+   *  Redundant: " R:nnn.nn /nnn.nn"
3335
    *   Extruder: " T0:nnn.nn /nnn.nn"
3408
    *   Extruder: " T0:nnn.nn /nnn.nn"
3336
    *   With ADC: " T0:nnn.nn /nnn.nn (nnn.nn)"
3409
    *   With ADC: " T0:nnn.nn /nnn.nn (nnn.nn)"
3337
    */
3410
    */
3356
       #if HAS_TEMP_COOLER
3429
       #if HAS_TEMP_COOLER
3357
         case H_COOLER: k = 'L'; break;
3430
         case H_COOLER: k = 'L'; break;
3358
       #endif
3431
       #endif
3359
-      #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
3432
+      #if HAS_TEMP_REDUNDANT
3360
         case H_REDUNDANT: k = 'R'; break;
3433
         case H_REDUNDANT: k = 'R'; break;
3361
       #endif
3434
       #endif
3362
     }
3435
     }
3382
   }
3455
   }
3383
 
3456
 
3384
   void Temperature::print_heater_states(const uint8_t target_extruder
3457
   void Temperature::print_heater_states(const uint8_t target_extruder
3385
-    OPTARG(TEMP_SENSOR_1_AS_REDUNDANT, const bool include_r/*=false*/)
3458
+    OPTARG(HAS_TEMP_REDUNDANT, const bool include_r/*=false*/)
3386
   ) {
3459
   ) {
3387
     #if HAS_TEMP_HOTEND
3460
     #if HAS_TEMP_HOTEND
3388
       print_heater_state(H_NONE, degHotend(target_extruder), degTargetHotend(target_extruder) OPTARG(SHOW_TEMP_ADC_VALUES, rawHotendTemp(target_extruder)));
3461
       print_heater_state(H_NONE, degHotend(target_extruder), degTargetHotend(target_extruder) OPTARG(SHOW_TEMP_ADC_VALUES, rawHotendTemp(target_extruder)));
3389
-      #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
3390
-        if (include_r) print_heater_state(H_REDUNDANT, degHotendRedundant(), degTargetHotend(0) OPTARG(SHOW_TEMP_ADC_VALUES, rawHotendTempRedundant()));
3391
-      #endif
3392
     #endif
3462
     #endif
3393
     #if HAS_HEATED_BED
3463
     #if HAS_HEATED_BED
3394
       print_heater_state(H_BED, degBed(), degTargetBed() OPTARG(SHOW_TEMP_ADC_VALUES, rawBedTemp()));
3464
       print_heater_state(H_BED, degBed(), degTargetBed() OPTARG(SHOW_TEMP_ADC_VALUES, rawBedTemp()));
3402
     #if HAS_TEMP_PROBE
3472
     #if HAS_TEMP_PROBE
3403
       print_heater_state(H_PROBE, degProbe(), 0 OPTARG(SHOW_TEMP_ADC_VALUES, rawProbeTemp()) );
3473
       print_heater_state(H_PROBE, degProbe(), 0 OPTARG(SHOW_TEMP_ADC_VALUES, rawProbeTemp()) );
3404
     #endif
3474
     #endif
3475
+    #if HAS_TEMP_REDUNDANT
3476
+      if (include_r) print_heater_state(H_REDUNDANT, degRedundant(), degRedundantTarget() OPTARG(SHOW_TEMP_ADC_VALUES, rawRedundantTemp()));
3477
+    #endif
3405
     #if HAS_MULTI_HOTEND
3478
     #if HAS_MULTI_HOTEND
3406
       HOTEND_LOOP() print_heater_state((heater_id_t)e, degHotend(e), degTargetHotend(e) OPTARG(SHOW_TEMP_ADC_VALUES, rawHotendTemp(e)));
3479
       HOTEND_LOOP() print_heater_state((heater_id_t)e, degHotend(e), degTargetHotend(e) OPTARG(SHOW_TEMP_ADC_VALUES, rawHotendTemp(e)));
3407
     #endif
3480
     #endif

+ 33
- 13
Marlin/src/module/temperature.h View File

105
   #if HAS_TEMP_ADC_PROBE
105
   #if HAS_TEMP_ADC_PROBE
106
     PrepareTemp_PROBE, MeasureTemp_PROBE,
106
     PrepareTemp_PROBE, MeasureTemp_PROBE,
107
   #endif
107
   #endif
108
+  #if HAS_TEMP_ADC_REDUNDANT
109
+    PrepareTemp_REDUNDANT, MeasureTemp_REDUNDANT,
110
+  #endif
108
   #if HAS_TEMP_ADC_1
111
   #if HAS_TEMP_ADC_1
109
     PrepareTemp_1, MeasureTemp_1,
112
     PrepareTemp_1, MeasureTemp_1,
110
   #endif
113
   #endif
185
   inline void update() { raw = acc; }
188
   inline void update() { raw = acc; }
186
 } temp_info_t;
189
 } temp_info_t;
187
 
190
 
191
+#if HAS_TEMP_REDUNDANT
192
+  // A redundant temperature sensor
193
+  typedef struct RedundantTempInfo : public TempInfo {
194
+    temp_info_t* target;
195
+  } redundant_temp_info_t;
196
+#endif
197
+
188
 // A PWM heater with temperature sensor
198
 // A PWM heater with temperature sensor
189
 typedef struct HeaterInfo : public TempInfo {
199
 typedef struct HeaterInfo : public TempInfo {
190
   celsius_t target;
200
   celsius_t target;
299
     #if TEMP_SENSOR_CHAMBER_IS_CUSTOM
309
     #if TEMP_SENSOR_CHAMBER_IS_CUSTOM
300
       CTI_CHAMBER,
310
       CTI_CHAMBER,
301
     #endif
311
     #endif
302
-    #if COOLER_USER_THERMISTOR
312
+    #if TEMP_SENSOR_COOLER_IS_CUSTOM
303
       CTI_COOLER,
313
       CTI_COOLER,
304
     #endif
314
     #endif
315
+    #if TEMP_SENSOR_REDUNDANT_IS_CUSTOM
316
+      CTI_REDUNDANT,
317
+    #endif
305
     USER_THERMISTORS
318
     USER_THERMISTORS
306
   };
319
   };
307
 
320
 
323
   public:
336
   public:
324
 
337
 
325
     #if HAS_HOTEND
338
     #if HAS_HOTEND
326
-      #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
327
-        static temp_info_t temp_redundant;
328
-      #endif
329
       static hotend_info_t temp_hotend[HOTENDS];
339
       static hotend_info_t temp_hotend[HOTENDS];
330
       static const celsius_t hotend_maxtemp[HOTENDS];
340
       static const celsius_t hotend_maxtemp[HOTENDS];
331
       static inline celsius_t hotend_max_target(const uint8_t e) { return hotend_maxtemp[e] - (HOTEND_OVERSHOOT); }
341
       static inline celsius_t hotend_max_target(const uint8_t e) { return hotend_maxtemp[e] - (HOTEND_OVERSHOOT); }
342
     #if ENABLED(HAS_TEMP_COOLER)
352
     #if ENABLED(HAS_TEMP_COOLER)
343
       static cooler_info_t temp_cooler;
353
       static cooler_info_t temp_cooler;
344
     #endif
354
     #endif
355
+    #if HAS_TEMP_REDUNDANT
356
+      static redundant_temp_info_t temp_redundant;
357
+    #endif
345
 
358
 
346
     #if ENABLED(AUTO_POWER_E_FANS)
359
     #if ENABLED(AUTO_POWER_E_FANS)
347
       static uint8_t autofan_speed[HOTENDS];
360
       static uint8_t autofan_speed[HOTENDS];
538
     #if HAS_TEMP_COOLER
551
     #if HAS_TEMP_COOLER
539
       static celsius_float_t analog_to_celsius_cooler(const int16_t raw);
552
       static celsius_float_t analog_to_celsius_cooler(const int16_t raw);
540
     #endif
553
     #endif
554
+    #if HAS_TEMP_REDUNDANT
555
+      static celsius_float_t analog_to_celsius_redundant(const int16_t raw);
556
+    #endif
541
 
557
 
542
     #if HAS_FAN
558
     #if HAS_FAN
543
 
559
 
626
       return TERN0(HAS_HOTEND, temp_hotend[HOTEND_INDEX].celsius);
642
       return TERN0(HAS_HOTEND, temp_hotend[HOTEND_INDEX].celsius);
627
     }
643
     }
628
 
644
 
629
-    #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
630
-      static inline celsius_float_t degHotendRedundant() { return temp_redundant.celsius; }
631
-    #endif
632
-
633
     static inline celsius_t wholeDegHotend(const uint8_t E_NAME) {
645
     static inline celsius_t wholeDegHotend(const uint8_t E_NAME) {
634
       return TERN0(HAS_HOTEND, static_cast<celsius_t>(temp_hotend[HOTEND_INDEX].celsius + 0.5f));
646
       return TERN0(HAS_HOTEND, static_cast<celsius_t>(temp_hotend[HOTEND_INDEX].celsius + 0.5f));
635
     }
647
     }
638
       static inline int16_t rawHotendTemp(const uint8_t E_NAME) {
650
       static inline int16_t rawHotendTemp(const uint8_t E_NAME) {
639
         return TERN0(HAS_HOTEND, temp_hotend[HOTEND_INDEX].raw);
651
         return TERN0(HAS_HOTEND, temp_hotend[HOTEND_INDEX].raw);
640
       }
652
       }
641
-      #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
642
-        static inline int16_t rawHotendTempRedundant() { return temp_redundant.raw; }
643
-      #endif
644
     #endif
653
     #endif
645
 
654
 
646
     static inline celsius_t degTargetHotend(const uint8_t E_NAME) {
655
     static inline celsius_t degTargetHotend(const uint8_t E_NAME) {
778
       #endif
787
       #endif
779
     #endif
788
     #endif
780
 
789
 
790
+    #if HAS_TEMP_REDUNDANT
791
+      #if ENABLED(SHOW_TEMP_ADC_VALUES)
792
+        static inline int16_t rawRedundantTemp()         { return temp_redundant.raw; }
793
+        static inline int16_t rawRedundanTargetTemp()    { return (*temp_redundant.target).raw; }
794
+      #endif
795
+      static inline celsius_float_t degRedundant()       { return temp_redundant.celsius; }
796
+      static inline celsius_float_t degRedundantTarget() { return (*temp_redundant.target).celsius; }
797
+      static inline celsius_t wholeDegRedundant()        { return static_cast<celsius_t>(temp_redundant.celsius + 0.5f); }
798
+      static inline celsius_t wholeDegRedundantTarget()  { return static_cast<celsius_t>((*temp_redundant.target).celsius + 0.5f); }
799
+    #endif
800
+
781
     #if HAS_COOLER
801
     #if HAS_COOLER
782
       static inline void setTargetCooler(const celsius_t celsius) {
802
       static inline void setTargetCooler(const celsius_t celsius) {
783
         temp_cooler.target = constrain(celsius, COOLER_MIN_TARGET, COOLER_MAX_TARGET);
803
         temp_cooler.target = constrain(celsius, COOLER_MIN_TARGET, COOLER_MAX_TARGET);
855
 
875
 
856
     #if HAS_TEMP_SENSOR
876
     #if HAS_TEMP_SENSOR
857
       static void print_heater_states(const uint8_t target_extruder
877
       static void print_heater_states(const uint8_t target_extruder
858
-        OPTARG(TEMP_SENSOR_1_AS_REDUNDANT, const bool include_r=false)
878
+        OPTARG(HAS_TEMP_REDUNDANT, const bool include_r=false)
859
       );
879
       );
860
       #if ENABLED(AUTO_REPORT_TEMPERATURES)
880
       #if ENABLED(AUTO_REPORT_TEMPERATURES)
861
         struct AutoReportTemp { static void report(); };
881
         struct AutoReportTemp { static void report(); };
888
 
908
 
889
     // MAX Thermocouples
909
     // MAX Thermocouples
890
     #if HAS_MAX_TC
910
     #if HAS_MAX_TC
891
-      #define MAX_TC_COUNT 1 + BOTH(TEMP_SENSOR_0_IS_MAX_TC, TEMP_SENSOR_1_IS_MAX_TC)
911
+      #define MAX_TC_COUNT COUNT_ENABLED(TEMP_SENSOR_0_IS_MAX_TC, TEMP_SENSOR_1_IS_MAX_TC, TEMP_SENSOR_REDUNDANT_IS_MAX_TC)
892
       #if MAX_TC_COUNT > 1
912
       #if MAX_TC_COUNT > 1
893
         #define HAS_MULTI_MAX_TC 1
913
         #define HAS_MULTI_MAX_TC 1
894
         #define READ_MAX_TC(N) read_max_tc(N)
914
         #define READ_MAX_TC(N) read_max_tc(N)

+ 1
- 1
Marlin/src/module/thermistor/thermistor_1.h View File

22
 #pragma once
22
 #pragma once
23
 
23
 
24
 // R25 = 100 kOhm, beta25 = 4092 K, 4.7 kOhm pull-up, bed thermistor
24
 // R25 = 100 kOhm, beta25 = 4092 K, 4.7 kOhm pull-up, bed thermistor
25
-const temp_entry_t temptable_1[] PROGMEM = {
25
+constexpr temp_entry_t temptable_1[] PROGMEM = {
26
   { OV(  23), 300 },
26
   { OV(  23), 300 },
27
   { OV(  25), 295 },
27
   { OV(  25), 295 },
28
   { OV(  27), 290 },
28
   { OV(  27), 290 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_10.h View File

22
 #pragma once
22
 #pragma once
23
 
23
 
24
 // R25 = 100 kOhm, beta25 = 3960 K, 4.7 kOhm pull-up, RS thermistor 198-961
24
 // R25 = 100 kOhm, beta25 = 3960 K, 4.7 kOhm pull-up, RS thermistor 198-961
25
-const temp_entry_t temptable_10[] PROGMEM = {
25
+constexpr temp_entry_t temptable_10[] PROGMEM = {
26
   { OV(   1), 929 },
26
   { OV(   1), 929 },
27
   { OV(  36), 299 },
27
   { OV(  36), 299 },
28
   { OV(  71), 246 },
28
   { OV(  71), 246 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_1010.h View File

24
 #define REVERSE_TEMP_SENSOR_RANGE_1010 1
24
 #define REVERSE_TEMP_SENSOR_RANGE_1010 1
25
 
25
 
26
 // Pt1000 with 1k0 pullup
26
 // Pt1000 with 1k0 pullup
27
-const temp_entry_t temptable_1010[] PROGMEM = {
27
+constexpr temp_entry_t temptable_1010[] PROGMEM = {
28
   PtLine(  0, 1000, 1000),
28
   PtLine(  0, 1000, 1000),
29
   PtLine( 25, 1000, 1000),
29
   PtLine( 25, 1000, 1000),
30
   PtLine( 50, 1000, 1000),
30
   PtLine( 50, 1000, 1000),

+ 1
- 1
Marlin/src/module/thermistor/thermistor_1047.h View File

24
 #define REVERSE_TEMP_SENSOR_RANGE_1047 1
24
 #define REVERSE_TEMP_SENSOR_RANGE_1047 1
25
 
25
 
26
 // Pt1000 with 4k7 pullup
26
 // Pt1000 with 4k7 pullup
27
-const temp_entry_t temptable_1047[] PROGMEM = {
27
+constexpr temp_entry_t temptable_1047[] PROGMEM = {
28
   // only a few values are needed as the curve is very flat
28
   // only a few values are needed as the curve is very flat
29
   PtLine(  0, 1000, 4700),
29
   PtLine(  0, 1000, 4700),
30
   PtLine( 50, 1000, 4700),
30
   PtLine( 50, 1000, 4700),

+ 1
- 1
Marlin/src/module/thermistor/thermistor_11.h View File

22
 #pragma once
22
 #pragma once
23
 
23
 
24
 // R25 = 100 kOhm, beta25 = 3950 K, 4.7 kOhm pull-up, QU-BD silicone bed QWG-104F-3950 thermistor
24
 // R25 = 100 kOhm, beta25 = 3950 K, 4.7 kOhm pull-up, QU-BD silicone bed QWG-104F-3950 thermistor
25
-const temp_entry_t temptable_11[] PROGMEM = {
25
+constexpr temp_entry_t temptable_11[] PROGMEM = {
26
   { OV(   1), 938 },
26
   { OV(   1), 938 },
27
   { OV(  31), 314 },
27
   { OV(  31), 314 },
28
   { OV(  41), 290 },
28
   { OV(  41), 290 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_110.h View File

24
 #define REVERSE_TEMP_SENSOR_RANGE_110 1
24
 #define REVERSE_TEMP_SENSOR_RANGE_110 1
25
 
25
 
26
 // Pt100 with 1k0 pullup
26
 // Pt100 with 1k0 pullup
27
-const temp_entry_t temptable_110[] PROGMEM = {
27
+constexpr temp_entry_t temptable_110[] PROGMEM = {
28
   // only a few values are needed as the curve is very flat
28
   // only a few values are needed as the curve is very flat
29
   PtLine(  0, 100, 1000),
29
   PtLine(  0, 100, 1000),
30
   PtLine( 50, 100, 1000),
30
   PtLine( 50, 100, 1000),

+ 1
- 1
Marlin/src/module/thermistor/thermistor_12.h View File

22
 #pragma once
22
 #pragma once
23
 
23
 
24
 // R25 = 100 kOhm, beta25 = 4700 K, 4.7 kOhm pull-up, (personal calibration for Makibox hot bed)
24
 // R25 = 100 kOhm, beta25 = 4700 K, 4.7 kOhm pull-up, (personal calibration for Makibox hot bed)
25
-const temp_entry_t temptable_12[] PROGMEM = {
25
+constexpr temp_entry_t temptable_12[] PROGMEM = {
26
   { OV(  35), 180 }, // top rating 180C
26
   { OV(  35), 180 }, // top rating 180C
27
   { OV( 211), 140 },
27
   { OV( 211), 140 },
28
   { OV( 233), 135 },
28
   { OV( 233), 135 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_13.h View File

22
 #pragma once
22
 #pragma once
23
 
23
 
24
 // R25 = 100 kOhm, beta25 = 4100 K, 4.7 kOhm pull-up, Hisens thermistor
24
 // R25 = 100 kOhm, beta25 = 4100 K, 4.7 kOhm pull-up, Hisens thermistor
25
-const temp_entry_t temptable_13[] PROGMEM = {
25
+constexpr temp_entry_t temptable_13[] PROGMEM = {
26
   { OV( 20.04), 300 },
26
   { OV( 20.04), 300 },
27
   { OV( 23.19), 290 },
27
   { OV( 23.19), 290 },
28
   { OV( 26.71), 280 },
28
   { OV( 26.71), 280 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_147.h View File

24
 #define REVERSE_TEMP_SENSOR_RANGE_147 1
24
 #define REVERSE_TEMP_SENSOR_RANGE_147 1
25
 
25
 
26
 // Pt100 with 4k7 pullup
26
 // Pt100 with 4k7 pullup
27
-const temp_entry_t temptable_147[] PROGMEM = {
27
+constexpr temp_entry_t temptable_147[] PROGMEM = {
28
   // only a few values are needed as the curve is very flat
28
   // only a few values are needed as the curve is very flat
29
   PtLine(  0, 100, 4700),
29
   PtLine(  0, 100, 4700),
30
   PtLine( 50, 100, 4700),
30
   PtLine( 50, 100, 4700),

+ 1
- 1
Marlin/src/module/thermistor/thermistor_15.h View File

22
 #pragma once
22
 #pragma once
23
 
23
 
24
  // 100k bed thermistor in JGAurora A5. Calibrated by Sam Pinches 21st Jan 2018 using cheap k-type thermocouple inserted into heater block, using TM-902C meter.
24
  // 100k bed thermistor in JGAurora A5. Calibrated by Sam Pinches 21st Jan 2018 using cheap k-type thermocouple inserted into heater block, using TM-902C meter.
25
-const temp_entry_t temptable_15[] PROGMEM = {
25
+constexpr temp_entry_t temptable_15[] PROGMEM = {
26
   { OV(  31), 275 },
26
   { OV(  31), 275 },
27
   { OV(  33), 270 },
27
   { OV(  33), 270 },
28
   { OV(  35), 260 },
28
   { OV(  35), 260 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_17.h View File

22
 #pragma once
22
 #pragma once
23
 
23
 
24
 // Dagoma NTC 100k white thermistor
24
 // Dagoma NTC 100k white thermistor
25
-const temp_entry_t temptable_17[] PROGMEM = {
25
+constexpr temp_entry_t temptable_17[] PROGMEM = {
26
   { OV(  16),  309 },
26
   { OV(  16),  309 },
27
   { OV(  18),  307 },
27
   { OV(  18),  307 },
28
   { OV(  20),  300 },
28
   { OV(  20),  300 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_18.h View File

22
 #pragma once
22
 #pragma once
23
 
23
 
24
 // ATC Semitec 204GT-2 (4.7k pullup) Dagoma.Fr - MKS_Base_DKU001327 - version (measured/tested/approved)
24
 // ATC Semitec 204GT-2 (4.7k pullup) Dagoma.Fr - MKS_Base_DKU001327 - version (measured/tested/approved)
25
-const temp_entry_t temptable_18[] PROGMEM = {
25
+constexpr temp_entry_t temptable_18[] PROGMEM = {
26
   { OV(   1), 713 },
26
   { OV(   1), 713 },
27
   { OV(  17), 284 },
27
   { OV(  17), 284 },
28
   { OV(  20), 275 },
28
   { OV(  20), 275 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_2.h View File

26
 // Verified by linagee. Source: https://www.mouser.com/datasheet/2/362/semitec%20usa%20corporation_gtthermistor-1202937.pdf
26
 // Verified by linagee. Source: https://www.mouser.com/datasheet/2/362/semitec%20usa%20corporation_gtthermistor-1202937.pdf
27
 // Calculated using 4.7kohm pullup, voltage divider math, and manufacturer provided temp/resistance
27
 // Calculated using 4.7kohm pullup, voltage divider math, and manufacturer provided temp/resistance
28
 //
28
 //
29
-const temp_entry_t temptable_2[] PROGMEM = {
29
+constexpr temp_entry_t temptable_2[] PROGMEM = {
30
   { OV(   1), 848 },
30
   { OV(   1), 848 },
31
   { OV(  30), 300 }, // top rating 300C
31
   { OV(  30), 300 }, // top rating 300C
32
   { OV(  34), 290 },
32
   { OV(  34), 290 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_20.h View File

24
 #define REVERSE_TEMP_SENSOR_RANGE_20 1
24
 #define REVERSE_TEMP_SENSOR_RANGE_20 1
25
 
25
 
26
 // Pt100 with INA826 amp on Ultimaker v2.0 electronics
26
 // Pt100 with INA826 amp on Ultimaker v2.0 electronics
27
-const temp_entry_t temptable_20[] PROGMEM = {
27
+constexpr temp_entry_t temptable_20[] PROGMEM = {
28
   { OV(  0),    0 },
28
   { OV(  0),    0 },
29
   { OV(227),    1 },
29
   { OV(227),    1 },
30
   { OV(236),   10 },
30
   { OV(236),   10 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_201.h View File

24
 #define REVERSE_TEMP_SENSOR_RANGE_201 1
24
 #define REVERSE_TEMP_SENSOR_RANGE_201 1
25
 
25
 
26
 // Pt100 with LMV324 amp on Overlord v1.1 electronics
26
 // Pt100 with LMV324 amp on Overlord v1.1 electronics
27
-const temp_entry_t temptable_201[] PROGMEM = {
27
+constexpr temp_entry_t temptable_201[] PROGMEM = {
28
   { OV(   0),   0 },
28
   { OV(   0),   0 },
29
   { OV(   8),   1 },
29
   { OV(   8),   1 },
30
   { OV(  23),   6 },
30
   { OV(  23),   6 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_202.h View File

3
 // Temptable sent from dealer technologyoutlet.co.uk
3
 // Temptable sent from dealer technologyoutlet.co.uk
4
 //
4
 //
5
 
5
 
6
-const temp_entry_t temptable_202[] PROGMEM = {
6
+constexpr temp_entry_t temptable_202[] PROGMEM = {
7
   { OV(   1), 864 },
7
   { OV(   1), 864 },
8
   { OV(  35), 300 },
8
   { OV(  35), 300 },
9
   { OV(  38), 295 },
9
   { OV(  38), 295 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_21.h View File

28
 
28
 
29
 // Pt100 with INA826 amplifier board with 5v supply based on Thermistor 20, with 3v3 ADC reference on the mainboard.
29
 // Pt100 with INA826 amplifier board with 5v supply based on Thermistor 20, with 3v3 ADC reference on the mainboard.
30
 // If the ADC reference and INA826 board supply voltage are identical, Thermistor 20 instead.
30
 // If the ADC reference and INA826 board supply voltage are identical, Thermistor 20 instead.
31
-const temp_entry_t temptable_21[] PROGMEM = {
31
+constexpr temp_entry_t temptable_21[] PROGMEM = {
32
   { OV(  0),    0 },
32
   { OV(  0),    0 },
33
   { OV(227),    1 },
33
   { OV(227),    1 },
34
   { OV(236),   10 },
34
   { OV(236),   10 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_22.h View File

21
  */
21
  */
22
 
22
 
23
 // 100k hotend thermistor with 4.7k pull up to 3.3v and 220R to analog input as in GTM32 Pro vB
23
 // 100k hotend thermistor with 4.7k pull up to 3.3v and 220R to analog input as in GTM32 Pro vB
24
-const temp_entry_t temptable_22[] PROGMEM = {
24
+constexpr temp_entry_t temptable_22[] PROGMEM = {
25
   { OV(   1), 352 },
25
   { OV(   1), 352 },
26
   { OV(   6), 341 },
26
   { OV(   6), 341 },
27
   { OV(  11), 330 },
27
   { OV(  11), 330 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_23.h View File

21
  */
21
  */
22
 
22
 
23
 // 100k hotbed thermistor with 4.7k pull up to 3.3v and 220R to analog input as in GTM32 Pro vB
23
 // 100k hotbed thermistor with 4.7k pull up to 3.3v and 220R to analog input as in GTM32 Pro vB
24
-const temp_entry_t temptable_23[] PROGMEM = {
24
+constexpr temp_entry_t temptable_23[] PROGMEM = {
25
   { OV(   1), 938 },
25
   { OV(   1), 938 },
26
   { OV(  11), 423 },
26
   { OV(  11), 423 },
27
   { OV(  21), 351 },
27
   { OV(  21), 351 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_3.h View File

22
 #pragma once
22
 #pragma once
23
 
23
 
24
 // R25 = 100 kOhm, beta25 = 4120 K, 4.7 kOhm pull-up, mendel-parts
24
 // R25 = 100 kOhm, beta25 = 4120 K, 4.7 kOhm pull-up, mendel-parts
25
-const temp_entry_t temptable_3[] PROGMEM = {
25
+constexpr temp_entry_t temptable_3[] PROGMEM = {
26
   { OV(   1), 864 },
26
   { OV(   1), 864 },
27
   { OV(  21), 300 },
27
   { OV(  21), 300 },
28
   { OV(  25), 290 },
28
   { OV(  25), 290 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_30.h View File

28
 // B Value Tolerance         + / - 1%
28
 // B Value Tolerance         + / - 1%
29
 // Kis3d Silicone Heater 24V 200W/300W with 6mm Precision cast plate (EN AW 5083)
29
 // Kis3d Silicone Heater 24V 200W/300W with 6mm Precision cast plate (EN AW 5083)
30
 // Temperature setting time 10 min to determine the 12Bit ADC value on the surface. (le3tspeak)
30
 // Temperature setting time 10 min to determine the 12Bit ADC value on the surface. (le3tspeak)
31
-const temp_entry_t temptable_30[] PROGMEM = {
31
+constexpr temp_entry_t temptable_30[] PROGMEM = {
32
   { OV(   1), 938 },
32
   { OV(   1), 938 },
33
   { OV( 298), 125 }, // 1193 - 125°
33
   { OV( 298), 125 }, // 1193 - 125°
34
   { OV( 321), 121 }, // 1285 - 121°
34
   { OV( 321), 121 }, // 1285 - 121°

+ 1
- 1
Marlin/src/module/thermistor/thermistor_331.h View File

24
 #define OVM(V) OV((V)*(0.327/0.5))
24
 #define OVM(V) OV((V)*(0.327/0.5))
25
 
25
 
26
 // R25 = 100 kOhm, beta25 = 4092 K, 4.7 kOhm pull-up, bed thermistor
26
 // R25 = 100 kOhm, beta25 = 4092 K, 4.7 kOhm pull-up, bed thermistor
27
-const temp_entry_t temptable_331[] PROGMEM = {
27
+constexpr temp_entry_t temptable_331[] PROGMEM = {
28
   { OVM(  23), 300 },
28
   { OVM(  23), 300 },
29
   { OVM(  25), 295 },
29
   { OVM(  25), 295 },
30
   { OVM(  27), 290 },
30
   { OVM(  27), 290 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_332.h View File

24
 #define OVM(V) OV((V)*(0.327/0.327))
24
 #define OVM(V) OV((V)*(0.327/0.327))
25
 
25
 
26
 // R25 = 100 kOhm, beta25 = 4092 K, 4.7 kOhm pull-up, bed thermistor
26
 // R25 = 100 kOhm, beta25 = 4092 K, 4.7 kOhm pull-up, bed thermistor
27
-const temp_entry_t temptable_332[] PROGMEM = {
27
+constexpr temp_entry_t temptable_332[] PROGMEM = {
28
   { OVM( 268), 150 },
28
   { OVM( 268), 150 },
29
   { OVM( 293), 145 },
29
   { OVM( 293), 145 },
30
   { OVM( 320), 141 },
30
   { OVM( 320), 141 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_4.h View File

22
 #pragma once
22
 #pragma once
23
 
23
 
24
 // R25 = 10 kOhm, beta25 = 3950 K, 4.7 kOhm pull-up, Generic 10k thermistor
24
 // R25 = 10 kOhm, beta25 = 3950 K, 4.7 kOhm pull-up, Generic 10k thermistor
25
-const temp_entry_t temptable_4[] PROGMEM = {
25
+constexpr temp_entry_t temptable_4[] PROGMEM = {
26
   { OV(   1), 430 },
26
   { OV(   1), 430 },
27
   { OV(  54), 137 },
27
   { OV(  54), 137 },
28
   { OV( 107), 107 },
28
   { OV( 107), 107 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_5.h View File

26
 // ATC Semitec 104GT-2/104NT-4-R025H42G (Used in ParCan)
26
 // ATC Semitec 104GT-2/104NT-4-R025H42G (Used in ParCan)
27
 // Verified by linagee. Source: https://www.mouser.com/datasheet/2/362/semitec%20usa%20corporation_gtthermistor-1202937.pdf
27
 // Verified by linagee. Source: https://www.mouser.com/datasheet/2/362/semitec%20usa%20corporation_gtthermistor-1202937.pdf
28
 // Calculated using 4.7kohm pullup, voltage divider math, and manufacturer provided temp/resistance
28
 // Calculated using 4.7kohm pullup, voltage divider math, and manufacturer provided temp/resistance
29
-const temp_entry_t temptable_5[] PROGMEM = {
29
+constexpr temp_entry_t temptable_5[] PROGMEM = {
30
   { OV(   1), 713 },
30
   { OV(   1), 713 },
31
   { OV(  17), 300 }, // top rating 300C
31
   { OV(  17), 300 }, // top rating 300C
32
   { OV(  20), 290 },
32
   { OV(  20), 290 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_501.h View File

22
 #pragma once
22
 #pragma once
23
 
23
 
24
 // 100k Zonestar thermistor. Adjusted By Hally
24
 // 100k Zonestar thermistor. Adjusted By Hally
25
-const temp_entry_t temptable_501[] PROGMEM = {
25
+constexpr temp_entry_t temptable_501[] PROGMEM = {
26
    { OV(   1), 713 },
26
    { OV(   1), 713 },
27
    { OV(  14), 300 }, // Top rating 300C
27
    { OV(  14), 300 }, // Top rating 300C
28
    { OV(  16), 290 },
28
    { OV(  16), 290 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_502.h View File

23
 
23
 
24
 // Unknown thermistor for the Zonestar P802M hot bed. Adjusted By Nerseth
24
 // Unknown thermistor for the Zonestar P802M hot bed. Adjusted By Nerseth
25
 // These were the shipped settings from Zonestar in original firmware: P802M_8_Repetier_V1.6_Zonestar.zip
25
 // These were the shipped settings from Zonestar in original firmware: P802M_8_Repetier_V1.6_Zonestar.zip
26
-const temp_entry_t temptable_502[] PROGMEM = {
26
+constexpr temp_entry_t temptable_502[] PROGMEM = {
27
    { OV(  56.0 / 4), 300 },
27
    { OV(  56.0 / 4), 300 },
28
    { OV( 187.0 / 4), 250 },
28
    { OV( 187.0 / 4), 250 },
29
    { OV( 615.0 / 4), 190 },
29
    { OV( 615.0 / 4), 190 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_503.h View File

23
 
23
 
24
 // Zonestar (Z8XM2) Heated Bed thermistor. Added By AvanOsch
24
 // Zonestar (Z8XM2) Heated Bed thermistor. Added By AvanOsch
25
 // These are taken from the Zonestar settings in original Repetier firmware: Z8XM2_ZRIB_LCD12864_V51.zip
25
 // These are taken from the Zonestar settings in original Repetier firmware: Z8XM2_ZRIB_LCD12864_V51.zip
26
-const temp_entry_t temptable_503[] PROGMEM = {
26
+constexpr temp_entry_t temptable_503[] PROGMEM = {
27
    { OV(  12), 300 },
27
    { OV(  12), 300 },
28
    { OV(  27), 270 },
28
    { OV(  27), 270 },
29
    { OV(  47), 250 },
29
    { OV(  47), 250 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_51.h View File

26
 // Verified by linagee.
26
 // Verified by linagee.
27
 // Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance
27
 // Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance
28
 // Advantage: Twice the resolution and better linearity from 150C to 200C
28
 // Advantage: Twice the resolution and better linearity from 150C to 200C
29
-const temp_entry_t temptable_51[] PROGMEM = {
29
+constexpr temp_entry_t temptable_51[] PROGMEM = {
30
   { OV(   1), 350 },
30
   { OV(   1), 350 },
31
   { OV( 190), 250 }, // top rating 250C
31
   { OV( 190), 250 }, // top rating 250C
32
   { OV( 203), 245 },
32
   { OV( 203), 245 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_512.h View File

22
 
22
 
23
 // 100k thermistor supplied with RPW-Ultra hotend, 4.7k pullup
23
 // 100k thermistor supplied with RPW-Ultra hotend, 4.7k pullup
24
 
24
 
25
-const temp_entry_t temptable_512[] PROGMEM = {
25
+constexpr temp_entry_t temptable_512[] PROGMEM = {
26
   { OV(26),  300 },
26
   { OV(26),  300 },
27
   { OV(28),  295 },
27
   { OV(28),  295 },
28
   { OV(30),  290 },
28
   { OV(30),  290 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_52.h View File

26
 // Verified by linagee. Source: https://www.mouser.com/datasheet/2/362/semitec%20usa%20corporation_gtthermistor-1202937.pdf
26
 // Verified by linagee. Source: https://www.mouser.com/datasheet/2/362/semitec%20usa%20corporation_gtthermistor-1202937.pdf
27
 // Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance
27
 // Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance
28
 // Advantage: More resolution and better linearity from 150C to 200C
28
 // Advantage: More resolution and better linearity from 150C to 200C
29
-const temp_entry_t temptable_52[] PROGMEM = {
29
+constexpr temp_entry_t temptable_52[] PROGMEM = {
30
   { OV(   1), 500 },
30
   { OV(   1), 500 },
31
   { OV( 125), 300 }, // top rating 300C
31
   { OV( 125), 300 }, // top rating 300C
32
   { OV( 142), 290 },
32
   { OV( 142), 290 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_55.h View File

26
 // Verified by linagee. Source: https://www.mouser.com/datasheet/2/362/semitec%20usa%20corporation_gtthermistor-1202937.pdf
26
 // Verified by linagee. Source: https://www.mouser.com/datasheet/2/362/semitec%20usa%20corporation_gtthermistor-1202937.pdf
27
 // Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance
27
 // Calculated using 1kohm pullup, voltage divider math, and manufacturer provided temp/resistance
28
 // Advantage: More resolution and better linearity from 150C to 200C
28
 // Advantage: More resolution and better linearity from 150C to 200C
29
-const temp_entry_t temptable_55[] PROGMEM = {
29
+constexpr temp_entry_t temptable_55[] PROGMEM = {
30
   { OV(   1), 500 },
30
   { OV(   1), 500 },
31
   { OV(  76), 300 },
31
   { OV(  76), 300 },
32
   { OV(  87), 290 },
32
   { OV(  87), 290 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_6.h View File

22
 #pragma once
22
 #pragma once
23
 
23
 
24
 // R25 = 100 kOhm, beta25 = 4092 K, 8.2 kOhm pull-up, 100k Epcos (?) thermistor
24
 // R25 = 100 kOhm, beta25 = 4092 K, 8.2 kOhm pull-up, 100k Epcos (?) thermistor
25
-const temp_entry_t temptable_6[] PROGMEM = {
25
+constexpr temp_entry_t temptable_6[] PROGMEM = {
26
   { OV(   1), 350 },
26
   { OV(   1), 350 },
27
   { OV(  28), 250 }, // top rating 250C
27
   { OV(  28), 250 }, // top rating 250C
28
   { OV(  31), 245 },
28
   { OV(  31), 245 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_60.h View File

31
 // beta: 3950
31
 // beta: 3950
32
 // min adc: 1 at 0.0048828125 V
32
 // min adc: 1 at 0.0048828125 V
33
 // max adc: 1023 at 4.9951171875 V
33
 // max adc: 1023 at 4.9951171875 V
34
-const temp_entry_t temptable_60[] PROGMEM = {
34
+constexpr temp_entry_t temptable_60[] PROGMEM = {
35
   { OV(  51), 272 },
35
   { OV(  51), 272 },
36
   { OV(  61), 258 },
36
   { OV(  61), 258 },
37
   { OV(  71), 247 },
37
   { OV(  71), 247 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_61.h View File

30
 // Resistance Tolerance     + / -1%
30
 // Resistance Tolerance     + / -1%
31
 // B Value             3950K at 25/50 deg. C
31
 // B Value             3950K at 25/50 deg. C
32
 // B Value Tolerance         + / - 1%
32
 // B Value Tolerance         + / - 1%
33
-const temp_entry_t temptable_61[] PROGMEM = {
33
+constexpr temp_entry_t temptable_61[] PROGMEM = {
34
   { OV(   2.00), 420 }, // Guestimate to ensure we dont lose a reading and drop temps to -50 when over
34
   { OV(   2.00), 420 }, // Guestimate to ensure we dont lose a reading and drop temps to -50 when over
35
   { OV(  12.07), 350 },
35
   { OV(  12.07), 350 },
36
   { OV(  12.79), 345 },
36
   { OV(  12.79), 345 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_66.h View File

22
 #pragma once
22
 #pragma once
23
 
23
 
24
 // R25 = 2.5 MOhm, beta25 = 4500 K, 4.7 kOhm pull-up, DyzeDesign 500 °C Thermistor
24
 // R25 = 2.5 MOhm, beta25 = 4500 K, 4.7 kOhm pull-up, DyzeDesign 500 °C Thermistor
25
-const temp_entry_t temptable_66[] PROGMEM = {
25
+constexpr temp_entry_t temptable_66[] PROGMEM = {
26
   { OV(  17.5), 850 },
26
   { OV(  17.5), 850 },
27
   { OV(  17.9), 500 },
27
   { OV(  17.9), 500 },
28
   { OV(  21.7), 480 },
28
   { OV(  21.7), 480 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_666.h View File

33
  * B: 0.00031362
33
  * B: 0.00031362
34
  * C: -2.03978e-07
34
  * C: -2.03978e-07
35
  */
35
  */
36
-const temp_entry_t temptable_666[] PROGMEM = {
36
+constexpr temp_entry_t temptable_666[] PROGMEM = {
37
   { OV(  1), 794 },
37
   { OV(  1), 794 },
38
   { OV( 18), 288 },
38
   { OV( 18), 288 },
39
   { OV( 35), 234 },
39
   { OV( 35), 234 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_67.h View File

22
 #pragma once
22
 #pragma once
23
 
23
 
24
 // R25 = 500 KOhm, beta25 = 3800 K, 4.7 kOhm pull-up, SliceEngineering 450 °C Thermistor
24
 // R25 = 500 KOhm, beta25 = 3800 K, 4.7 kOhm pull-up, SliceEngineering 450 °C Thermistor
25
-const temp_entry_t temptable_67[] PROGMEM = {
25
+constexpr temp_entry_t temptable_67[] PROGMEM = {
26
   { OV(  22 ),  500 },
26
   { OV(  22 ),  500 },
27
   { OV(  23 ),  490 },
27
   { OV(  23 ),  490 },
28
   { OV(  25 ),  480 },
28
   { OV(  25 ),  480 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_7.h View File

22
 #pragma once
22
 #pragma once
23
 
23
 
24
 // R25 = 100 kOhm, beta25 = 3974 K, 4.7 kOhm pull-up, Honeywell 135-104LAG-J01
24
 // R25 = 100 kOhm, beta25 = 3974 K, 4.7 kOhm pull-up, Honeywell 135-104LAG-J01
25
-const temp_entry_t temptable_7[] PROGMEM = {
25
+constexpr temp_entry_t temptable_7[] PROGMEM = {
26
   { OV(   1), 941 },
26
   { OV(   1), 941 },
27
   { OV(  19), 362 },
27
   { OV(  19), 362 },
28
   { OV(  37), 299 }, // top rating 300C
28
   { OV(  37), 299 }, // top rating 300C

+ 1
- 1
Marlin/src/module/thermistor/thermistor_70.h View File

26
 // ANENG AN8009 DMM with a K-type probe used for measurements.
26
 // ANENG AN8009 DMM with a K-type probe used for measurements.
27
 
27
 
28
 // R25 = 100 kOhm, beta25 = 4100 K, 4.7 kOhm pull-up, bqh2 stock thermistor
28
 // R25 = 100 kOhm, beta25 = 4100 K, 4.7 kOhm pull-up, bqh2 stock thermistor
29
-const temp_entry_t temptable_70[] PROGMEM = {
29
+constexpr temp_entry_t temptable_70[] PROGMEM = {
30
   { OV(  18), 270 },
30
   { OV(  18), 270 },
31
   { OV(  27), 248 },
31
   { OV(  27), 248 },
32
   { OV(  34), 234 },
32
   { OV(  34), 234 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_71.h View File

27
 // Beta = 3974
27
 // Beta = 3974
28
 // R1 = 0 Ohm
28
 // R1 = 0 Ohm
29
 // R2 = 4700 Ohm
29
 // R2 = 4700 Ohm
30
-const temp_entry_t temptable_71[] PROGMEM = {
30
+constexpr temp_entry_t temptable_71[] PROGMEM = {
31
   { OV(  35), 300 },
31
   { OV(  35), 300 },
32
   { OV(  51), 269 },
32
   { OV(  51), 269 },
33
   { OV(  59), 258 },
33
   { OV(  59), 258 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_75.h View File

34
 
34
 
35
 //#define HIGH_TEMP_RANGE_75
35
 //#define HIGH_TEMP_RANGE_75
36
 
36
 
37
-const temp_entry_t temptable_75[] PROGMEM = { // Generic Silicon Heat Pad with NTC 100K MGB18-104F39050L32 thermistor
37
+constexpr temp_entry_t temptable_75[] PROGMEM = { // Generic Silicon Heat Pad with NTC 100K MGB18-104F39050L32 thermistor
38
   { OV(111.06), 200 }, // v=0.542 r=571.747 res=0.501 degC/count
38
   { OV(111.06), 200 }, // v=0.542 r=571.747 res=0.501 degC/count
39
 
39
 
40
   #ifdef HIGH_TEMP_RANGE_75
40
   #ifdef HIGH_TEMP_RANGE_75

+ 1
- 1
Marlin/src/module/thermistor/thermistor_8.h View File

22
 #pragma once
22
 #pragma once
23
 
23
 
24
 // R25 = 100 kOhm, beta25 = 3950 K, 10 kOhm pull-up, NTCS0603E3104FHT
24
 // R25 = 100 kOhm, beta25 = 3950 K, 10 kOhm pull-up, NTCS0603E3104FHT
25
-const temp_entry_t temptable_8[] PROGMEM = {
25
+constexpr temp_entry_t temptable_8[] PROGMEM = {
26
   { OV(   1), 704 },
26
   { OV(   1), 704 },
27
   { OV(  54), 216 },
27
   { OV(  54), 216 },
28
   { OV( 107), 175 },
28
   { OV( 107), 175 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_9.h View File

22
 #pragma once
22
 #pragma once
23
 
23
 
24
 // R25 = 100 kOhm, beta25 = 3960 K, 4.7 kOhm pull-up, GE Sensing AL03006-58.2K-97-G1
24
 // R25 = 100 kOhm, beta25 = 3960 K, 4.7 kOhm pull-up, GE Sensing AL03006-58.2K-97-G1
25
-const temp_entry_t temptable_9[] PROGMEM = {
25
+constexpr temp_entry_t temptable_9[] PROGMEM = {
26
   { OV(   1), 936 },
26
   { OV(   1), 936 },
27
   { OV(  36), 300 },
27
   { OV(  36), 300 },
28
   { OV(  71), 246 },
28
   { OV(  71), 246 },

+ 1
- 1
Marlin/src/module/thermistor/thermistor_99.h View File

24
 
24
 
25
 // 100k bed thermistor with a 10K pull-up resistor - made by $ buildroot/share/scripts/createTemperatureLookupMarlin.py --rp=10000
25
 // 100k bed thermistor with a 10K pull-up resistor - made by $ buildroot/share/scripts/createTemperatureLookupMarlin.py --rp=10000
26
 
26
 
27
-const temp_entry_t temptable_99[] PROGMEM = {
27
+constexpr temp_entry_t temptable_99[] PROGMEM = {
28
   { OV(  5.81), 350 }, // v=0.028   r=    57.081  res=13.433 degC/count
28
   { OV(  5.81), 350 }, // v=0.028   r=    57.081  res=13.433 degC/count
29
   { OV(  6.54), 340 }, // v=0.032   r=    64.248  res=11.711 degC/count
29
   { OV(  6.54), 340 }, // v=0.032   r=    64.248  res=11.711 degC/count
30
   { OV(  7.38), 330 }, // v=0.036   r=    72.588  res=10.161 degC/count
30
   { OV(  7.38), 330 }, // v=0.036   r=    72.588  res=10.161 degC/count

+ 1
- 1
Marlin/src/module/thermistor/thermistor_998.h View File

27
   #define DUMMY_THERMISTOR_998_VALUE 25
27
   #define DUMMY_THERMISTOR_998_VALUE 25
28
 #endif
28
 #endif
29
 
29
 
30
-const temp_entry_t temptable_998[] PROGMEM = {
30
+constexpr temp_entry_t temptable_998[] PROGMEM = {
31
   { OV(   1), DUMMY_THERMISTOR_998_VALUE },
31
   { OV(   1), DUMMY_THERMISTOR_998_VALUE },
32
   { OV(1023), DUMMY_THERMISTOR_998_VALUE }
32
   { OV(1023), DUMMY_THERMISTOR_998_VALUE }
33
 };
33
 };

+ 1
- 1
Marlin/src/module/thermistor/thermistor_999.h View File

27
   #define DUMMY_THERMISTOR_999_VALUE 25
27
   #define DUMMY_THERMISTOR_999_VALUE 25
28
 #endif
28
 #endif
29
 
29
 
30
-const temp_entry_t temptable_999[] PROGMEM = {
30
+constexpr temp_entry_t temptable_999[] PROGMEM = {
31
   { OV(   1), DUMMY_THERMISTOR_999_VALUE },
31
   { OV(   1), DUMMY_THERMISTOR_999_VALUE },
32
   { OV(1023), DUMMY_THERMISTOR_999_VALUE }
32
   { OV(1023), DUMMY_THERMISTOR_999_VALUE }
33
 };
33
 };

+ 62
- 62
Marlin/src/module/thermistor/thermistors.h View File

42
 #define OV_SCALE(N) (N)
42
 #define OV_SCALE(N) (N)
43
 #define OV(N) int16_t(OV_SCALE(N) * (OVERSAMPLENR) * (THERMISTOR_TABLE_SCALE))
43
 #define OV(N) int16_t(OV_SCALE(N) * (OVERSAMPLENR) * (THERMISTOR_TABLE_SCALE))
44
 
44
 
45
-#define ANY_THERMISTOR_IS(n) (TEMP_SENSOR_0_THERMISTOR_ID == n || TEMP_SENSOR_1_THERMISTOR_ID == n || TEMP_SENSOR_2_THERMISTOR_ID == n || TEMP_SENSOR_3_THERMISTOR_ID == n || TEMP_SENSOR_4_THERMISTOR_ID == n || TEMP_SENSOR_5_THERMISTOR_ID == n || TEMP_SENSOR_6_THERMISTOR_ID == n || TEMP_SENSOR_7_THERMISTOR_ID == n || TEMP_SENSOR_BED_THERMISTOR_ID == n || TEMP_SENSOR_CHAMBER_THERMISTOR_ID == n || TEMP_SENSOR_COOLER_THERMISTOR_ID == n || TEMP_SENSOR_PROBE_THERMISTOR_ID == n)
45
+#define TEMP_SENSOR_IS(n,H) (n == TEMP_SENSOR_##H)
46
+#define ANY_THERMISTOR_IS(n) ( TEMP_SENSOR_IS(n, 0) || TEMP_SENSOR_IS(n, 1) \
47
+                            || TEMP_SENSOR_IS(n, 2) || TEMP_SENSOR_IS(n, 3) \
48
+                            || TEMP_SENSOR_IS(n, 4) || TEMP_SENSOR_IS(n, 5) \
49
+                            || TEMP_SENSOR_IS(n, 6) || TEMP_SENSOR_IS(n, 7) \
50
+                            || TEMP_SENSOR_IS(n, BED) \
51
+                            || TEMP_SENSOR_IS(n, CHAMBER) \
52
+                            || TEMP_SENSOR_IS(n, COOLER) \
53
+                            || TEMP_SENSOR_IS(n, PROBE) \
54
+                            || TEMP_SENSOR_IS(n, REDUNDANT) )
46
 
55
 
47
 typedef struct { int16_t value; celsius_t celsius; } temp_entry_t;
56
 typedef struct { int16_t value; celsius_t celsius; } temp_entry_t;
48
 
57
 
198
   #include "thermistor_999.h"
207
   #include "thermistor_999.h"
199
 #endif
208
 #endif
200
 #if ANY_THERMISTOR_IS(1000) // Custom
209
 #if ANY_THERMISTOR_IS(1000) // Custom
201
-  const temp_entry_t temptable_1000[] PROGMEM = { { 0, 0 } };
210
+  constexpr temp_entry_t temptable_1000[] PROGMEM = { { 0, 0 } };
202
 #endif
211
 #endif
203
 
212
 
204
 #define _TT_NAME(_N) temptable_ ## _N
213
 #define _TT_NAME(_N) temptable_ ## _N
205
 #define TT_NAME(_N) _TT_NAME(_N)
214
 #define TT_NAME(_N) _TT_NAME(_N)
206
 
215
 
207
-
208
-#if TEMP_SENSOR_0_THERMISTOR_ID
209
-  #define TEMPTABLE_0 TT_NAME(TEMP_SENSOR_0_THERMISTOR_ID)
216
+#if TEMP_SENSOR_0 > 0
217
+  #define TEMPTABLE_0 TT_NAME(TEMP_SENSOR_0)
210
   #define TEMPTABLE_0_LEN COUNT(TEMPTABLE_0)
218
   #define TEMPTABLE_0_LEN COUNT(TEMPTABLE_0)
211
-#elif TEMP_SENSOR_0_IS_THERMISTOR
212
-  #error "No heater 0 thermistor table specified"
213
 #else
219
 #else
214
   #define TEMPTABLE_0 nullptr
220
   #define TEMPTABLE_0 nullptr
215
   #define TEMPTABLE_0_LEN 0
221
   #define TEMPTABLE_0_LEN 0
216
 #endif
222
 #endif
217
 
223
 
218
-#if TEMP_SENSOR_1_THERMISTOR_ID
219
-  #define TEMPTABLE_1 TT_NAME(TEMP_SENSOR_1_THERMISTOR_ID)
224
+#if TEMP_SENSOR_1 > 0
225
+  #define TEMPTABLE_1 TT_NAME(TEMP_SENSOR_1)
220
   #define TEMPTABLE_1_LEN COUNT(TEMPTABLE_1)
226
   #define TEMPTABLE_1_LEN COUNT(TEMPTABLE_1)
221
-#elif TEMP_SENSOR_1_IS_THERMISTOR
222
-  #error "No heater 1 thermistor table specified"
223
 #else
227
 #else
224
   #define TEMPTABLE_1 nullptr
228
   #define TEMPTABLE_1 nullptr
225
   #define TEMPTABLE_1_LEN 0
229
   #define TEMPTABLE_1_LEN 0
226
 #endif
230
 #endif
227
 
231
 
228
-#if TEMP_SENSOR_2_THERMISTOR_ID
229
-  #define TEMPTABLE_2 TT_NAME(TEMP_SENSOR_2_THERMISTOR_ID)
232
+#if TEMP_SENSOR_2 > 0
233
+  #define TEMPTABLE_2 TT_NAME(TEMP_SENSOR_2)
230
   #define TEMPTABLE_2_LEN COUNT(TEMPTABLE_2)
234
   #define TEMPTABLE_2_LEN COUNT(TEMPTABLE_2)
231
-#elif TEMP_SENSOR_2_IS_THERMISTOR
232
-  #error "No heater 2 thermistor table specified"
233
 #else
235
 #else
234
   #define TEMPTABLE_2 nullptr
236
   #define TEMPTABLE_2 nullptr
235
   #define TEMPTABLE_2_LEN 0
237
   #define TEMPTABLE_2_LEN 0
236
 #endif
238
 #endif
237
 
239
 
238
-#if TEMP_SENSOR_3_THERMISTOR_ID
239
-  #define TEMPTABLE_3 TT_NAME(TEMP_SENSOR_3_THERMISTOR_ID)
240
+#if TEMP_SENSOR_3 > 0
241
+  #define TEMPTABLE_3 TT_NAME(TEMP_SENSOR_3)
240
   #define TEMPTABLE_3_LEN COUNT(TEMPTABLE_3)
242
   #define TEMPTABLE_3_LEN COUNT(TEMPTABLE_3)
241
-#elif TEMP_SENSOR_3_IS_THERMISTOR
242
-  #error "No heater 3 thermistor table specified"
243
 #else
243
 #else
244
   #define TEMPTABLE_3 nullptr
244
   #define TEMPTABLE_3 nullptr
245
   #define TEMPTABLE_3_LEN 0
245
   #define TEMPTABLE_3_LEN 0
246
 #endif
246
 #endif
247
 
247
 
248
-#if TEMP_SENSOR_4_THERMISTOR_ID
249
-  #define TEMPTABLE_4 TT_NAME(TEMP_SENSOR_4_THERMISTOR_ID)
248
+#if TEMP_SENSOR_4 > 0
249
+  #define TEMPTABLE_4 TT_NAME(TEMP_SENSOR_4)
250
   #define TEMPTABLE_4_LEN COUNT(TEMPTABLE_4)
250
   #define TEMPTABLE_4_LEN COUNT(TEMPTABLE_4)
251
-#elif TEMP_SENSOR_4_IS_THERMISTOR
252
-  #error "No heater 4 thermistor table specified"
253
 #else
251
 #else
254
   #define TEMPTABLE_4 nullptr
252
   #define TEMPTABLE_4 nullptr
255
   #define TEMPTABLE_4_LEN 0
253
   #define TEMPTABLE_4_LEN 0
256
 #endif
254
 #endif
257
 
255
 
258
-#if TEMP_SENSOR_5_THERMISTOR_ID
259
-  #define TEMPTABLE_5 TT_NAME(TEMP_SENSOR_5_THERMISTOR_ID)
256
+#if TEMP_SENSOR_5 > 0
257
+  #define TEMPTABLE_5 TT_NAME(TEMP_SENSOR_5)
260
   #define TEMPTABLE_5_LEN COUNT(TEMPTABLE_5)
258
   #define TEMPTABLE_5_LEN COUNT(TEMPTABLE_5)
261
-#elif TEMP_SENSOR_5_IS_THERMISTOR
262
-  #error "No heater 5 thermistor table specified"
263
 #else
259
 #else
264
   #define TEMPTABLE_5 nullptr
260
   #define TEMPTABLE_5 nullptr
265
   #define TEMPTABLE_5_LEN 0
261
   #define TEMPTABLE_5_LEN 0
266
 #endif
262
 #endif
267
 
263
 
268
-#if TEMP_SENSOR_6_THERMISTOR_ID
269
-  #define TEMPTABLE_6 TT_NAME(TEMP_SENSOR_6_THERMISTOR_ID)
264
+#if TEMP_SENSOR_6 > 0
265
+  #define TEMPTABLE_6 TT_NAME(TEMP_SENSOR_6)
270
   #define TEMPTABLE_6_LEN COUNT(TEMPTABLE_6)
266
   #define TEMPTABLE_6_LEN COUNT(TEMPTABLE_6)
271
-#elif TEMP_SENSOR_6_IS_THERMISTOR
272
-  #error "No heater 6 thermistor table specified"
273
 #else
267
 #else
274
   #define TEMPTABLE_6 nullptr
268
   #define TEMPTABLE_6 nullptr
275
   #define TEMPTABLE_6_LEN 0
269
   #define TEMPTABLE_6_LEN 0
276
 #endif
270
 #endif
277
 
271
 
278
-#if TEMP_SENSOR_7_THERMISTOR_ID
279
-  #define TEMPTABLE_7 TT_NAME(TEMP_SENSOR_7_THERMISTOR_ID)
272
+#if TEMP_SENSOR_7 > 0
273
+  #define TEMPTABLE_7 TT_NAME(TEMP_SENSOR_7)
280
   #define TEMPTABLE_7_LEN COUNT(TEMPTABLE_7)
274
   #define TEMPTABLE_7_LEN COUNT(TEMPTABLE_7)
281
-#elif TEMP_SENSOR_7_IS_THERMISTOR
282
-  #error "No heater 7 thermistor table specified"
283
 #else
275
 #else
284
   #define TEMPTABLE_7 nullptr
276
   #define TEMPTABLE_7 nullptr
285
   #define TEMPTABLE_7_LEN 0
277
   #define TEMPTABLE_7_LEN 0
286
 #endif
278
 #endif
287
 
279
 
288
-#ifdef TEMP_SENSOR_BED_THERMISTOR_ID
289
-  #define TEMPTABLE_BED TT_NAME(TEMP_SENSOR_BED_THERMISTOR_ID)
280
+#if TEMP_SENSOR_BED > 0
281
+  #define TEMPTABLE_BED TT_NAME(TEMP_SENSOR_BED)
290
   #define TEMPTABLE_BED_LEN COUNT(TEMPTABLE_BED)
282
   #define TEMPTABLE_BED_LEN COUNT(TEMPTABLE_BED)
291
-#elif TEMP_SENSOR_BED_IS_THERMISTOR
292
-  #error "No bed thermistor table specified"
293
 #else
283
 #else
294
   #define TEMPTABLE_BED_LEN 0
284
   #define TEMPTABLE_BED_LEN 0
295
 #endif
285
 #endif
296
 
286
 
297
-#ifdef TEMP_SENSOR_CHAMBER_THERMISTOR_ID
298
-  #define TEMPTABLE_CHAMBER TT_NAME(TEMP_SENSOR_CHAMBER_THERMISTOR_ID)
287
+#if TEMP_SENSOR_CHAMBER > 0
288
+  #define TEMPTABLE_CHAMBER TT_NAME(TEMP_SENSOR_CHAMBER)
299
   #define TEMPTABLE_CHAMBER_LEN COUNT(TEMPTABLE_CHAMBER)
289
   #define TEMPTABLE_CHAMBER_LEN COUNT(TEMPTABLE_CHAMBER)
300
-#elif TEMP_SENSOR_CHAMBER_IS_THERMISTOR
301
-  #error "No chamber thermistor table specified"
302
 #else
290
 #else
303
   #define TEMPTABLE_CHAMBER_LEN 0
291
   #define TEMPTABLE_CHAMBER_LEN 0
304
 #endif
292
 #endif
305
 
293
 
306
-#ifdef TEMP_SENSOR_COOLER_THERMISTOR_ID
307
-  #define TEMPTABLE_COOLER TT_NAME(TEMP_SENSOR_COOLER_THERMISTOR_ID)
294
+#if TEMP_SENSOR_COOLER > 0
295
+  #define TEMPTABLE_COOLER TT_NAME(TEMP_SENSOR_COOLER)
308
   #define TEMPTABLE_COOLER_LEN COUNT(TEMPTABLE_COOLER)
296
   #define TEMPTABLE_COOLER_LEN COUNT(TEMPTABLE_COOLER)
309
-#elif TEMP_SENSOR_COOLER_IS_THERMISTOR
310
-  #error "No cooler thermistor table specified"
311
 #else
297
 #else
312
   #define TEMPTABLE_COOLER_LEN 0
298
   #define TEMPTABLE_COOLER_LEN 0
313
 #endif
299
 #endif
314
-#ifdef TEMP_SENSOR_PROBE_THERMISTOR_ID
315
-  #define TEMPTABLE_PROBE TT_NAME(TEMP_SENSOR_PROBE_THERMISTOR_ID)
300
+
301
+#if TEMP_SENSOR_PROBE > 0
302
+  #define TEMPTABLE_PROBE TT_NAME(TEMP_SENSOR_PROBE)
316
   #define TEMPTABLE_PROBE_LEN COUNT(TEMPTABLE_PROBE)
303
   #define TEMPTABLE_PROBE_LEN COUNT(TEMPTABLE_PROBE)
317
-#elif TEMP_SENSOR_PROBE_IS_THERMISTOR
318
-  #error "No probe thermistor table specified"
319
 #else
304
 #else
320
   #define TEMPTABLE_PROBE_LEN 0
305
   #define TEMPTABLE_PROBE_LEN 0
321
 #endif
306
 #endif
322
 
307
 
308
+#if TEMP_SENSOR_REDUNDANT > 0
309
+  #define TEMPTABLE_REDUNDANT TT_NAME(TEMP_SENSOR_REDUNDANT)
310
+  #define TEMPTABLE_REDUNDANT_LEN COUNT(TEMPTABLE_REDUNDANT)
311
+#else
312
+  #define TEMPTABLE_REDUNDANT_LEN 0
313
+#endif
314
+
323
 // The SCAN_THERMISTOR_TABLE macro needs alteration?
315
 // The SCAN_THERMISTOR_TABLE macro needs alteration?
324
-static_assert(
325
-     TEMPTABLE_0_LEN < 256 && TEMPTABLE_1_LEN < 256
326
-  && TEMPTABLE_2_LEN < 256 && TEMPTABLE_3_LEN < 256
327
-  && TEMPTABLE_4_LEN < 256 && TEMPTABLE_5_LEN < 256
328
-  && TEMPTABLE_6_LEN < 256 && TEMPTABLE_7_LEN < 256
329
-  && TEMPTABLE_BED_LEN < 256 && TEMPTABLE_CHAMBER_LEN < 256
330
-  && TEMPTABLE_COOLER_LEN < 256 && TEMPTABLE_PROBE_LEN < 256,
331
-  "Temperature conversion tables over 255 entries need special consideration."
316
+static_assert(255 > TEMPTABLE_0_LEN || 255 > TEMPTABLE_1_LEN || 255 > TEMPTABLE_2_LEN || 255 > TEMPTABLE_3_LEN
317
+           || 255 > TEMPTABLE_4_LEN || 255 > TEMPTABLE_5_LEN || 255 > TEMPTABLE_6_LEN || 255 > TEMPTABLE_7_LEN
318
+           || 255 > TEMPTABLE_BED_LEN
319
+           || 255 > TEMPTABLE_CHAMBER_LEN
320
+           || 255 > TEMPTABLE_COOLER_LEN
321
+           || 255 > TEMPTABLE_PROBE_LEN
322
+           || 255 > TEMPTABLE_REDUNDANT_LEN
323
+  , "Temperature conversion tables over 255 entries need special consideration."
332
 );
324
 );
333
 
325
 
334
 // Set the high and low raw values for the heaters
326
 // Set the high and low raw values for the heaters
335
 // For thermistors the highest temperature results in the lowest ADC value
327
 // For thermistors the highest temperature results in the lowest ADC value
336
 // For thermocouples the highest temperature results in the highest ADC value
328
 // For thermocouples the highest temperature results in the highest ADC value
337
 
329
 
338
-#define __TT_REV(N)   REVERSE_TEMP_SENSOR_RANGE_##N
339
-#define _TT_REV(N)    __TT_REV(N)
340
-#define TT_REV(N)     _TT_REV(TEMP_SENSOR_##N##_THERMISTOR_ID)
330
+#define _TT_REV(N)    REVERSE_TEMP_SENSOR_RANGE_##N
331
+#define TT_REV(N)     TERN0(TEMP_SENSOR_##N##_IS_THERMISTOR, DEFER4(_TT_REV)(TEMP_SENSOR_##N))
341
 #define _TT_REVRAW(N) !TEMP_SENSOR_##N##_IS_THERMISTOR
332
 #define _TT_REVRAW(N) !TEMP_SENSOR_##N##_IS_THERMISTOR
342
 #define TT_REVRAW(N)  (TT_REV(N) || _TT_REVRAW(N))
333
 #define TT_REVRAW(N)  (TT_REV(N) || _TT_REVRAW(N))
343
 
334
 
522
     #define TEMP_SENSOR_PROBE_RAW_LO_TEMP MAX_RAW_THERMISTOR_VALUE
513
     #define TEMP_SENSOR_PROBE_RAW_LO_TEMP MAX_RAW_THERMISTOR_VALUE
523
   #endif
514
   #endif
524
 #endif
515
 #endif
516
+#ifndef TEMP_SENSOR_REDUNDANT_RAW_HI_TEMP
517
+  #if TT_REVRAW(REDUNDANT)
518
+    #define TEMP_SENSOR_REDUNDANT_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
519
+    #define TEMP_SENSOR_REDUNDANT_RAW_LO_TEMP 0
520
+  #else
521
+    #define TEMP_SENSOR_REDUNDANT_RAW_HI_TEMP 0
522
+    #define TEMP_SENSOR_REDUNDANT_RAW_LO_TEMP MAX_RAW_THERMISTOR_VALUE
523
+  #endif
524
+#endif
525
 
525
 
526
 #undef __TT_REV
526
 #undef __TT_REV
527
 #undef _TT_REV
527
 #undef _TT_REV

+ 1
- 1
buildroot/bin/mftest View File

37
 TESTPATH=buildroot/tests
37
 TESTPATH=buildroot/tests
38
 
38
 
39
 STATE_FILE="./.pio/.mftestrc"
39
 STATE_FILE="./.pio/.mftestrc"
40
-SED=$(which gsed || which sed)
40
+SED=$(which gsed sed | head -n1)
41
 
41
 
42
 shopt -s extglob nocasematch
42
 shopt -s extglob nocasematch
43
 
43
 

+ 1
- 1
buildroot/bin/opt_disable View File

3
 # exit on first failure
3
 # exit on first failure
4
 set -e
4
 set -e
5
 
5
 
6
-SED=$(which gsed || which sed)
6
+SED=$(which gsed sed | head -n1)
7
 
7
 
8
 for opt in "$@" ; do
8
 for opt in "$@" ; do
9
   DID=0 ; FOUND=0
9
   DID=0 ; FOUND=0

+ 1
- 1
buildroot/bin/opt_enable View File

3
 # exit on first failure
3
 # exit on first failure
4
 set -e
4
 set -e
5
 
5
 
6
-SED=$(which gsed || which sed)
6
+SED=$(which gsed sed | head -n1)
7
 
7
 
8
 for opt in "$@" ; do
8
 for opt in "$@" ; do
9
   DID=0 ; FOUND=0
9
   DID=0 ; FOUND=0

+ 1
- 1
buildroot/bin/opt_set View File

3
 # exit on first failure
3
 # exit on first failure
4
 set -e
4
 set -e
5
 
5
 
6
-SED=$(which gsed || which sed)
6
+SED=$(which gsed sed | head -n1)
7
 
7
 
8
 while [[ $# > 1 ]]; do
8
 while [[ $# > 1 ]]; do
9
   DID=0
9
   DID=0

+ 1
- 1
buildroot/bin/pins_set View File

6
 PIN=$2
6
 PIN=$2
7
 VAL=$3
7
 VAL=$3
8
 
8
 
9
-SED=$(which gsed || which sed)
9
+SED=$(which gsed sed | head -n1)
10
 eval "${SED} -i '/^[[:blank:]]*\(\/\/\)*[[:blank:]]*\(#define \+${PIN}\b\).*$/{s//\2 ${VAL}/;h};\${x;/./{x;q0};x;q9}' Marlin/src/pins/$DIR/pins_${NAM}.h" ||
10
 eval "${SED} -i '/^[[:blank:]]*\(\/\/\)*[[:blank:]]*\(#define \+${PIN}\b\).*$/{s//\2 ${VAL}/;h};\${x;/./{x;q0};x;q9}' Marlin/src/pins/$DIR/pins_${NAM}.h" ||
11
 (echo "ERROR: pins_set Can't find ${PIN}" >&2 && exit 9)
11
 (echo "ERROR: pins_set Can't find ${PIN}" >&2 && exit 9)

+ 1
- 1
buildroot/share/git/mfconfig View File

149
   ((COMMIT_STEPS)) && git add . >/dev/null && git commit -m "Reset TPARA..." >/dev/null
149
   ((COMMIT_STEPS)) && git add . >/dev/null && git commit -m "Reset TPARA..." >/dev/null
150
 
150
 
151
   # Update the %VERSION% in the README.md file
151
   # Update the %VERSION% in the README.md file
152
-  SED=$(which gsed || which sed)
152
+  SED=$(which gsed sed | head -n1)
153
   VERS=$( echo $EXPORT | $SED 's/release-//' )
153
   VERS=$( echo $EXPORT | $SED 's/release-//' )
154
   eval "${SED} -E -i~ -e 's/%VERSION%/$VERS/g' README.md"
154
   eval "${SED} -E -i~ -e 's/%VERSION%/$VERS/g' README.md"
155
   rm -f README.md~
155
   rm -f README.md~

Loading…
Cancel
Save