From eebab93358427b3b95b4d38dedbbb8aaaba977b8 Mon Sep 17 00:00:00 2001 From: Katelyn Schiesser Date: Sun, 18 Jul 2021 18:24:27 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Ensure=20Software=20SPI=20pins?= =?UTF-8?q?=20for=20Max=20Thermocouple=20(#22389)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/temperature.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 3959c402ae2b..4a94a5260c98 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -107,6 +107,24 @@ #if (TEMP_SENSOR_0_USES_SW_SPI || TEMP_SENSOR_1_USES_SW_SPI) && !HAS_MAXTC_LIBRARIES #include "../libs/private_spi.h" #define HAS_MAXTC_SW_SPI 1 + + // Define pins for SPI-based sensors + #if TEMP_SENSOR_0_USES_SW_SPI + #define SW_SPI_SCK_PIN TEMP_0_SCK_PIN + #define SW_SPI_MISO_PIN TEMP_0_MISO_PIN + #if PIN_EXISTS(TEMP_0_MOSI) + #define SW_SPI_MOSI_PIN TEMP_0_MOSI_PIN + #endif + #else + #define SW_SPI_SCK_PIN TEMP_1_SCK_PIN + #define SW_SPI_MISO_PIN TEMP_1_MISO_PIN + #if PIN_EXISTS(TEMP_1_MOSI) + #define SW_SPI_MOSI_PIN TEMP_1_MOSI_PIN + #endif + #endif + #ifndef SW_SPI_MOSI_PIN + #define SW_SPI_MOSI_PIN SD_MOSI_PIN + #endif #endif #if ENABLED(PID_EXTRUSION_SCALING) @@ -198,7 +216,8 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY, // Initialize SoftSPI for non-lib Software SPI; Libraries take care of it themselves. template SoftSPI SPIclass::softSPI; - SPIclass max_tc_spi; + SPIclass max_tc_spi; + #endif #define MAXTC_INIT(n, M) \