Browse Source

Fix MAX6675 SPI init, conflicts (#20086)

LinFor 4 years ago
parent
commit
f4e9f3654e
No account linked to committer's email address
2 changed files with 9 additions and 18 deletions
  1. 8
    0
      Marlin/src/MarlinCore.cpp
  2. 1
    18
      Marlin/src/module/temperature.cpp

+ 8
- 0
Marlin/src/MarlinCore.cpp View File

@@ -991,6 +991,14 @@ void setup() {
991 991
 
992 992
   SETUP_RUN(HAL_init());
993 993
 
994
+  // Init and disable SPI thermocouples
995
+  #if HEATER_0_USES_MAX6675
996
+    OUT_WRITE(MAX6675_SS_PIN, HIGH);  // Disable
997
+  #endif
998
+  #if HEATER_1_USES_MAX6675
999
+    OUT_WRITE(MAX6675_SS2_PIN, HIGH); // Disable
1000
+  #endif
1001
+
994 1002
   #if HAS_L64XX
995 1003
     SETUP_RUN(L64xxManager.init());  // Set up SPI, init drivers
996 1004
   #endif

+ 1
- 18
Marlin/src/module/temperature.cpp View File

@@ -1799,22 +1799,7 @@ void Temperature::init() {
1799 1799
     INIT_FAN_PIN(CONTROLLER_FAN_PIN);
1800 1800
   #endif
1801 1801
 
1802
-  #if MAX6675_SEPARATE_SPI
1803
-
1804
-    OUT_WRITE(SCK_PIN, LOW);
1805
-    OUT_WRITE(MOSI_PIN, HIGH);
1806
-    SET_INPUT_PULLUP(MISO_PIN);
1807
-
1808
-    max6675_spi.init();
1809
-
1810
-    OUT_WRITE(SS_PIN, HIGH);
1811
-    OUT_WRITE(MAX6675_SS_PIN, HIGH);
1812
-
1813
-  #endif
1814
-
1815
-  #if HEATER_1_USES_MAX6675
1816
-    OUT_WRITE(MAX6675_SS2_PIN, HIGH);
1817
-  #endif
1802
+  TERN_(MAX6675_SEPARATE_SPI, max6675_spi.init());
1818 1803
 
1819 1804
   HAL_adc_init();
1820 1805
 
@@ -2277,9 +2262,7 @@ void Temperature::disable_all_heaters() {
2277 2262
       spiInit(MAX6675_SPEED_BITS);
2278 2263
     #endif
2279 2264
 
2280
-    MAX6675_SET_OUTPUT();
2281 2265
     MAX6675_WRITE(LOW);  // enable TT_MAX6675
2282
-
2283 2266
     DELAY_NS(100);       // Ensure 100ns delay
2284 2267
 
2285 2268
     // Read a big-endian temperature value

Loading…
Cancel
Save