From ca21ac6b9bac188560c4d316ecf1b257d3f0cec8 Mon Sep 17 00:00:00 2001 From: Mateusz Krawczuk Date: Sat, 17 Nov 2018 01:20:33 +0100 Subject: [PATCH] Support two MAX6675 thermocouples (#8686) --- Marlin/src/inc/Conditionals_post.h | 22 ++-- Marlin/src/inc/SanityCheck.h | 16 ++- Marlin/src/module/temperature.cpp | 127 ++++++++++++++++------- Marlin/src/module/temperature.h | 19 +++- Marlin/src/pins/pinsDebug_list.h | 15 +-- Marlin/src/pins/pins_DUE3DOM.h | 4 +- Marlin/src/pins/pins_DUE3DOM_MINI.h | 4 +- Marlin/src/pins/pins_FORMBOT_RAPTOR.h | 4 +- Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h | 4 +- Marlin/src/pins/pins_FORMBOT_TREX3.h | 4 +- Marlin/src/pins/pins_MIGHTYBOARD_REVE.h | 8 +- Marlin/src/pins/pins_RADDS.h | 4 +- Marlin/src/pins/pins_RAMPS.h | 4 +- Marlin/src/pins/pins_RAMPS_DUO.h | 6 +- Marlin/src/pins/pins_RAMPS_FD_V1.h | 4 +- Marlin/src/pins/pins_RAMPS_OLD.h | 4 +- Marlin/src/pins/pins_RAMPS_SMART.h | 7 +- Marlin/src/pins/pins_RIGIDBOARD.h | 6 +- Marlin/src/pins/pins_RURAMPS4D_11.h | 12 ++- Marlin/src/pins/pins_RURAMPS4D_13.h | 12 ++- Marlin/src/pins/pins_ULTRATRONICS_PRO.h | 2 +- 21 files changed, 190 insertions(+), 98 deletions(-) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index a8663fdf6e..40ecd5412f 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -275,12 +275,12 @@ #elif TEMP_SENSOR_0 == -3 #define HEATER_0_USES_MAX6675 #define MAX6675_IS_MAX31855 - #define MAX6675_TMIN -270 - #define MAX6675_TMAX 1800 + #define HEATER_0_MAX6675_TMIN -270 + #define HEATER_0_MAX6675_TMAX 1800 #elif TEMP_SENSOR_0 == -2 #define HEATER_0_USES_MAX6675 - #define MAX6675_TMIN 0 - #define MAX6675_TMAX 1024 + #define HEATER_0_MAX6675_TMIN 0 + #define HEATER_0_MAX6675_TMAX 1024 #elif TEMP_SENSOR_0 == -1 #define HEATER_0_USES_AD595 #elif TEMP_SENSOR_0 == 0 @@ -294,9 +294,19 @@ #if TEMP_SENSOR_1 == -4 #define HEATER_1_USES_AD8495 #elif TEMP_SENSOR_1 == -3 - #error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_1." + #if TEMP_SENSOR_0 == -2 + #error "If MAX31855 Thermocouple (-3) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match." + #endif + #define HEATER_1_USES_MAX6675 + #define HEATER_1_MAX6675_TMIN -270 + #define HEATER_1_MAX6675_TMAX 1800 #elif TEMP_SENSOR_1 == -2 - #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_1." + #if TEMP_SENSOR_0 == -3 + #error "If MAX31855 Thermocouple (-3) is used for TEMP_SENSOR_0 then TEMP_SENSOR_1 must match." + #endif + #define HEATER_1_USES_MAX6675 + #define HEATER_1_MAX6675_TMIN 0 + #define HEATER_1_MAX6675_TMAX 1024 #elif TEMP_SENSOR_1 == -1 #define HEATER_1_USES_AD595 #elif TEMP_SENSOR_1 == 0 diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 4c89035f75..6396398680 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -335,6 +335,10 @@ #error "MBL_Z_STEP is now MESH_EDIT_Z_STEP. Please update your configuration." #elif defined(CHDK) #error "CHDK is now CHDK_PIN. Please update your Configuration_adv.h." +#elif defined(MAX6675_SS) + #error "MAX6675_SS is now MAX6675_SS_PIN. Please update your configuration and/or pins." +#elif defined(MAX6675_SS2) + #error "MAX6675_SS2 is now MAX6675_SS2_PIN. Please update your configuration and/or pins." #endif #define BOARD_MKS_13 -47 @@ -1280,7 +1284,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, */ #if !HAS_HEATER_0 #error "HEATER_0_PIN not defined for this board." -#elif !PIN_EXISTS(TEMP_0) && !(defined(MAX6675_SS) && MAX6675_SS >= 0) +#elif !PIN_EXISTS(TEMP_0) && !PIN_EXISTS(MAX6675_SS) #error "TEMP_0_PIN not defined for this board." #elif ((defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && (!PIN_EXISTS(E0_STEP) || !PIN_EXISTS(E0_DIR))) #error "E0_STEP_PIN or E0_DIR_PIN not defined for this board." @@ -1291,16 +1295,18 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #endif // Pins are required for heaters -#if ENABLED(HEATER_0_USES_MAX6675) && !(defined(MAX6675_SS) && MAX6675_SS >= 0) - #error "MAX6675_SS (required for TEMP_SENSOR_0) not defined for this board." +#if ENABLED(HEATER_0_USES_MAX6675) && !PIN_EXISTS(MAX6675_SS) + #error "MAX6675_SS_PIN (required for TEMP_SENSOR_0) not defined for this board." #elif (HOTENDS > 1 || ENABLED(HEATERS_PARALLEL)) && !HAS_HEATER_1 #error "HEATER_1_PIN not defined for this board." #endif #if HOTENDS > 1 - #if TEMP_SENSOR_1 == 0 + #if ENABLED(HEATER_1_USES_MAX6675) && !PIN_EXISTS(MAX6675_SS2) + #error "MAX6675_SS2_PIN (required for TEMP_SENSOR_1) not defined for this board." + #elif TEMP_SENSOR_1 == 0 #error "TEMP_SENSOR_1 is required with 2 or more HOTENDS." - #elif !PIN_EXISTS(TEMP_1) + #elif !PIN_EXISTS(TEMP_1) && !PIN_EXISTS(MAX6675_SS2) #error "TEMP_1_PIN not defined for this board." #endif #if HOTENDS > 2 diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 72abb12f46..ce483d9144 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -775,8 +775,13 @@ void Temperature::manage_heater() { updateTemperaturesFromRawValues(); // also resets the watchdog #if ENABLED(HEATER_0_USES_MAX6675) - if (current_temperature[0] > MIN(HEATER_0_MAXTEMP, MAX6675_TMAX - 1.0)) max_temp_error(0); - if (current_temperature[0] < MAX(HEATER_0_MINTEMP, MAX6675_TMIN + .01)) min_temp_error(0); + if (current_temperature[0] > MIN(HEATER_0_MAXTEMP, HEATER_0_MAX6675_TMAX - 1.0)) max_temp_error(0); + if (current_temperature[0] < MAX(HEATER_0_MINTEMP, HEATER_0_MAX6675_TMIN + .01)) min_temp_error(0); + #endif + + #if ENABLED(HEATER_1_USES_MAX6675) + if (current_temperature[1] > MIN(HEATER_1_MAXTEMP, HEATER_1_MAX6675_TMAX - 1.0)) max_temp_error(1); + if (current_temperature[1] < MAX(HEATER_1_MINTEMP, HEATER_1_MAX6675_TMIN + .01)) min_temp_error(1); #endif #if WATCH_HOTENDS || WATCH_THE_BED || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN || HEATER_IDLE_HANDLER @@ -953,7 +958,9 @@ float Temperature::analog_to_celsius_hotend(const int raw, const uint8_t e) { break; #endif case 1: - #if ENABLED(HEATER_1_USES_AD595) + #if ENABLED(HEATER_1_USES_MAX6675) + return raw * 0.25; + #elif ENABLED(HEATER_1_USES_AD595) return TEMP_AD595(raw); #elif ENABLED(HEATER_1_USES_AD8495) return TEMP_AD8495(raw); @@ -1036,7 +1043,10 @@ float Temperature::analog_to_celsius_hotend(const int raw, const uint8_t e) { */ void Temperature::updateTemperaturesFromRawValues() { #if ENABLED(HEATER_0_USES_MAX6675) - current_temperature_raw[0] = read_max6675(); + current_temperature_raw[0] = READ_MAX6675(0); + #endif + #if ENABLED(HEATER_1_USES_MAX6675) + current_temperature_raw[1] = READ_MAX6675(1); #endif HOTEND_LOOP() current_temperature[e] = analog_to_celsius_hotend(current_temperature_raw[e], e); #if HAS_HEATED_BED @@ -1170,10 +1180,14 @@ void Temperature::init() { max6675_spi.init(); OUT_WRITE(SS_PIN, HIGH); - OUT_WRITE(MAX6675_SS, HIGH); + OUT_WRITE(MAX6675_SS_PIN, HIGH); #endif // HEATER_0_USES_MAX6675 + #if ENABLED(HEATER_1_USES_MAX6675) + OUT_WRITE(MAX6675_SS2_PIN, HIGH); + #endif + HAL_adc_init(); #if HAS_TEMP_ADC_0 @@ -1595,47 +1609,71 @@ void Temperature::disable_all_heaters() { #endif // PROBING_HEATERS_OFF -#if ENABLED(HEATER_0_USES_MAX6675) +#if HAS_MAX6675 - #define MAX6675_HEAT_INTERVAL 250u + int Temperature::read_max6675( + #if COUNT_6675 > 1 + const uint8_t hindex + #endif + ) { + #if COUNT_6675 == 1 + constexpr uint8_t hindex = 0; + #endif - #if ENABLED(MAX6675_IS_MAX31855) - uint32_t max6675_temp = 2000; - #define MAX6675_ERROR_MASK 7 - #define MAX6675_DISCARD_BITS 18 - #define MAX6675_SPEED_BITS 3 // (_BV(SPR1)) // clock ÷ 64 - #else - uint16_t max6675_temp = 2000; - #define MAX6675_ERROR_MASK 4 - #define MAX6675_DISCARD_BITS 3 - #define MAX6675_SPEED_BITS 2 // (_BV(SPR0)) // clock ÷ 16 - #endif + #define MAX6675_HEAT_INTERVAL 250UL - int Temperature::read_max6675() { - - static millis_t next_max6675_ms = 0; + #if ENABLED(MAX6675_IS_MAX31855) + static uint32_t max6675_temp = 2000; + #define MAX6675_ERROR_MASK 7 + #define MAX6675_DISCARD_BITS 18 + #define MAX6675_SPEED_BITS 3 // (_BV(SPR1)) // clock ÷ 64 + #else + static uint16_t max6675_temp = 2000; + #define MAX6675_ERROR_MASK 4 + #define MAX6675_DISCARD_BITS 3 + #define MAX6675_SPEED_BITS 2 // (_BV(SPR0)) // clock ÷ 16 + #endif + // Return last-read value between readings + static millis_t next_max6675_ms[COUNT_6675] = { 0 }; millis_t ms = millis(); + if (PENDING(ms, next_max6675_ms[hindex])) return int(max6675_temp); + next_max6675_ms[hindex] = ms + MAX6675_HEAT_INTERVAL; - if (PENDING(ms, next_max6675_ms)) return (int)max6675_temp; + // + // TODO: spiBegin, spiRec and spiInit doesn't work when soft spi is used. + // + #if MB(MIGHTYBOARD_REVE) + spiBegin(); + spiInit(MAX6675_SPEED_BITS); + #endif - next_max6675_ms = ms + MAX6675_HEAT_INTERVAL; + #if COUNT_6675 > 1 + #define WRITE_MAX6675(V) do{ switch (hindex) { case 1: WRITE(MAX6675_SS2_PIN, V); break; default: WRITE(MAX6675_SS_PIN, V); } }while(0) + #elif ENABLED(HEATER_1_USES_MAX6675) + #define WRITE_MAX6675(V) WRITE(MAX6675_SS2_PIN, V) + #else + #define WRITE_MAX6675(V) WRITE(MAX6675_SS_PIN, V) + #endif - spiBegin(); - spiInit(MAX6675_SPEED_BITS); - - WRITE(MAX6675_SS, 0); // enable TT_MAX6675 + WRITE_MAX6675(LOW); // enable TT_MAX6675 DELAY_NS(100); // Ensure 100ns delay // Read a big-endian temperature value max6675_temp = 0; for (uint8_t i = sizeof(max6675_temp); i--;) { - max6675_temp |= spiRec(); + max6675_temp |= ( + #if MB(MIGHTYBOARD_REVE) + max6675_spi.receive() + #else + spiRec() + #endif + ); if (i > 0) max6675_temp <<= 8; // shift left if not the last byte } - WRITE(MAX6675_SS, 1); // disable TT_MAX6675 + WRITE_MAX6675(HIGH); // disable TT_MAX6675 if (max6675_temp & MAX6675_ERROR_MASK) { SERIAL_ERROR_START(); @@ -1651,7 +1689,17 @@ void Temperature::disable_all_heaters() { #else SERIAL_ERRORLNPGM("MAX6675"); #endif - max6675_temp = MAX6675_TMAX * 4; // thermocouple open + + // Thermocouple open + max6675_temp = 4 * ( + #if COUNT_6675 > 1 + hindex ? HEATER_1_MAX6675_TMAX : HEATER_0_MAX6675_TMAX + #elif ENABLED(HEATER_1_USES_MAX6675) + HEATER_1_MAX6675_TMAX + #else + HEATER_0_MAX6675_TMAX + #endif + ); } else max6675_temp >>= MAX6675_DISCARD_BITS; @@ -1660,24 +1708,28 @@ void Temperature::disable_all_heaters() { if (max6675_temp & 0x00002000) max6675_temp |= 0xFFFFC000; #endif - return (int)max6675_temp; + return int(max6675_temp); } -#endif // HEATER_0_USES_MAX6675 +#endif // HAS_MAX6675 /** * Get raw temperatures */ void Temperature::set_current_temp_raw() { + #if HAS_TEMP_ADC_0 && DISABLED(HEATER_0_USES_MAX6675) current_temperature_raw[0] = raw_temp_value[0]; #endif + #if HAS_TEMP_ADC_1 + #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) redundant_temperature_raw = raw_temp_value[1]; - #else + #elif DISABLED(HEATER_1_USES_MAX6675) current_temperature_raw[1] = raw_temp_value[1]; #endif + #if HAS_TEMP_ADC_2 current_temperature_raw[2] = raw_temp_value[2]; #if HAS_TEMP_ADC_3 @@ -1690,6 +1742,7 @@ void Temperature::set_current_temp_raw() { #endif // HAS_TEMP_ADC_4 #endif // HAS_TEMP_ADC_3 #endif // HAS_TEMP_ADC_2 + #endif // HAS_TEMP_ADC_1 #if HAS_HEATED_BED @@ -1771,17 +1824,17 @@ void Temperature::readings_ready() { #if HAS_HEATED_BED #if HEATER_BED_RAW_LO_TEMP > HEATER_BED_RAW_HI_TEMP - #define GEBED <= + #define BEDCMP(A,B) ((A)<=(B)) #else - #define GEBED >= + #define BEDCMP(A,B) ((A)>=(B)) #endif const bool bed_on = (target_temperature_bed > 0) #if ENABLED(PIDTEMPBED) || (soft_pwm_amount_bed > 0) #endif ; - if (current_temperature_bed_raw GEBED bed_maxttemp_raw) max_temp_error(-1); - if (bed_minttemp_raw GEBED current_temperature_bed_raw && bed_on) min_temp_error(-1); + if (BEDCMP(current_temperature_bed_raw, bed_maxttemp_raw)) max_temp_error(-1); + if (BEDCMP(bed_minttemp_raw, current_temperature_bed_raw) && bed_on) min_temp_error(-1); #endif } diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 963b219c53..0dc802768a 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -632,8 +632,23 @@ class Temperature { static void updateTemperaturesFromRawValues(); - #if ENABLED(HEATER_0_USES_MAX6675) - static int read_max6675(); + #define HAS_MAX6675 (ENABLED(HEATER_0_USES_MAX6675) || ENABLED(HEATER_1_USES_MAX6675)) + #if HAS_MAX6675 + #if ENABLED(HEATER_0_USES_MAX6675) && ENABLED(HEATER_1_USES_MAX6675) + #define COUNT_6675 2 + #else + #define COUNT_6675 1 + #endif + #if COUNT_6675 > 1 + #define READ_MAX6675(N) read_max6675(N) + #else + #define READ_MAX6675(N) read_max6675() + #endif + static int read_max6675( + #if COUNT_6675 > 1 + const uint8_t hindex=0 + #endif + ); #endif static void checkExtruderAutoFans(); diff --git a/Marlin/src/pins/pinsDebug_list.h b/Marlin/src/pins/pinsDebug_list.h index df4e163298..e7e38256e0 100644 --- a/Marlin/src/pins/pinsDebug_list.h +++ b/Marlin/src/pins/pinsDebug_list.h @@ -572,8 +572,11 @@ #if PIN_EXISTS(MAX6675_SCK) REPORT_NAME_DIGITAL(__LINE__, MAX6675_SCK_PIN) #endif -#if defined(MAX6675_SS) && MAX6675_SS >= 0 - REPORT_NAME_DIGITAL(__LINE__, MAX6675_SS) +#if PIN_EXISTS(MAX6675_SS) + REPORT_NAME_DIGITAL(__LINE__, MAX6675_SS_PIN) +#endif +#if PIN_EXISTS(MAX6675_SS2) + REPORT_NAME_DIGITAL(__LINE__, MAX6675_SS2_PIN) #endif // #if defined(MISO) && MISO >= 0 // REPORT_NAME_DIGITAL(__LINE__, MISO) @@ -803,11 +806,11 @@ #if PIN_EXISTS(SUICIDE) REPORT_NAME_DIGITAL(__LINE__, SUICIDE_PIN) #endif -#if defined(THERMO_CS1) && THERMO_CS1 >= 0 - REPORT_NAME_DIGITAL(__LINE__, THERMO_CS1) +#if PIN_EXISTS(THERMO_CS1) + REPORT_NAME_DIGITAL(__LINE__, THERMO_CS1_PIN) #endif -#if defined(THERMO_CS2) && THERMO_CS2 >= 0 - REPORT_NAME_DIGITAL(__LINE__, THERMO_CS2) +#if PIN_EXISTS(THERMO_CS2) + REPORT_NAME_DIGITAL(__LINE__, THERMO_CS2_PIN) #endif #if PIN_EXISTS(THERMO_DO) REPORT_NAME_DIGITAL(__LINE__, THERMO_DO_PIN) diff --git a/Marlin/src/pins/pins_DUE3DOM.h b/Marlin/src/pins/pins_DUE3DOM.h index e4725d7d1c..aa84053452 100644 --- a/Marlin/src/pins/pins_DUE3DOM.h +++ b/Marlin/src/pins/pins_DUE3DOM.h @@ -85,9 +85,9 @@ // SPI for Max6675 or Max31855 Thermocouple #if DISABLED(SDSUPPORT) - #define MAX6675_SS -1 + #define MAX6675_SS_PIN -1 #else - #define MAX6675_SS -1 + #define MAX6675_SS_PIN -1 #endif // diff --git a/Marlin/src/pins/pins_DUE3DOM_MINI.h b/Marlin/src/pins/pins_DUE3DOM_MINI.h index 6ec4053cf9..3cd252a195 100644 --- a/Marlin/src/pins/pins_DUE3DOM_MINI.h +++ b/Marlin/src/pins/pins_DUE3DOM_MINI.h @@ -77,9 +77,9 @@ // SPI for Max6675 or Max31855 Thermocouple #if DISABLED(SDSUPPORT) - #define MAX6675_SS 53 + #define MAX6675_SS_PIN 53 #else - #define MAX6675_SS 53 + #define MAX6675_SS_PIN 53 #endif // diff --git a/Marlin/src/pins/pins_FORMBOT_RAPTOR.h b/Marlin/src/pins/pins_FORMBOT_RAPTOR.h index 772be68ab0..c79dd03352 100644 --- a/Marlin/src/pins/pins_FORMBOT_RAPTOR.h +++ b/Marlin/src/pins/pins_FORMBOT_RAPTOR.h @@ -113,9 +113,9 @@ // SPI for Max6675 or Max31855 Thermocouple #if DISABLED(SDSUPPORT) - #define MAX6675_SS 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card + #define MAX6675_SS_PIN 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card #else - #define MAX6675_SS 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present + #define MAX6675_SS_PIN 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present #endif // diff --git a/Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h b/Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h index 0aa4a94be2..b5d77c7214 100644 --- a/Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h +++ b/Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h @@ -113,9 +113,9 @@ // SPI for Max6675 or Max31855 Thermocouple #if DISABLED(SDSUPPORT) - #define MAX6675_SS 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card + #define MAX6675_SS_PIN 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card #else - #define MAX6675_SS 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present + #define MAX6675_SS_PIN 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present #endif // diff --git a/Marlin/src/pins/pins_FORMBOT_TREX3.h b/Marlin/src/pins/pins_FORMBOT_TREX3.h index bfe81091c2..622c2d50c2 100644 --- a/Marlin/src/pins/pins_FORMBOT_TREX3.h +++ b/Marlin/src/pins/pins_FORMBOT_TREX3.h @@ -113,9 +113,9 @@ // SPI for Max6675 or Max31855 Thermocouple #if DISABLED(SDSUPPORT) - #define MAX6675_SS 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card + #define MAX6675_SS_PIN 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card #else - #define MAX6675_SS 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present + #define MAX6675_SS_PIN 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present #endif // diff --git a/Marlin/src/pins/pins_MIGHTYBOARD_REVE.h b/Marlin/src/pins/pins_MIGHTYBOARD_REVE.h index 834ad4e024..8fb67c8419 100644 --- a/Marlin/src/pins/pins_MIGHTYBOARD_REVE.h +++ b/Marlin/src/pins/pins_MIGHTYBOARD_REVE.h @@ -136,12 +136,14 @@ // #define THERMO_SCK_PIN 78 // E2 #define THERMO_DO_PIN 3 // E5 -#define THERMO_CS1 5 // E3 -#define THERMO_CS2 2 // E4 +#define THERMO_CS1_PIN 5 // E3 +#define THERMO_CS2_PIN 2 // E4 -#define MAX6675_SS THERMO_CS1 +#define MAX6675_SS_PIN THERMO_CS1_PIN +#define MAX6675_SS2_PIN THERMO_CS2_PIN #define MAX6675_SCK_PIN THERMO_SCK_PIN #define MAX6675_DO_PIN THERMO_DO_PIN + // // Augmentation for auto-assigning plugs // diff --git a/Marlin/src/pins/pins_RADDS.h b/Marlin/src/pins/pins_RADDS.h index f143443408..3bc039f926 100644 --- a/Marlin/src/pins/pins_RADDS.h +++ b/Marlin/src/pins/pins_RADDS.h @@ -172,9 +172,9 @@ // SPI for Max6675 or Max31855 Thermocouple #if DISABLED(SDSUPPORT) - #define MAX6675_SS 53 + #define MAX6675_SS_PIN 53 #else - #define MAX6675_SS 49 + #define MAX6675_SS_PIN 49 #endif // diff --git a/Marlin/src/pins/pins_RAMPS.h b/Marlin/src/pins/pins_RAMPS.h index cf3954c06a..6b9bd11148 100644 --- a/Marlin/src/pins/pins_RAMPS.h +++ b/Marlin/src/pins/pins_RAMPS.h @@ -205,9 +205,9 @@ // SPI for Max6675 or Max31855 Thermocouple #if DISABLED(SDSUPPORT) - #define MAX6675_SS 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card + #define MAX6675_SS_PIN 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card #else - #define MAX6675_SS 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present + #define MAX6675_SS_PIN 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present #endif // diff --git a/Marlin/src/pins/pins_RAMPS_DUO.h b/Marlin/src/pins/pins_RAMPS_DUO.h index 87683f07cc..efbd647edd 100644 --- a/Marlin/src/pins/pins_RAMPS_DUO.h +++ b/Marlin/src/pins/pins_RAMPS_DUO.h @@ -64,11 +64,11 @@ #define TEMP_BED_PIN 10 // Analog Input // SPI for Max6675 or Max31855 Thermocouple -#undef MAX6675_SS +#undef MAX6675_SS_PIN #if DISABLED(SDSUPPORT) - #define MAX6675_SS 69 // Do not use pin 53 if there is even the remote possibility of using Display/SD card + #define MAX6675_SS_PIN 69 // Do not use pin 53 if there is even the remote possibility of using Display/SD card #else - #define MAX6675_SS 69 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present + #define MAX6675_SS_PIN 69 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present #endif // diff --git a/Marlin/src/pins/pins_RAMPS_FD_V1.h b/Marlin/src/pins/pins_RAMPS_FD_V1.h index f365add05b..88df3fdae7 100644 --- a/Marlin/src/pins/pins_RAMPS_FD_V1.h +++ b/Marlin/src/pins/pins_RAMPS_FD_V1.h @@ -112,9 +112,9 @@ // SPI for Max6675 or Max31855 Thermocouple #if DISABLED(SDSUPPORT) - #define MAX6675_SS 53 + #define MAX6675_SS_PIN 53 #else - #define MAX6675_SS 49 + #define MAX6675_SS_PIN 49 #endif // diff --git a/Marlin/src/pins/pins_RAMPS_OLD.h b/Marlin/src/pins/pins_RAMPS_OLD.h index 630ac970c0..3181d0f752 100644 --- a/Marlin/src/pins/pins_RAMPS_OLD.h +++ b/Marlin/src/pins/pins_RAMPS_OLD.h @@ -77,9 +77,9 @@ // SPI for Max6675 or Max31855 Thermocouple #if DISABLED(SDSUPPORT) - #define MAX6675_SS 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card + #define MAX6675_SS_PIN 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card #else - #define MAX6675_SS 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present + #define MAX6675_SS_PIN 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present #endif // diff --git a/Marlin/src/pins/pins_RAMPS_SMART.h b/Marlin/src/pins/pins_RAMPS_SMART.h index b85bf8df03..851117cad5 100644 --- a/Marlin/src/pins/pins_RAMPS_SMART.h +++ b/Marlin/src/pins/pins_RAMPS_SMART.h @@ -87,12 +87,11 @@ #define TEMP_BED_PIN 11 // Analog Input // SPI for Max6675 or Max31855 Thermocouple +#undef MAX6675_SS_PIN #if DISABLED(SDSUPPORT) - #undef MAX6675_SS - #define MAX6675_SS 67 // Do not use pin 53 if there is even the remote possibility of using Display/SD card + #define MAX6675_SS_PIN 67 // Do not use pin 53 if there is even the remote possibility of using Display/SD card #else - #undef MAX6675_SS - #define MAX6675_SS 67 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present + #define MAX6675_SS_PIN 67 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present #endif // diff --git a/Marlin/src/pins/pins_RIGIDBOARD.h b/Marlin/src/pins/pins_RIGIDBOARD.h index f783d83c61..4247ace87c 100644 --- a/Marlin/src/pins/pins_RIGIDBOARD.h +++ b/Marlin/src/pins/pins_RIGIDBOARD.h @@ -73,11 +73,11 @@ #define TEMP_BED_PIN 15 // Analog Input // SPI for Max6675 or Max31855 Thermocouple -#undef MAX6675_SS +#undef MAX6675_SS_PIN #if DISABLED(SDSUPPORT) - #define MAX6675_SS 53 // Don't use pin 53 if there is even the remote possibility of using Display/SD card + #define MAX6675_SS_PIN 53 // Don't use pin 53 if there is even the remote possibility of using Display/SD card #else - #define MAX6675_SS 49 // Don't use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present + #define MAX6675_SS_PIN 49 // Don't use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present #endif // diff --git a/Marlin/src/pins/pins_RURAMPS4D_11.h b/Marlin/src/pins/pins_RURAMPS4D_11.h index c1fff4786a..0785085cc5 100644 --- a/Marlin/src/pins/pins_RURAMPS4D_11.h +++ b/Marlin/src/pins/pins_RURAMPS4D_11.h @@ -158,11 +158,13 @@ #endif // SPI for Max6675 or Max31855 Thermocouple -//#if DISABLED(SDSUPPORT) -// #define MAX6675_SS 53 -//#else -// #define MAX6675_SS 49 -//#endif +/* +#if DISABLED(SDSUPPORT) + #define MAX6675_SS_PIN 53 +#else + #define MAX6675_SS_PIN 49 +#endif +*/ // // Misc. Functions diff --git a/Marlin/src/pins/pins_RURAMPS4D_13.h b/Marlin/src/pins/pins_RURAMPS4D_13.h index c15b7fffca..629e61da1f 100644 --- a/Marlin/src/pins/pins_RURAMPS4D_13.h +++ b/Marlin/src/pins/pins_RURAMPS4D_13.h @@ -144,11 +144,13 @@ #endif // SPI for Max6675 or Max31855 Thermocouple -//#if DISABLED(SDSUPPORT) -// #define MAX6675_SS 53 -//#else -// #define MAX6675_SS 49 -//#endif +/* +#if DISABLED(SDSUPPORT) + #define MAX6675_SS_PIN 53 +#else + #define MAX6675_SS_PIN 49 +#endif +*/ // // Misc. Functions diff --git a/Marlin/src/pins/pins_ULTRATRONICS_PRO.h b/Marlin/src/pins/pins_ULTRATRONICS_PRO.h index 1a3f90e7b4..699d472586 100644 --- a/Marlin/src/pins/pins_ULTRATRONICS_PRO.h +++ b/Marlin/src/pins/pins_ULTRATRONICS_PRO.h @@ -125,7 +125,7 @@ #define SPI_FLASH_CS -1 // SPI for Max6675 or Max31855 Thermocouple -#define MAX6675_SS 65 +#define MAX6675_SS_PIN 65 #define MAX31855_SS0 65 #define MAX31855_SS1 52 #define MAX31855_SS2 50