diff --git a/Marlin/src/HAL/LPC1768/inc/SanityCheck.h b/Marlin/src/HAL/LPC1768/inc/SanityCheck.h index be64ea832eae..10d673771472 100644 --- a/Marlin/src/HAL/LPC1768/inc/SanityCheck.h +++ b/Marlin/src/HAL/LPC1768/inc/SanityCheck.h @@ -31,7 +31,7 @@ /** * Detect an old pins file by checking for old ADC pins values. */ -#define _OLD_TEMP_PIN(P) PIN_EXISTS(P) && _CAT(P,_PIN) <= 7 && _CAT(P,_PIN) != 2 && _CAT(P,_PIN) != 3 +#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 #if _OLD_TEMP_PIN(TEMP_BED) #error "TEMP_BED_PIN must be defined using the Pn_nn or Pn_nn_An format. (See the included pins files)." #elif _OLD_TEMP_PIN(TEMP_0) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 6b2259dd08e5..b085e6145a51 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -937,11 +937,11 @@ void setup() { SETUP_RUN(HAL_init()); - // Init and disable SPI thermocouples - #if TEMP_SENSOR_0_IS_MAX6675 + // Init and disable SPI thermocouples; this is still needed + #if TEMP_SENSOR_0_IS_MAX_TC OUT_WRITE(MAX6675_SS_PIN, HIGH); // Disable #endif - #if TEMP_SENSOR_1_IS_MAX6675 + #if TEMP_SENSOR_1_IS_MAX_TC OUT_WRITE(MAX6675_SS2_PIN, HIGH); // Disable #endif diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 04c4eb120df0..949885eab7ec 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -490,6 +490,90 @@ #define HAS_MAX6675 1 #endif +// +// Compatibility layer for MAX (SPI) temp boards +// +#if PIN_EXISTS(MAX6675_SS) + #if TEMP_SENSOR_0_IS_MAX31855 + #define MAX31855_CS_PIN MAX6675_SS_PIN + #elif TEMP_SENSOR_0_IS_MAX31865 + #define MAX31865_CS_PIN MAX6675_SS_PIN + #elif TEMP_SENSOR_0_IS_MAX6675 + #define MAX6675_CS_PIN MAX6675_SS_PIN + #endif +#endif + +#if PIN_EXISTS(MAX6675_SS2) + #if TEMP_SENSOR_1_IS_MAX31855 + #define MAX31855_CS2_PIN MAX6675_SS2_PIN + #elif TEMP_SENSOR_1_IS_MAX31865 + #define MAX31865_CS2_PIN MAX6675_SS2_PIN + #elif TEMP_SENSOR_1_IS_MAX6675 + #define MAX6675_CS2_PIN MAX6675_SS2_PIN + #endif +#endif + +#if PIN_EXISTS(MAX6675_DO) + #if HAS_MAX31855 + #define MAX31855_MISO_PIN MAX6675_DO_PIN + #elif HAS_MAX31865 + #define MAX31865_MISO_PIN MAX6675_DO_PIN + #elif HAS_MAX6675 + #define MAX6675_MISO_PIN MAX6675_DO_PIN + #endif +#endif + +#if PIN_EXISTS(MAX6675_SCK) + #if HAS_MAX31855 + #define MAX31855_SCK_PIN MAX6675_SCK_PIN + #elif HAS_MAX31865 + #define MAX31865_SCK_PIN MAX6675_SCK_PIN + #endif +#endif + +// Compatibility Layer for use when HAL manipulates PINS for MAX31855 and MAX6675 +#if PIN_EXISTS(MAX31855_CS) && !PIN_EXISTS(MAX6675_SS) + #define MAX6675_SS_PIN MAX31855_CS_PIN +#endif +#if PIN_EXISTS(MAX31855_CS2) && !PIN_EXISTS(MAX6675_SS2) + #define MAX6675_SS2_PIN MAX31855_CS2_PIN +#endif +#if PIN_EXISTS(MAX6675_CS) && !PIN_EXISTS(MAX6675_SS) + #define MAX6675_SS_PIN MAX6675_CS_PIN +#endif +#if PIN_EXISTS(MAX6675_CS2) && !PIN_EXISTS(MAX6675_SS2) + #define MAX6675_SS2_PIN MAX6675_CS2_PIN +#endif +#if PIN_EXISTS(MAX31855_MISO) && !PIN_EXISTS(MAX6675_DO) + #define MAX6675_DO_PIN MAX31855_MISO_PIN +#endif +#if PIN_EXISTS(MAX6675_MISO) && !PIN_EXISTS(MAX6675_DO) + #define MAX6675_DO_PIN MAX6675_MISO_PIN +#endif +#if PIN_EXISTS(MAX31855_SCK) && !PIN_EXISTS(MAX6675_SCK) + #define MAX6675_SCK_PIN MAX31855_SCK_PIN +#endif + +// +// User-defined thermocouple libraries +// +// Add LIB_MAX6675 / LIB_MAX31855 / LIB_MAX31865 to the build_flags +// to select a USER library for MAX6675, MAX31855, MAX31865 +// +#if BOTH(HAS_MAX6675, LIB_MAX6675) + #define LIB_USR_MAX6675 1 +#endif +#if BOTH(HAS_MAX31855, LIB_MAX31855) + #define LIB_USR_MAX31855 1 +#endif +#if HAS_MAX31865 + #if ENABLED(LIB_MAX31865) + #define LIB_USR_MAX31865 1 + #else + #define LIB_ADAFRUIT_MAX31865 1 + #endif +#endif + #if TEMP_SENSOR_2 == -4 #define TEMP_SENSOR_2_IS_AD8495 1 #elif TEMP_SENSOR_2 == -3 diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h index e5b78024cbf8..db9f85c7428f 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h @@ -22,6 +22,7 @@ #pragma once #define BOARD_INFO_NAME "BTT SKR V1.3" +#define LPC1768_IS_SKRV1_3 1 // // Trinamic Stallguard pins