Преглед на файлове

MAX Thermocouples rework (#20447)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
JoAnn Manges преди 4 години
родител
ревизия
8707ae23e2
No account linked to committer's email address

+ 1
- 1
Marlin/src/HAL/LPC1768/inc/SanityCheck.h Целия файл

@@ -31,7 +31,7 @@
31 31
 /**
32 32
  * Detect an old pins file by checking for old ADC pins values.
33 33
  */
34
-#define _OLD_TEMP_PIN(P) PIN_EXISTS(P) && _CAT(P,_PIN) <= 7 && _CAT(P,_PIN) != 2 && _CAT(P,_PIN) != 3
34
+#define _OLD_TEMP_PIN(P) PIN_EXISTS(P) && _CAT(P,_PIN) <= 7 && !WITHIN(_CAT(P,_PIN), TERN(LPC1768_IS_SKRV1_3, 0, 2), 3)  // Include P0_00 and P0_01 for SKR V1.3 board
35 35
 #if _OLD_TEMP_PIN(TEMP_BED)
36 36
   #error "TEMP_BED_PIN must be defined using the Pn_nn or Pn_nn_An format. (See the included pins files)."
37 37
 #elif _OLD_TEMP_PIN(TEMP_0)

+ 3
- 3
Marlin/src/MarlinCore.cpp Целия файл

@@ -937,11 +937,11 @@ void setup() {
937 937
 
938 938
   SETUP_RUN(HAL_init());
939 939
 
940
-  // Init and disable SPI thermocouples
941
-  #if TEMP_SENSOR_0_IS_MAX6675
940
+  // Init and disable SPI thermocouples; this is still needed
941
+  #if TEMP_SENSOR_0_IS_MAX_TC
942 942
     OUT_WRITE(MAX6675_SS_PIN, HIGH);  // Disable
943 943
   #endif
944
-  #if TEMP_SENSOR_1_IS_MAX6675
944
+  #if TEMP_SENSOR_1_IS_MAX_TC
945 945
     OUT_WRITE(MAX6675_SS2_PIN, HIGH); // Disable
946 946
   #endif
947 947
 

+ 84
- 0
Marlin/src/inc/Conditionals_post.h Целия файл

@@ -490,6 +490,90 @@
490 490
   #define HAS_MAX6675 1
491 491
 #endif
492 492
 
493
+//
494
+// Compatibility layer for MAX (SPI) temp boards
495
+//
496
+#if PIN_EXISTS(MAX6675_SS)
497
+  #if TEMP_SENSOR_0_IS_MAX31855
498
+    #define MAX31855_CS_PIN MAX6675_SS_PIN
499
+  #elif TEMP_SENSOR_0_IS_MAX31865
500
+    #define MAX31865_CS_PIN MAX6675_SS_PIN
501
+  #elif TEMP_SENSOR_0_IS_MAX6675
502
+    #define MAX6675_CS_PIN MAX6675_SS_PIN
503
+  #endif
504
+#endif
505
+
506
+#if PIN_EXISTS(MAX6675_SS2)
507
+  #if TEMP_SENSOR_1_IS_MAX31855
508
+    #define MAX31855_CS2_PIN MAX6675_SS2_PIN
509
+  #elif TEMP_SENSOR_1_IS_MAX31865
510
+    #define MAX31865_CS2_PIN MAX6675_SS2_PIN
511
+  #elif TEMP_SENSOR_1_IS_MAX6675
512
+    #define MAX6675_CS2_PIN MAX6675_SS2_PIN
513
+  #endif
514
+#endif
515
+
516
+#if PIN_EXISTS(MAX6675_DO)
517
+  #if HAS_MAX31855
518
+    #define MAX31855_MISO_PIN MAX6675_DO_PIN
519
+  #elif HAS_MAX31865
520
+    #define MAX31865_MISO_PIN MAX6675_DO_PIN
521
+  #elif HAS_MAX6675
522
+    #define MAX6675_MISO_PIN MAX6675_DO_PIN
523
+  #endif
524
+#endif
525
+
526
+#if PIN_EXISTS(MAX6675_SCK)
527
+  #if HAS_MAX31855
528
+    #define MAX31855_SCK_PIN MAX6675_SCK_PIN
529
+  #elif HAS_MAX31865
530
+    #define MAX31865_SCK_PIN MAX6675_SCK_PIN
531
+  #endif
532
+#endif
533
+
534
+// Compatibility Layer for use when HAL manipulates PINS for MAX31855 and MAX6675
535
+#if PIN_EXISTS(MAX31855_CS) && !PIN_EXISTS(MAX6675_SS)
536
+  #define MAX6675_SS_PIN MAX31855_CS_PIN
537
+#endif
538
+#if PIN_EXISTS(MAX31855_CS2) && !PIN_EXISTS(MAX6675_SS2)
539
+  #define MAX6675_SS2_PIN MAX31855_CS2_PIN
540
+#endif
541
+#if PIN_EXISTS(MAX6675_CS) && !PIN_EXISTS(MAX6675_SS)
542
+  #define MAX6675_SS_PIN MAX6675_CS_PIN
543
+#endif
544
+#if PIN_EXISTS(MAX6675_CS2) && !PIN_EXISTS(MAX6675_SS2)
545
+  #define MAX6675_SS2_PIN MAX6675_CS2_PIN
546
+#endif
547
+#if PIN_EXISTS(MAX31855_MISO) && !PIN_EXISTS(MAX6675_DO)
548
+  #define MAX6675_DO_PIN MAX31855_MISO_PIN
549
+#endif
550
+#if PIN_EXISTS(MAX6675_MISO) && !PIN_EXISTS(MAX6675_DO)
551
+  #define MAX6675_DO_PIN MAX6675_MISO_PIN
552
+#endif
553
+#if PIN_EXISTS(MAX31855_SCK) && !PIN_EXISTS(MAX6675_SCK)
554
+  #define MAX6675_SCK_PIN MAX31855_SCK_PIN
555
+#endif
556
+
557
+//
558
+// User-defined thermocouple libraries
559
+//
560
+// Add LIB_MAX6675 / LIB_MAX31855 / LIB_MAX31865 to the build_flags
561
+// to select a USER library for MAX6675, MAX31855, MAX31865
562
+//
563
+#if BOTH(HAS_MAX6675, LIB_MAX6675)
564
+  #define LIB_USR_MAX6675 1
565
+#endif
566
+#if BOTH(HAS_MAX31855, LIB_MAX31855)
567
+  #define LIB_USR_MAX31855 1
568
+#endif
569
+#if HAS_MAX31865
570
+  #if ENABLED(LIB_MAX31865)
571
+    #define LIB_USR_MAX31865 1
572
+  #else
573
+    #define LIB_ADAFRUIT_MAX31865 1
574
+  #endif
575
+#endif
576
+
493 577
 #if TEMP_SENSOR_2 == -4
494 578
   #define TEMP_SENSOR_2_IS_AD8495 1
495 579
 #elif TEMP_SENSOR_2 == -3

+ 177
- 52
Marlin/src/module/temperature.cpp Целия файл

@@ -47,41 +47,104 @@
47 47
   #include "../lcd/extui/ui_api.h"
48 48
 #endif
49 49
 
50
-#if HAS_MAX31865
51
-  #include <Adafruit_MAX31865.h>
52
-  #if TEMP_SENSOR_0_IS_MAX31865 && !defined(MAX31865_CS_PIN) && PIN_EXISTS(MAX6675_SS)
53
-    #define MAX31865_CS_PIN   MAX6675_SS_PIN
50
+// LIB_MAX31855 can be added to the build_flags in platformio.ini to use a user-defined library
51
+#if LIB_USR_MAX31855
52
+  #include <Adafruit_MAX31855.h>
53
+  #if PIN_EXISTS(MAX31855_MISO) && PIN_EXISTS(MAX31855_SCK)
54
+    #define MAX31855_USES_SW_SPI 1
54 55
   #endif
55
-  #if TEMP_SENSOR_1_IS_MAX31865 && !defined(MAX31865_CS2_PIN) && PIN_EXISTS(MAX6675_SS2)
56
-    #define MAX31865_CS2_PIN  MAX6675_SS2_PIN
56
+  #if TEMP_SENSOR_0_IS_MAX31855 && PIN_EXISTS(MAX31855_CS)
57
+    #define HAS_MAX31855_TEMP 1
58
+    Adafruit_MAX31855 max31855_0 = Adafruit_MAX31855(MAX31855_CS_PIN
59
+      #if MAX31855_USES_SW_SPI
60
+        , MAX31855_MISO_PIN, MAX31855_SCK_PIN  // For software SPI also set MISO/SCK
61
+      #endif
62
+      #if ENABLED(LARGE_PINMAP)
63
+        , HIGH
64
+      #endif
65
+    );
66
+  #endif
67
+  #if TEMP_SENSOR_1_IS_MAX31855 && PIN_EXISTS(MAX31855_CS2)
68
+    #define HAS_MAX31855_TEMP 1
69
+    Adafruit_MAX31855 max31855_1 = Adafruit_MAX31855(MAX31855_CS2_PIN
70
+      #if MAX31855_USES_SW_SPI
71
+        , MAX31855_MISO_PIN, MAX31855_SCK_PIN  // For software SPI also set MISO/SCK
72
+      #endif
73
+      #if ENABLED(LARGE_PINMAP)
74
+        , HIGH
75
+      #endif
76
+    );
57 77
   #endif
78
+#endif
79
+
80
+// LIB_MAX31865 can be added to the build_flags in platformio.ini to use a user-defined library.
81
+// If LIB_MAX31865 is not on the build_flags then the Adafruit MAX31865 V1.1.0 library is used.
82
+#if HAS_MAX31865
83
+  #include <Adafruit_MAX31865.h>
58 84
   #ifndef MAX31865_MOSI_PIN
59 85
     #define MAX31865_MOSI_PIN SD_MOSI_PIN
60 86
   #endif
61
-  #ifndef MAX31865_MISO_PIN
62
-    #define MAX31865_MISO_PIN MAX6675_DO_PIN
63
-  #endif
64
-  #ifndef MAX31865_SCK_PIN
65
-    #define MAX31865_SCK_PIN  MAX6675_SCK_PIN
87
+  #if PIN_EXISTS(MAX31865_MISO) && PIN_EXISTS(MAX31865_SCK)
88
+    #define MAX31865_USES_SW_SPI 1
66 89
   #endif
67 90
   #if TEMP_SENSOR_0_IS_MAX31865 && PIN_EXISTS(MAX31865_CS)
68 91
     #define HAS_MAX31865_TEMP 1
69
-    Adafruit_MAX31865 max31865_0 = Adafruit_MAX31865(MAX31865_CS_PIN
70
-      #if MAX31865_CS_PIN != MAX6675_SS_PIN
71
-        , MAX31865_MOSI_PIN, MAX31865_MISO_PIN, MAX31865_SCK_PIN // For software SPI also set MOSI/MISO/SCK
72
-      #endif
73
-    );
92
+      Adafruit_MAX31865 max31865_0 = Adafruit_MAX31865(MAX31865_CS_PIN
93
+        #if MAX31865_USES_SW_SPI && PIN_EXISTS(MAX31865_MOSI)
94
+          , MAX31865_MOSI_PIN, MAX31865_MISO_PIN, MAX31865_SCK_PIN  // For software SPI also set MOSI/MISO/SCK
95
+        #endif
96
+        #if ENABLED(LARGE_PINMAP)
97
+          , HIGH
98
+        #endif
99
+      );
74 100
   #endif
75 101
   #if TEMP_SENSOR_1_IS_MAX31865 && PIN_EXISTS(MAX31865_CS2)
76 102
     #define HAS_MAX31865_TEMP 1
77 103
     Adafruit_MAX31865 max31865_1 = Adafruit_MAX31865(MAX31865_CS2_PIN
78
-      #if MAX31865_CS2_PIN != MAX6675_SS2_PIN
79
-        , MAX31865_MOSI_PIN, MAX31865_MISO_PIN, MAX31865_SCK_PIN // For software SPI also set MOSI/MISO/SCK
104
+      #if MAX31865_USES_SW_SPI && PIN_EXISTS(MAX31865_MOSI)
105
+        , MAX31865_MOSI_PIN, MAX31865_MISO_PIN, MAX31865_SCK_PIN  // For software SPI also set MOSI/MISO/SCK
106
+      #endif
107
+      #if ENABLED(LARGE_PINMAP)
108
+        , HIGH
109
+      #endif
110
+    );
111
+  #endif
112
+#endif
113
+
114
+// LIB_MAX6675 can be added to the build_flags in platformio.ini to use a user-defined library
115
+#if LIB_USR_MAX6675
116
+  #include <max6675.h>
117
+  #if PIN_EXISTS(MAX6675_MISO) && PIN_EXISTS(MAX6675_SCK)
118
+    #define MAX6675_USES_SW_SPI 1
119
+  #endif
120
+  #if TEMP_SENSOR_0_IS_MAX6675 && PIN_EXISTS(MAX6675_CS)
121
+    #define HAS_MAX6675_TEMP 1
122
+    MAX6675 max6675_0 = MAX6675(MAX6675_CS_PIN
123
+      #if MAX6675_USES_SW_SPI
124
+        , MAX6675_MISO_PIN, MAX6675_SCK_PIN   // For software SPI also set MISO/SCK
125
+      #endif
126
+      #if ENABLED(LARGE_PINMAP)
127
+        , HIGH
128
+      #endif
129
+    );
130
+  #endif
131
+  #if TEMP_SENSOR_1_IS_MAX6675 && PIN_EXISTS(MAX6675_CS2)
132
+    #define HAS_MAX6675_TEMP 1
133
+    MAX6675 max6675_1 = MAX6675(MAX6675_CS2_PIN
134
+      #if MAX6675_USES_SW_SPI
135
+        , MAX6675_MISO_PIN, MAX6675_SCK_PIN   // For software SPI also set MISO/SCK
136
+      #endif
137
+      #if ENABLED(LARGE_PINMAP)
138
+        , HIGH
80 139
       #endif
81 140
     );
82 141
   #endif
83 142
 #endif
84 143
 
144
+#if !HAS_MAX6675_TEMP && !HAS_MAX31855_TEMP && !HAS_MAX31865_TEMP
145
+  #define NO_THERMO_TEMPS 1
146
+#endif
147
+
85 148
 #if (TEMP_SENSOR_0_IS_MAX_TC || TEMP_SENSOR_1_IS_MAX_TC) && PINS_EXIST(MAX6675_SCK, MAX6675_DO) && NO_THERMO_TEMPS
86 149
   #define THERMO_SEPARATE_SPI 1
87 150
 #endif
@@ -1718,9 +1781,38 @@ void Temperature::updateTemperaturesFromRawValues() {
1718 1781
  * The manager is implemented by periodic calls to manage_heater()
1719 1782
  */
1720 1783
 void Temperature::init() {
1784
+  // Init (and disable) SPI thermocouples
1785
+  #if TEMP_SENSOR_0_IS_MAX6675 && PIN_EXISTS(MAX6675_CS)
1786
+    OUT_WRITE(MAX6675_CS_PIN, HIGH);
1787
+  #endif
1788
+  #if TEMP_SENSOR_1_IS_MAX6675 && PIN_EXISTS(MAX6675_CS2)
1789
+    OUT_WRITE(MAX6675_CS2_PIN, HIGH);
1790
+  #endif
1791
+  #if TEMP_SENSOR_0_IS_MAX6675 && PIN_EXISTS(MAX31855_CS)
1792
+    OUT_WRITE(MAX31855_CS_PIN, HIGH);
1793
+  #endif
1794
+  #if TEMP_SENSOR_1_IS_MAX6675 && PIN_EXISTS(MAX31855_CS2)
1795
+    OUT_WRITE(MAX31855_CS2_PIN, HIGH);
1796
+  #endif
1797
+  #if TEMP_SENSOR_0_IS_MAX6675 && PIN_EXISTS(MAX31865_CS)
1798
+    OUT_WRITE(MAX31865_CS_PIN, HIGH);
1799
+  #endif
1800
+  #if TEMP_SENSOR_1_IS_MAX6675 && PIN_EXISTS(MAX31865_CS2)
1801
+    OUT_WRITE(MAX31865_CS2_PIN, HIGH);
1802
+  #endif
1721 1803
 
1722
-  TERN_(TEMP_SENSOR_0_IS_MAX31865, max31865_0.begin(MAX31865_2WIRE)); // MAX31865_2WIRE, MAX31865_3WIRE, MAX31865_4WIRE
1723
-  TERN_(TEMP_SENSOR_1_IS_MAX31865, max31865_1.begin(MAX31865_2WIRE));
1804
+  #if HAS_MAX31865_TEMP
1805
+    TERN_(TEMP_SENSOR_0_IS_MAX31865, max31865_0.begin(MAX31865_2WIRE)); // MAX31865_2WIRE, MAX31865_3WIRE, MAX31865_4WIRE
1806
+    TERN_(TEMP_SENSOR_1_IS_MAX31865, max31865_1.begin(MAX31865_2WIRE));
1807
+  #endif
1808
+  #if HAS_MAX31855_TEMP
1809
+    TERN_(TEMP_SENSOR_0_IS_MAX31855, max31855_0.begin());
1810
+    TERN_(TEMP_SENSOR_1_IS_MAX31855, max31855_1.begin());
1811
+  #endif
1812
+  #if HAS_MAX6675_TEMP
1813
+    TERN_(TEMP_SENSOR_0_IS_MAX6675, max6675_0.begin());
1814
+    TERN_(TEMP_SENSOR_1_IS_MAX6675, max6675_1.begin());
1815
+  #endif
1724 1816
 
1725 1817
   #if EARLY_WATCHDOG
1726 1818
     // Flag that the thermalManager should be running
@@ -2234,7 +2326,7 @@ void Temperature::disable_all_heaters() {
2234 2326
   int Temperature::read_max_tc(TERN_(HAS_MULTI_MAX_TC, const uint8_t hindex/*=0*/)) {
2235 2327
     #define MAX6675_HEAT_INTERVAL 250UL
2236 2328
 
2237
-    #if HAS_MAX31855
2329
+    #if HAS_MAX31855_TEMP
2238 2330
       static uint32_t max_tc_temp = 2000;
2239 2331
       #define MAX_TC_ERROR_MASK    7
2240 2332
       #define MAX_TC_DISCARD_BITS 18
@@ -2284,65 +2376,91 @@ void Temperature::disable_all_heaters() {
2284 2376
     if (PENDING(ms, next_max_tc_ms[hindex])) return int(THERMO_TEMP(hindex));
2285 2377
     next_max_tc_ms[hindex] = ms + MAX6675_HEAT_INTERVAL;
2286 2378
 
2287
-    #if HAS_MAX31865_TEMP
2288
-      Adafruit_MAX31865 &maxref = THERMO_SEL(max31865_0, max31865_1);
2289
-      const uint16_t max31865_ohms = (uint32_t(maxref.readRTD()) * THERMO_SEL(MAX31865_CALIBRATION_OHMS_0, MAX31865_CALIBRATION_OHMS_1)) >> 16;
2290
-    #endif
2291
-
2292 2379
     //
2293 2380
     // TODO: spiBegin, spiRec and spiInit doesn't work when soft spi is used.
2294 2381
     //
2295
-    #if !THERMO_SEPARATE_SPI
2382
+    #if !THERMO_SEPARATE_SPI && NO_THERMO_TEMPS
2296 2383
       spiBegin();
2297 2384
       spiInit(MAX_TC_SPEED_BITS);
2298 2385
     #endif
2299 2386
 
2300
-    MAX6675_WRITE(LOW); // enable TT_MAX6675
2301
-    DELAY_NS(100);      // Ensure 100ns delay
2387
+    #if NO_THERMO_TEMPS
2388
+      MAX6675_WRITE(LOW);  // enable TT_MAX6675
2389
+      DELAY_NS(100);       // Ensure 100ns delay
2390
+    #endif
2302 2391
 
2303
-    // Read a big-endian temperature value
2304 2392
     max_tc_temp = 0;
2305
-    for (uint8_t i = sizeof(max_tc_temp); i--;) {
2306
-      max_tc_temp |= TERN(THERMO_SEPARATE_SPI, max_tc_spi.receive(), spiRec());
2307
-      if (i > 0) max_tc_temp <<= 8; // shift left if not the last byte
2308
-    }
2309 2393
 
2310
-    MAX6675_WRITE(HIGH); // disable TT_MAX6675
2394
+    // Read a big-endian temperature value
2395
+    #if NO_THERMO_TEMPS
2396
+      for (uint8_t i = sizeof(max_tc_temp); i--;) {
2397
+        max_tc_temp |= TERN(THERMO_SEPARATE_SPI, max_tc_spi.receive(), spiRec());
2398
+        if (i > 0) max_tc_temp <<= 8; // shift left if not the last byte
2399
+      }
2400
+        MAX6675_WRITE(HIGH); // disable TT_MAX6675
2401
+    #endif
2402
+
2403
+    #if HAS_MAX31855_TEMP
2404
+      Adafruit_MAX31855 &max855ref = THERMO_SEL(max31855_0, max31855_1);
2405
+      max_tc_temp = max855ref.readRaw32();
2406
+    #endif
2407
+
2408
+    #if HAS_MAX31865_TEMP
2409
+      Adafruit_MAX31865 &max865ref = THERMO_SEL(max31865_0, max31865_1);
2410
+      #if ENABLED(LIB_USR_MAX31865)
2411
+        max_tc_temp = max865ref.readRTD_with_Fault();
2412
+      #endif
2413
+    #endif
2311 2414
 
2312
-    const uint8_t fault_31865 = TERN1(HAS_MAX31865_TEMP, maxref.readFault());
2415
+    #if HAS_MAX6675_TEMP
2416
+      MAX6675 &max6675ref = THERMO_SEL(max6675_0, max6675_1);
2417
+      max_tc_temp = max6675ref.readRaw16();
2418
+    #endif
2419
+
2420
+    #if ENABLED(LIB_ADAFRUIT_MAX31865)
2421
+      const uint8_t fault_31865 = max865ref.readFault() & 0x3FU;
2422
+    #endif
2313 2423
 
2314
-    if (DISABLED(IGNORE_THERMOCOUPLE_ERRORS) && (max_tc_temp & MAX_TC_ERROR_MASK) && fault_31865) {
2424
+    if (DISABLED(IGNORE_THERMOCOUPLE_ERRORS)
2425
+      && TERN(LIB_ADAFRUIT_MAX31865, fault_31865, (max_tc_temp & MAX_TC_ERROR_MASK))
2426
+    ) {
2315 2427
       max_tc_errors[hindex]++;
2316 2428
       if (max_tc_errors[hindex] > THERMOCOUPLE_MAX_ERRORS) {
2317 2429
         SERIAL_ERROR_START();
2318 2430
         SERIAL_ECHOPGM("Temp measurement error! ");
2319 2431
         #if MAX_TC_ERROR_MASK == 7
2320
-          SERIAL_ECHOPGM("MAX31855 ");
2321
-          if (max_tc_temp & 1)
2432
+          SERIAL_ECHOPGM("MAX31855 Fault : (", max_tc_temp & 0x7, ") >> ");
2433
+          if (max_tc_temp & 0x1)
2322 2434
             SERIAL_ECHOLNPGM("Open Circuit");
2323
-          else if (max_tc_temp & 2)
2435
+          else if (max_tc_temp & 0x2)
2324 2436
             SERIAL_ECHOLNPGM("Short to GND");
2325
-          else if (max_tc_temp & 4)
2437
+          else if (max_tc_temp & 0x4)
2326 2438
             SERIAL_ECHOLNPGM("Short to VCC");
2327
-        #elif HAS_MAX31865_TEMP
2439
+        #elif HAS_MAX31865
2440
+          #if ENABLED(LIB_USR_MAX31865)
2441
+            // At the present time we do not have the ability to set the MAX31865 HIGH threshold
2442
+            // or thr LOW threshold, so no need to check for them, zero these bits out
2443
+            const uint8_t fault_31865 = max865ref.readFault() & 0x3FU;
2444
+          #endif
2445
+          max865ref.clearFault();
2328 2446
           if (fault_31865) {
2329
-            maxref.clearFault();
2330
-            SERIAL_ECHOPAIR("MAX31865 Fault :(", fault_31865, ")  >>");
2447
+            SERIAL_EOL();
2448
+            SERIAL_ECHOLNPAIR("\nMAX31865 Fault :(", fault_31865, ")  >>");
2331 2449
             if (fault_31865 & MAX31865_FAULT_HIGHTHRESH)
2332 2450
               SERIAL_ECHOLNPGM("RTD High Threshold");
2333
-            else if (fault_31865 & MAX31865_FAULT_LOWTHRESH)
2451
+            if (fault_31865 & MAX31865_FAULT_LOWTHRESH)
2334 2452
               SERIAL_ECHOLNPGM("RTD Low Threshold");
2335
-            else if (fault_31865 & MAX31865_FAULT_REFINLOW)
2453
+            if (fault_31865 & MAX31865_FAULT_REFINLOW)
2336 2454
               SERIAL_ECHOLNPGM("REFIN- > 0.85 x Bias");
2337
-            else if (fault_31865 & MAX31865_FAULT_REFINHIGH)
2455
+            if (fault_31865 & MAX31865_FAULT_REFINHIGH)
2338 2456
               SERIAL_ECHOLNPGM("REFIN- < 0.85 x Bias - FORCE- open");
2339
-            else if (fault_31865 & MAX31865_FAULT_RTDINLOW)
2457
+            if (fault_31865 & MAX31865_FAULT_RTDINLOW)
2340 2458
               SERIAL_ECHOLNPGM("REFIN- < 0.85 x Bias - FORCE- open");
2341
-            else if (fault_31865 & MAX31865_FAULT_OVUV)
2459
+            if (fault_31865 & MAX31865_FAULT_OVUV)
2342 2460
               SERIAL_ECHOLNPGM("Under/Over voltage");
2343 2461
           }
2344 2462
         #else
2345
-          SERIAL_ECHOLNPGM("MAX6675");
2463
+          SERIAL_ECHOLNPGM("MAX6675 Open Circuit");
2346 2464
         #endif
2347 2465
 
2348 2466
         // Thermocouple open
@@ -2361,7 +2479,13 @@ void Temperature::disable_all_heaters() {
2361 2479
     #endif
2362 2480
 
2363 2481
     // Return the RTD resistance for MAX31865 for display in SHOW_TEMP_ADC_VALUES
2364
-    TERN_(HAS_MAX31865_TEMP, max_tc_temp = max31865_ohms);
2482
+    #if HAS_MAX31865_TEMP
2483
+      #if ENABLED(LIB_ADAFRUIT_MAX31865)
2484
+        max_tc_temp = (uint32_t(max865ref.readRTD()) * THERMO_SEL(MAX31865_CALIBRATION_OHMS_0, MAX31865_CALIBRATION_OHMS_1)) >> 16;
2485
+      #elif ENABLED(LIB_USR_MAX31865)
2486
+        max_tc_temp = (uint32_t(max_tc_temp) * THERMO_SEL(MAX31865_CALIBRATION_OHMS_0, MAX31865_CALIBRATION_OHMS_1)) >> 16;
2487
+      #endif
2488
+    #endif
2365 2489
 
2366 2490
     THERMO_TEMP(hindex) = max_tc_temp;
2367 2491
 
@@ -3047,7 +3171,8 @@ void Temperature::tick() {
3047 3171
     SERIAL_ECHOPGM(" /");
3048 3172
     SERIAL_PRINT(t, SFP);
3049 3173
     #if ENABLED(SHOW_TEMP_ADC_VALUES)
3050
-      SERIAL_ECHOPAIR(" (", r * RECIPROCAL(OVERSAMPLENR));
3174
+      // Temperature MAX SPI boards do not have an OVERSAMPLENR defined
3175
+      SERIAL_ECHOPAIR(" (", TERN(NO_THERMO_TEMPS, false, k == 'T') ? r : r * RECIPROCAL(OVERSAMPLENR));
3051 3176
       SERIAL_CHAR(')');
3052 3177
     #endif
3053 3178
     delay(2);

+ 1
- 0
Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h Целия файл

@@ -22,6 +22,7 @@
22 22
 #pragma once
23 23
 
24 24
 #define BOARD_INFO_NAME "BTT SKR V1.3"
25
+#define LPC1768_IS_SKRV1_3 1
25 26
 
26 27
 //
27 28
 // Trinamic Stallguard pins

Loading…
Отказ
Запис