Kaynağa Gözat

🐛 Ensure Software SPI pins for Max Thermocouple (#22389)

Katelyn Schiesser 3 yıl önce
ebeveyn
işleme
273ff6fedc
No account linked to committer's email address
1 değiştirilmiş dosya ile 20 ekleme ve 1 silme
  1. 20
    1
      Marlin/src/module/temperature.cpp

+ 20
- 1
Marlin/src/module/temperature.cpp Dosyayı Görüntüle

@@ -107,6 +107,24 @@
107 107
 #if (TEMP_SENSOR_0_USES_SW_SPI || TEMP_SENSOR_1_USES_SW_SPI) && !HAS_MAXTC_LIBRARIES
108 108
   #include "../libs/private_spi.h"
109 109
   #define HAS_MAXTC_SW_SPI 1
110
+
111
+  // Define pins for SPI-based sensors
112
+  #if TEMP_SENSOR_0_USES_SW_SPI
113
+    #define SW_SPI_SCK_PIN    TEMP_0_SCK_PIN
114
+    #define SW_SPI_MISO_PIN   TEMP_0_MISO_PIN
115
+    #if PIN_EXISTS(TEMP_0_MOSI)
116
+      #define SW_SPI_MOSI_PIN TEMP_0_MOSI_PIN
117
+    #endif
118
+  #else
119
+    #define SW_SPI_SCK_PIN    TEMP_1_SCK_PIN
120
+    #define SW_SPI_MISO_PIN   TEMP_1_MISO_PIN
121
+    #if PIN_EXISTS(TEMP_1_MOSI)
122
+      #define SW_SPI_MOSI_PIN TEMP_1_MOSI_PIN
123
+    #endif
124
+  #endif
125
+  #ifndef SW_SPI_MOSI_PIN
126
+    #define SW_SPI_MOSI_PIN   SD_MOSI_PIN
127
+  #endif
110 128
 #endif
111 129
 
112 130
 #if ENABLED(PID_EXTRUSION_SCALING)
@@ -198,7 +216,8 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
198 216
     // Initialize SoftSPI for non-lib Software SPI; Libraries take care of it themselves.
199 217
     template<uint8_t MisoPin, uint8_t MosiPin, uint8_t SckPin>
200 218
       SoftSPI<MisoPin, MosiPin, SckPin> SPIclass<MisoPin, MosiPin, SckPin>::softSPI;
201
-    SPIclass<TEMP_0_MISO_PIN, TEMP_0_MOSI_PIN, TEMP_0_SCK_PIN> max_tc_spi;
219
+    SPIclass<SW_SPI_MISO_PIN, SW_SPI_MOSI_PIN, SW_SPI_SCK_PIN> max_tc_spi;
220
+
202 221
   #endif
203 222
 
204 223
   #define MAXTC_INIT(n, M) \

Loading…
İptal
Kaydet