🐛 Redundant Temp Sensor followup (#22196)
This commit is contained in:
parent
9eb5444c20
commit
b2f0913083
|
@ -397,70 +397,92 @@
|
||||||
// @section temperature
|
// @section temperature
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* --NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table
|
* --NORMAL IS 4.7kΩ PULLUP!-- 1kΩ pullup can be used on hotend sensor, using correct resistor and table
|
||||||
*
|
*
|
||||||
* Temperature sensors available:
|
* Temperature sensors available:
|
||||||
*
|
*
|
||||||
* -5 : PT100 / PT1000 with MAX31865 (only for sensors 0-1)
|
* SPI RTD/Thermocouple Boards - IMPORTANT: Read the NOTE below!
|
||||||
* -3 : thermocouple with MAX31855 (only for sensors 0-1)
|
* -------
|
||||||
* -2 : thermocouple with MAX6675 (only for sensors 0-1)
|
* -5 : MAX31865 with Pt100/Pt1000, 2, 3, or 4-wire (only for sensors 0-1)
|
||||||
* -4 : thermocouple with AD8495
|
* NOTE: You must uncomment/set the MAX31865_*_OHMS_n defines below.
|
||||||
* -1 : thermocouple with AD595
|
* -3 : MAX31855 with Thermocouple, -200°C to +700°C (only for sensors 0-1)
|
||||||
|
* -2 : MAX6675 with Thermocouple, 0°C to +700°C (only for sensors 0-1)
|
||||||
|
*
|
||||||
|
* NOTE: Ensure TEMP_n_CS_PIN is set in your pins file for each TEMP_SENSOR_n using an SPI Thermocouple. By default,
|
||||||
|
* Hardware SPI on the default serial bus is used. If you have also set TEMP_n_SCK_PIN and TEMP_n_MISO_PIN,
|
||||||
|
* Software SPI will be used on those ports instead. You can force Hardware SPI on the default bus in the
|
||||||
|
* Configuration_adv.h file. At this time, separate Hardware SPI buses for sensors are not supported.
|
||||||
|
*
|
||||||
|
* Analog Themocouple Boards
|
||||||
|
* -------
|
||||||
|
* -4 : AD8495 with Thermocouple
|
||||||
|
* -1 : AD595 with Thermocouple
|
||||||
|
*
|
||||||
|
* Analog Thermistors - 4.7kΩ pullup - Normal
|
||||||
|
* -------
|
||||||
|
* 1 : 100kΩ EPCOS - Best choice for EPCOS thermistors
|
||||||
|
* 331 : 100kΩ Same as #1, but 3.3V scaled for MEGA
|
||||||
|
* 332 : 100kΩ Same as #1, but 3.3V scaled for DUE
|
||||||
|
* 2 : 200kΩ ATC Semitec 204GT-2
|
||||||
|
* 202 : 200kΩ Copymaster 3D
|
||||||
|
* 3 : ???Ω Mendel-parts thermistor
|
||||||
|
* 4 : 10kΩ Generic Thermistor !! DO NOT use for a hotend - it gives bad resolution at high temp. !!
|
||||||
|
* 5 : 100kΩ ATC Semitec 104GT-2/104NT-4-R025H42G - Used in ParCan, J-Head, and E3D, SliceEngineering 300°C
|
||||||
|
* 501 : 100kΩ Zonestar - Tronxy X3A
|
||||||
|
* 502 : 100kΩ Zonestar - used by hot bed in Zonestar Průša P802M
|
||||||
|
* 512 : 100kΩ RPW-Ultra hotend
|
||||||
|
* 6 : 100kΩ EPCOS - Not as accurate as table #1 (created using a fluke thermocouple)
|
||||||
|
* 7 : 100kΩ Honeywell 135-104LAG-J01
|
||||||
|
* 71 : 100kΩ Honeywell 135-104LAF-J01
|
||||||
|
* 8 : 100kΩ Vishay 0603 SMD NTCS0603E3104FXT
|
||||||
|
* 9 : 100kΩ GE Sensing AL03006-58.2K-97-G1
|
||||||
|
* 10 : 100kΩ RS PRO 198-961
|
||||||
|
* 11 : 100kΩ Keenovo AC silicone mats, most Wanhao i3 machines - beta 3950, 1%
|
||||||
|
* 12 : 100kΩ Vishay 0603 SMD NTCS0603E3104FXT (#8) - calibrated for Makibox hot bed
|
||||||
|
* 13 : 100kΩ Hisens up to 300°C - for "Simple ONE" & "All In ONE" hotend - beta 3950, 1%
|
||||||
|
* 15 : 100kΩ Calibrated for JGAurora A5 hotend
|
||||||
|
* 18 : 200kΩ ATC Semitec 204GT-2 Dagoma.Fr - MKS_Base_DKU001327
|
||||||
|
* 22 : 100kΩ GTM32 Pro vB - hotend - 4.7kΩ pullup to 3.3V and 220Ω to analog input
|
||||||
|
* 23 : 100kΩ GTM32 Pro vB - bed - 4.7kΩ pullup to 3.3v and 220Ω to analog input
|
||||||
|
* 30 : 100kΩ Kis3d Silicone heating mat 200W/300W with 6mm precision cast plate (EN AW 5083) NTC100K - beta 3950
|
||||||
|
* 60 : 100kΩ Maker's Tool Works Kapton Bed Thermistor - beta 3950
|
||||||
|
* 61 : 100kΩ Formbot/Vivedino 350°C Thermistor - beta 3950
|
||||||
|
* 66 : 4.7MΩ Dyze Design High Temperature Thermistor
|
||||||
|
* 67 : 500kΩ SliceEngineering 450°C Thermistor
|
||||||
|
* 70 : 100kΩ bq Hephestos 2
|
||||||
|
* 75 : 100kΩ Generic Silicon Heat Pad with NTC100K MGB18-104F39050L32
|
||||||
|
*
|
||||||
|
* Analog Thermistors - 1kΩ pullup - Atypical, and requires changing out the 4.7kΩ pullup for 1kΩ.
|
||||||
|
* ------- (but gives greater accuracy and more stable PID)
|
||||||
|
* 51 : 100kΩ EPCOS (1kΩ pullup)
|
||||||
|
* 52 : 200kΩ ATC Semitec 204GT-2 (1kΩ pullup)
|
||||||
|
* 55 : 100kΩ ATC Semitec 104GT-2 - Used in ParCan & J-Head (1kΩ pullup)
|
||||||
|
*
|
||||||
|
* Analog Thermistors - 10kΩ pullup - Atypical
|
||||||
|
* -------
|
||||||
|
* 99 : 100kΩ Found on some Wanhao i3 machines with a 10kΩ pull-up resistor
|
||||||
|
*
|
||||||
|
* Analog RTDs (Pt100/Pt1000)
|
||||||
|
* -------
|
||||||
|
* 110 : Pt100 with 1kΩ pullup (atypical)
|
||||||
|
* 147 : Pt100 with 4.7kΩ pullup
|
||||||
|
* 1010 : Pt1000 with 1kΩ pullup (atypical)
|
||||||
|
* 1047 : Pt1000 with 4.7kΩ pullup (E3D)
|
||||||
|
* 20 : Pt100 with circuit in the Ultimainboard V2.x with mainboard ADC reference voltage = INA826 amplifier-board supply voltage.
|
||||||
|
* NOTE: (1) Must use an ADC input with no pullup. (2) Some INA826 amplifiers are unreliable at 3.3V so consider using sensor 147, 110, or 21.
|
||||||
|
* 21 : Pt100 with circuit in the Ultimainboard V2.x with 3.3v ADC reference voltage (STM32, LPC176x....) and 5V INA826 amplifier board supply.
|
||||||
|
* NOTE: ADC pins are not 5V tolerant. Not recommended because it's possible to damage the CPU by going over 500°C.
|
||||||
|
* 201 : Pt100 with circuit in Overlord, similar to Ultimainboard V2.x
|
||||||
|
*
|
||||||
|
* Custom/Dummy/Other Thermos
|
||||||
|
* ------
|
||||||
* 0 : not used
|
* 0 : not used
|
||||||
* 1 : 100k thermistor - best choice for EPCOS 100k (4.7k pullup)
|
|
||||||
* 331 : (3.3V scaled thermistor 1 table for MEGA)
|
|
||||||
* 332 : (3.3V scaled thermistor 1 table for DUE)
|
|
||||||
* 2 : 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup)
|
|
||||||
* 202 : 200k thermistor - Copymaster 3D
|
|
||||||
* 3 : Mendel-parts thermistor (4.7k pullup)
|
|
||||||
* 4 : 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !!
|
|
||||||
* 5 : 100K thermistor - ATC Semitec 104GT-2/104NT-4-R025H42G (Used in ParCan, J-Head, and E3D) (4.7k pullup)
|
|
||||||
* 501 : 100K Zonestar (Tronxy X3A) Thermistor
|
|
||||||
* 502 : 100K Zonestar Thermistor used by hot bed in Zonestar Průša P802M
|
|
||||||
* 512 : 100k RPW-Ultra hotend thermistor (4.7k pullup)
|
|
||||||
* 6 : 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup)
|
|
||||||
* 7 : 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup)
|
|
||||||
* 71 : 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup)
|
|
||||||
* 8 : 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup)
|
|
||||||
* 9 : 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
|
|
||||||
* 10 : 100k RS thermistor 198-961 (4.7k pullup)
|
|
||||||
* 11 : 100k beta 3950 1% thermistor (Used in Keenovo AC silicone mats and most Wanhao i3 machines) (4.7k pullup)
|
|
||||||
* 12 : 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed)
|
|
||||||
* 13 : 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE"
|
|
||||||
* 15 : 100k thermistor calibration for JGAurora A5 hotend
|
|
||||||
* 18 : ATC Semitec 204GT-2 (4.7k pullup) Dagoma.Fr - MKS_Base_DKU001327
|
|
||||||
* 20 : Pt100 with circuit in the Ultimainboard V2.x with mainboard ADC reference voltage = INA826 amplifier-board supply voltage.
|
|
||||||
* NOTES: (1) Must use an ADC input with no pullup. (2) Some INA826 amplifiers are unreliable at 3.3V so consider using sensor 147, 110, or 21.
|
|
||||||
* 21 : Pt100 with circuit in the Ultimainboard V2.x with 3.3v ADC reference voltage (STM32, LPC176x....) and 5V INA826 amplifier board supply.
|
|
||||||
* NOTE: ADC pins are not 5V tolerant. Not recommended because it's possible to damage the CPU by going over 500°C.
|
|
||||||
* 22 : 100k (hotend) with 4.7k pullup to 3.3V and 220R to analog input (as in GTM32 Pro vB)
|
|
||||||
* 23 : 100k (bed) with 4.7k pullup to 3.3v and 220R to analog input (as in GTM32 Pro vB)
|
|
||||||
* 30 : Kis3d Silicone heating mat 200W/300W with 6mm precision cast plate (EN AW 5083) NTC100K / B3950 (4.7k pullup)
|
|
||||||
* 201 : Pt100 with circuit in Overlord, similar to Ultimainboard V2.x
|
|
||||||
* 60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
|
|
||||||
* 61 : 100k Formbot / Vivedino 3950 350C thermistor 4.7k pullup
|
|
||||||
* 66 : 4.7M High Temperature thermistor from Dyze Design
|
|
||||||
* 67 : 450C thermistor from SliceEngineering
|
|
||||||
* 70 : the 100K thermistor found in the bq Hephestos 2
|
|
||||||
* 75 : 100k Generic Silicon Heat Pad with NTC 100K MGB18-104F39050L32 thermistor
|
|
||||||
* 99 : 100k thermistor with a 10K pull-up resistor (found on some Wanhao i3 machines)
|
|
||||||
*
|
|
||||||
* 1k ohm pullup tables - This is atypical, and requires changing out the 4.7k pullup for 1k.
|
|
||||||
* (but gives greater accuracy and more stable PID)
|
|
||||||
* 51 : 100k thermistor - EPCOS (1k pullup)
|
|
||||||
* 52 : 200k thermistor - ATC Semitec 204GT-2 (1k pullup)
|
|
||||||
* 55 : 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup)
|
|
||||||
*
|
|
||||||
* 1047 : Pt1000 with 4k7 pullup (E3D)
|
|
||||||
* 1010 : Pt1000 with 1k pullup (non standard)
|
|
||||||
* 147 : Pt100 with 4k7 pullup
|
|
||||||
* 110 : Pt100 with 1k pullup (non standard)
|
|
||||||
*
|
|
||||||
* 1000 : Custom - Specify parameters in Configuration_adv.h
|
* 1000 : Custom - Specify parameters in Configuration_adv.h
|
||||||
*
|
*
|
||||||
* Use these for Testing or Development purposes. NEVER for production machine.
|
* !!! Use these for Testing or Development purposes. NEVER for production machine. !!!
|
||||||
* 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below.
|
* 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below.
|
||||||
* 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below.
|
* 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
#define TEMP_SENSOR_0 1
|
#define TEMP_SENSOR_0 1
|
||||||
#define TEMP_SENSOR_1 0
|
#define TEMP_SENSOR_1 0
|
||||||
|
@ -482,7 +504,7 @@
|
||||||
|
|
||||||
// Resistor values when using MAX31865 sensors (-5) on TEMP_SENSOR_0 / 1
|
// Resistor values when using MAX31865 sensors (-5) on TEMP_SENSOR_0 / 1
|
||||||
//#define MAX31865_SENSOR_OHMS_0 100 // (Ω) Typically 100 or 1000 (PT100 or PT1000)
|
//#define MAX31865_SENSOR_OHMS_0 100 // (Ω) Typically 100 or 1000 (PT100 or PT1000)
|
||||||
//#define MAX31865_CALIBRATION_OHMS_0 430 // (Ω) Typically 430 for AdaFruit PT100; 4300 for AdaFruit PT1000
|
//#define MAX31865_CALIBRATION_OHMS_0 430 // (Ω) Typically 430 for Adafruit PT100; 4300 for Adafruit PT1000
|
||||||
//#define MAX31865_SENSOR_OHMS_1 100
|
//#define MAX31865_SENSOR_OHMS_1 100
|
||||||
//#define MAX31865_CALIBRATION_OHMS_1 430
|
//#define MAX31865_CALIBRATION_OHMS_1 430
|
||||||
|
|
||||||
|
|
|
@ -131,10 +131,21 @@
|
||||||
#define REDUNDANT_BETA 3950 // Beta value
|
#define REDUNDANT_BETA 3950 // Beta value
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
/**
|
||||||
// Hephestos 2 24V heated bed upgrade kit.
|
* Configuration options for MAX Thermocouples (-2, -3, -5).
|
||||||
// https://store.bq.com/en/heated-bed-kit-hephestos2
|
* FORCE_HW_SPI: Ignore SCK/MOSI/MISO pins and just use the CS pin & default SPI bus.
|
||||||
//
|
* MAX31865_WIRES: Set the number of wires for the probe connected to a MAX31865 board, 2-4. Default: 2
|
||||||
|
* MAX31865_50HZ: Enable 50Hz filter instead of the default 60Hz.
|
||||||
|
*/
|
||||||
|
//#define TEMP_SENSOR_FORCE_HW_SPI
|
||||||
|
//#define MAX31865_SENSOR_WIRES_0 2
|
||||||
|
//#define MAX31865_SENSOR_WIRES_1 2
|
||||||
|
//#define MAX31865_50HZ_FILTER
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hephestos 2 24V heated bed upgrade kit.
|
||||||
|
* https://store.bq.com/en/heated-bed-kit-hephestos2
|
||||||
|
*/
|
||||||
//#define HEPHESTOS2_HEATED_BED_KIT
|
//#define HEPHESTOS2_HEATED_BED_KIT
|
||||||
#if ENABLED(HEPHESTOS2_HEATED_BED_KIT)
|
#if ENABLED(HEPHESTOS2_HEATED_BED_KIT)
|
||||||
#undef TEMP_SENSOR_BED
|
#undef TEMP_SENSOR_BED
|
||||||
|
|
|
@ -31,7 +31,8 @@
|
||||||
#error "No custom SD drive cable defined for this board."
|
#error "No custom SD drive cable defined for this board."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MAX6675_SCK_PIN) && defined(MAX6675_DO_PIN) && (MAX6675_SCK_PIN == SCK1 || MAX6675_DO_PIN == MISO1)
|
#if (defined(TEMP_0_SCK_PIN) && defined(TEMP_0_MISO_PIN) && (TEMP_0_SCK_PIN == SCK1 || TEMP_0_MISO_PIN == MISO1)) || \
|
||||||
|
(defined(TEMP_1_SCK_PIN) && defined(TEMP_1_MISO_PIN) && (TEMP_1_SCK_PIN == SCK1 || TEMP_1_MISO_PIN == MISO1))
|
||||||
#error "OnBoard SPI BUS can't be shared with other devices."
|
#error "OnBoard SPI BUS can't be shared with other devices."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1169,10 +1169,10 @@ void setup() {
|
||||||
|
|
||||||
// Init and disable SPI thermocouples; this is still needed
|
// Init and disable SPI thermocouples; this is still needed
|
||||||
#if TEMP_SENSOR_0_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 0)
|
#if TEMP_SENSOR_0_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 0)
|
||||||
OUT_WRITE(MAX6675_SS_PIN, HIGH); // Disable
|
OUT_WRITE(TEMP_0_CS_PIN, HIGH); // Disable
|
||||||
#endif
|
#endif
|
||||||
#if TEMP_SENSOR_1_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 1)
|
#if TEMP_SENSOR_1_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 1)
|
||||||
OUT_WRITE(MAX6675_SS2_PIN, HIGH); // Disable
|
OUT_WRITE(TEMP_1_CS_PIN, HIGH);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(DUET_SMART_EFFECTOR) && PIN_EXISTS(SMART_EFFECTOR_MOD)
|
#if ENABLED(DUET_SMART_EFFECTOR) && PIN_EXISTS(SMART_EFFECTOR_MOD)
|
||||||
|
|
|
@ -204,8 +204,8 @@
|
||||||
#define __TERN(T,V...) ___TERN(_CAT(_NO,T),V) // Prepend '_NO' to get '_NOT_0' or '_NOT_1'
|
#define __TERN(T,V...) ___TERN(_CAT(_NO,T),V) // Prepend '_NO' to get '_NOT_0' or '_NOT_1'
|
||||||
#define ___TERN(P,V...) THIRD(P,V) // If first argument has a comma, A. Else B.
|
#define ___TERN(P,V...) THIRD(P,V) // If first argument has a comma, A. Else B.
|
||||||
|
|
||||||
#define _OPTARG(A) , A
|
#define _OPTARG(A...) , A
|
||||||
#define OPTARG(O,A) TERN_(O,DEFER4(_OPTARG)(A))
|
#define OPTARG(O,A...) TERN_(O,DEFER4(_OPTARG)(A))
|
||||||
#define _OPTCODE(A) A;
|
#define _OPTCODE(A) A;
|
||||||
#define OPTCODE(O,A) TERN_(O,DEFER4(_OPTCODE)(A))
|
#define OPTCODE(O,A) TERN_(O,DEFER4(_OPTCODE)(A))
|
||||||
|
|
||||||
|
|
|
@ -314,11 +314,13 @@ void GcodeSuite::G34() {
|
||||||
sprintf_P(msg,
|
sprintf_P(msg,
|
||||||
PSTR("1:2=%s" TERN_(TRIPLE_Z, " 3-2=%s 3-1=%s") TERN_(QUAD_Z, " 4-3=%s 4-2=%s 4-1=%s")),
|
PSTR("1:2=%s" TERN_(TRIPLE_Z, " 3-2=%s 3-1=%s") TERN_(QUAD_Z, " 4-3=%s 4-2=%s 4-1=%s")),
|
||||||
dtostrf(ABS(z_measured[1] - z_measured[0]), 1, 3, fstr1)
|
dtostrf(ABS(z_measured[1] - z_measured[0]), 1, 3, fstr1)
|
||||||
OPTARG(TRIPLE_Z, dtostrf(ABS(z_measured[2] - z_measured[1]), 1, 3, fstr2))
|
OPTARG(TRIPLE_Z,
|
||||||
OPTARG(TRIPLE_Z, dtostrf(ABS(z_measured[2] - z_measured[0]), 1, 3, fstr3))
|
dtostrf(ABS(z_measured[2] - z_measured[1]), 1, 3, fstr2),
|
||||||
OPTARG(QUAD_Z, dtostrf(ABS(z_measured[3] - z_measured[2]), 1, 3, fstr4))
|
dtostrf(ABS(z_measured[2] - z_measured[0]), 1, 3, fstr3))
|
||||||
OPTARG(QUAD_Z, dtostrf(ABS(z_measured[3] - z_measured[1]), 1, 3, fstr5))
|
OPTARG(QUAD_Z,
|
||||||
OPTARG(QUAD_Z, dtostrf(ABS(z_measured[3] - z_measured[0]), 1, 3, fstr6))
|
dtostrf(ABS(z_measured[3] - z_measured[2]), 1, 3, fstr4),
|
||||||
|
dtostrf(ABS(z_measured[3] - z_measured[1]), 1, 3, fstr5),
|
||||||
|
dtostrf(ABS(z_measured[3] - z_measured[0]), 1, 3, fstr6))
|
||||||
);
|
);
|
||||||
ui.set_status(msg);
|
ui.set_status(msg);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -615,20 +615,21 @@
|
||||||
|
|
||||||
#if TEMP_SENSOR_0 == -5 || TEMP_SENSOR_0 == -3 || TEMP_SENSOR_0 == -2
|
#if TEMP_SENSOR_0 == -5 || TEMP_SENSOR_0 == -3 || TEMP_SENSOR_0 == -2
|
||||||
#define TEMP_SENSOR_0_IS_MAX_TC 1
|
#define TEMP_SENSOR_0_IS_MAX_TC 1
|
||||||
#define HAS_MAX_TC 1
|
|
||||||
#if TEMP_SENSOR_0 == -3
|
|
||||||
#define TEMP_SENSOR_0_MAX_TC_TMIN -270
|
|
||||||
#define TEMP_SENSOR_0_MAX_TC_TMAX 1800
|
|
||||||
#else
|
|
||||||
#define TEMP_SENSOR_0_MAX_TC_TMIN 0
|
|
||||||
#define TEMP_SENSOR_0_MAX_TC_TMAX 1024
|
|
||||||
#endif
|
|
||||||
#if TEMP_SENSOR_0 == -5
|
#if TEMP_SENSOR_0 == -5
|
||||||
#define TEMP_SENSOR_0_IS_MAX31865 1
|
#define TEMP_SENSOR_0_IS_MAX31865 1
|
||||||
|
#define TEMP_SENSOR_0_MAX_TC_TMIN 0
|
||||||
|
#define TEMP_SENSOR_0_MAX_TC_TMAX 1024
|
||||||
|
#ifndef MAX31865_SENSOR_WIRES_0
|
||||||
|
#define MAX31865_SENSOR_WIRES_0 2
|
||||||
|
#endif
|
||||||
#elif TEMP_SENSOR_0 == -3
|
#elif TEMP_SENSOR_0 == -3
|
||||||
#define TEMP_SENSOR_0_IS_MAX31855 1
|
#define TEMP_SENSOR_0_IS_MAX31855 1
|
||||||
|
#define TEMP_SENSOR_0_MAX_TC_TMIN -270
|
||||||
|
#define TEMP_SENSOR_0_MAX_TC_TMAX 1800
|
||||||
#elif TEMP_SENSOR_0 == -2
|
#elif TEMP_SENSOR_0 == -2
|
||||||
#define TEMP_SENSOR_0_IS_MAX6675 1
|
#define TEMP_SENSOR_0_IS_MAX6675 1
|
||||||
|
#define TEMP_SENSOR_0_MAX_TC_TMIN 0
|
||||||
|
#define TEMP_SENSOR_0_MAX_TC_TMAX 1024
|
||||||
#endif
|
#endif
|
||||||
#elif TEMP_SENSOR_0 == -4
|
#elif TEMP_SENSOR_0 == -4
|
||||||
#define TEMP_SENSOR_0_IS_AD8495 1
|
#define TEMP_SENSOR_0_IS_AD8495 1
|
||||||
|
@ -648,21 +649,23 @@
|
||||||
|
|
||||||
#if TEMP_SENSOR_1 == -5 || TEMP_SENSOR_1 == -3 || TEMP_SENSOR_1 == -2
|
#if TEMP_SENSOR_1 == -5 || TEMP_SENSOR_1 == -3 || TEMP_SENSOR_1 == -2
|
||||||
#define TEMP_SENSOR_1_IS_MAX_TC 1
|
#define TEMP_SENSOR_1_IS_MAX_TC 1
|
||||||
#define HAS_MAX_TC 1
|
#if TEMP_SENSOR_1 == -5
|
||||||
#if TEMP_SENSOR_1 == -3
|
#define TEMP_SENSOR_1_IS_MAX31865 1
|
||||||
|
#define TEMP_SENSOR_1_MAX_TC_TMIN 0
|
||||||
|
#define TEMP_SENSOR_1_MAX_TC_TMAX 1024
|
||||||
|
#ifndef MAX31865_SENSOR_WIRES_1
|
||||||
|
#define MAX31865_SENSOR_WIRES_1 2
|
||||||
|
#endif
|
||||||
|
#elif TEMP_SENSOR_1 == -3
|
||||||
|
#define TEMP_SENSOR_1_IS_MAX31855 1
|
||||||
#define TEMP_SENSOR_1_MAX_TC_TMIN -270
|
#define TEMP_SENSOR_1_MAX_TC_TMIN -270
|
||||||
#define TEMP_SENSOR_1_MAX_TC_TMAX 1800
|
#define TEMP_SENSOR_1_MAX_TC_TMAX 1800
|
||||||
#else
|
#elif TEMP_SENSOR_1 == -2
|
||||||
|
#define TEMP_SENSOR_1_IS_MAX6675 1
|
||||||
#define TEMP_SENSOR_1_MAX_TC_TMIN 0
|
#define TEMP_SENSOR_1_MAX_TC_TMIN 0
|
||||||
#define TEMP_SENSOR_1_MAX_TC_TMAX 1024
|
#define TEMP_SENSOR_1_MAX_TC_TMAX 1024
|
||||||
#endif
|
#endif
|
||||||
#if TEMP_SENSOR_1 == -5
|
|
||||||
#define TEMP_SENSOR_1_IS_MAX31865 1
|
|
||||||
#elif TEMP_SENSOR_1 == -3
|
|
||||||
#define TEMP_SENSOR_1_IS_MAX31855 1
|
|
||||||
#elif TEMP_SENSOR_1 == -2
|
|
||||||
#define TEMP_SENSOR_1_IS_MAX6675 1
|
|
||||||
#endif
|
|
||||||
#if TEMP_SENSOR_1 != TEMP_SENSOR_0
|
#if TEMP_SENSOR_1 != TEMP_SENSOR_0
|
||||||
#if TEMP_SENSOR_1 == -5
|
#if TEMP_SENSOR_1 == -5
|
||||||
#error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."
|
#error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."
|
||||||
|
@ -690,37 +693,48 @@
|
||||||
|
|
||||||
#if TEMP_SENSOR_REDUNDANT == -5 || TEMP_SENSOR_REDUNDANT == -3 || TEMP_SENSOR_REDUNDANT == -2
|
#if TEMP_SENSOR_REDUNDANT == -5 || TEMP_SENSOR_REDUNDANT == -3 || TEMP_SENSOR_REDUNDANT == -2
|
||||||
#define TEMP_SENSOR_REDUNDANT_IS_MAX_TC 1
|
#define TEMP_SENSOR_REDUNDANT_IS_MAX_TC 1
|
||||||
#define HAS_MAX_TC 1
|
|
||||||
#if TEMP_SENSOR_REDUNDANT == -3
|
|
||||||
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN -270
|
|
||||||
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1800
|
|
||||||
#else
|
|
||||||
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN 0
|
|
||||||
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1024
|
|
||||||
#endif
|
|
||||||
#if TEMP_SENSOR_REDUNDANT_SOURCE == 0
|
|
||||||
#define TEMP_SENSOR_0_MAX_TC_TMIN TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN
|
|
||||||
#define TEMP_SENSOR_0_MAX_TC_TMAX TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX
|
|
||||||
#elif TEMP_SENSOR_REDUNDANT_SOURCE == 1
|
|
||||||
#define TEMP_SENSOR_1_MAX_TC_TMIN TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN
|
|
||||||
#define TEMP_SENSOR_1_MAX_TC_TMAX TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX
|
|
||||||
#endif
|
|
||||||
#if TEMP_SENSOR_REDUNDANT == -5
|
#if TEMP_SENSOR_REDUNDANT == -5
|
||||||
#if TEMP_SENSOR_REDUNDANT_SOURCE != 0 && TEMP_SENSOR_REDUNDANT_SOURCE != 1
|
#if TEMP_SENSOR_REDUNDANT_SOURCE != 0 && TEMP_SENSOR_REDUNDANT_SOURCE != 1
|
||||||
#error "MAX31865 Thermocouples (-5) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
|
#error "MAX31865 Thermocouples (-5) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
|
||||||
#endif
|
#endif
|
||||||
#define TEMP_SENSOR_REDUNDANT_IS_MAX31865 1
|
|
||||||
|
#define TEMP_SENSOR_REDUNDANT_IS_MAX31865 1
|
||||||
|
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN 0
|
||||||
|
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1024
|
||||||
#elif TEMP_SENSOR_REDUNDANT == -3
|
#elif TEMP_SENSOR_REDUNDANT == -3
|
||||||
#if TEMP_SENSOR_REDUNDANT_SOURCE != 0 && TEMP_SENSOR_REDUNDANT_SOURCE != 1
|
#if TEMP_SENSOR_REDUNDANT_SOURCE != 0 && TEMP_SENSOR_REDUNDANT_SOURCE != 1
|
||||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
|
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
|
||||||
#endif
|
#endif
|
||||||
#define TEMP_SENSOR_REDUNDANT_IS_MAX31855 1
|
|
||||||
|
#define TEMP_SENSOR_REDUNDANT_IS_MAX31855 1
|
||||||
|
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN -270
|
||||||
|
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1800
|
||||||
#elif TEMP_SENSOR_REDUNDANT == -2
|
#elif TEMP_SENSOR_REDUNDANT == -2
|
||||||
#if TEMP_SENSOR_REDUNDANT_SOURCE != 0 && TEMP_SENSOR_REDUNDANT_SOURCE != 1
|
#if TEMP_SENSOR_REDUNDANT_SOURCE != 0 && TEMP_SENSOR_REDUNDANT_SOURCE != 1
|
||||||
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
|
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
|
||||||
#endif
|
#endif
|
||||||
#define TEMP_SENSOR_REDUNDANT_IS_MAX6675 1
|
|
||||||
|
#define TEMP_SENSOR_REDUNDANT_IS_MAX6675 1
|
||||||
|
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN 0
|
||||||
|
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1024
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// mimic setting up the source TEMP_SENSOR
|
||||||
|
#if TEMP_SENSOR_REDUNDANT_SOURCE == 0
|
||||||
|
#define TEMP_SENSOR_0_MAX_TC_TMIN TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN
|
||||||
|
#define TEMP_SENSOR_0_MAX_TC_TMAX TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX
|
||||||
|
#ifndef MAX31865_SENSOR_WIRES_0
|
||||||
|
#define MAX31865_SENSOR_WIRES_0 2
|
||||||
|
#endif
|
||||||
|
#elif TEMP_SENSOR_REDUNDANT_SOURCE == 1
|
||||||
|
#define TEMP_SENSOR_1_MAX_TC_TMIN TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN
|
||||||
|
#define TEMP_SENSOR_1_MAX_TC_TMAX TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX
|
||||||
|
#ifndef MAX31865_SENSOR_WIRES_1
|
||||||
|
#define MAX31865_SENSOR_WIRES_1 2
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (TEMP_SENSOR_0_IS_MAX_TC && TEMP_SENSOR_REDUNDANT != TEMP_SENSOR_0) || (TEMP_SENSOR_1_IS_MAX_TC && TEMP_SENSOR_REDUNDANT != TEMP_SENSOR_1)
|
#if (TEMP_SENSOR_0_IS_MAX_TC && TEMP_SENSOR_REDUNDANT != TEMP_SENSOR_0) || (TEMP_SENSOR_1_IS_MAX_TC && TEMP_SENSOR_REDUNDANT != TEMP_SENSOR_1)
|
||||||
#if TEMP_SENSOR_REDUNDANT == -5
|
#if TEMP_SENSOR_REDUNDANT == -5
|
||||||
#error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match."
|
#error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match."
|
||||||
|
@ -743,101 +757,182 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if TEMP_SENSOR_0_IS_MAX_TC || TEMP_SENSOR_1_IS_MAX_TC || TEMP_SENSOR_REDUNDANT_IS_MAX_TC
|
||||||
|
#define HAS_MAX_TC 1
|
||||||
|
#endif
|
||||||
|
#if TEMP_SENSOR_0_IS_MAX6675 || TEMP_SENSOR_1_IS_MAX6675 || TEMP_SENSOR_REDUNDANT_IS_MAX6675
|
||||||
|
#define HAS_MAX6675 1
|
||||||
|
#endif
|
||||||
#if TEMP_SENSOR_0_IS_MAX31855 || TEMP_SENSOR_1_IS_MAX31855 || TEMP_SENSOR_REDUNDANT_IS_MAX31855
|
#if TEMP_SENSOR_0_IS_MAX31855 || TEMP_SENSOR_1_IS_MAX31855 || TEMP_SENSOR_REDUNDANT_IS_MAX31855
|
||||||
#define HAS_MAX31855 1
|
#define HAS_MAX31855 1
|
||||||
#endif
|
#endif
|
||||||
#if TEMP_SENSOR_0_IS_MAX31865 || TEMP_SENSOR_1_IS_MAX31865 || TEMP_SENSOR_REDUNDANT_IS_MAX31865
|
#if TEMP_SENSOR_0_IS_MAX31865 || TEMP_SENSOR_1_IS_MAX31865 || TEMP_SENSOR_REDUNDANT_IS_MAX31865
|
||||||
#define HAS_MAX31865 1
|
#define HAS_MAX31865 1
|
||||||
#endif
|
#endif
|
||||||
#if TEMP_SENSOR_0_IS_MAX6675 || TEMP_SENSOR_1_IS_MAX6675 || TEMP_SENSOR_REDUNDANT_IS_MAX6675
|
|
||||||
#define HAS_MAX6675 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Compatibility layer for MAX (SPI) temp boards
|
// Compatibility layer for MAX (SPI) temp boards
|
||||||
//
|
//
|
||||||
#define TEMP_SENSOR_IS_MAX(n, M) (ENABLED(TEMP_SENSOR_##n##_IS_##M) || (ENABLED(TEMP_SENSOR_REDUNDANT_IS_##M) && TEMP_SENSOR_REDUNDANT_SOURCE == (n)))
|
#if HAS_MAX_TC
|
||||||
|
|
||||||
#if PIN_EXISTS(MAX6675_SS)
|
// Translate old _SS, _CS, _SCK, _DO, _DI, _MISO, and _MOSI PIN defines.
|
||||||
#if TEMP_SENSOR_IS_MAX(0, MAX31855)
|
#if TEMP_SENSOR_0_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 1)
|
||||||
#define MAX31855_CS_PIN MAX6675_SS_PIN
|
|
||||||
#elif TEMP_SENSOR_IS_MAX(0, MAX31865)
|
#if !PIN_EXISTS(TEMP_0_CS) // SS, CS
|
||||||
#define MAX31865_CS_PIN MAX6675_SS_PIN
|
#if PIN_EXISTS(MAX6675_SS)
|
||||||
#elif TEMP_SENSOR_IS_MAX(0, MAX6675)
|
#define TEMP_0_CS_PIN MAX6675_SS_PIN
|
||||||
#define MAX6675_CS_PIN MAX6675_SS_PIN
|
#elif PIN_EXISTS(MAX6675_CS)
|
||||||
|
#define TEMP_0_CS_PIN MAX6675_CS_PIN
|
||||||
|
#elif PIN_EXISTS(MAX31855_SS)
|
||||||
|
#define TEMP_0_CS_PIN MAX31855_SS_PIN
|
||||||
|
#elif PIN_EXISTS(MAX31855_CS)
|
||||||
|
#define TEMP_0_CS_PIN MAX31855_CS_PIN
|
||||||
|
#elif PIN_EXISTS(MAX31865_SS)
|
||||||
|
#define TEMP_0_CS_PIN MAX31865_SS_PIN
|
||||||
|
#elif PIN_EXISTS(MAX31865_CS)
|
||||||
|
#define TEMP_0_CS_PIN MAX31865_CS_PIN
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if TEMP_SENSOR_0_IS_MAX6675
|
||||||
|
#if !PIN_EXISTS(TEMP_0_MISO) // DO
|
||||||
|
#if PIN_EXISTS(MAX6675_MISO)
|
||||||
|
#define TEMP_0_MISO_PIN MAX6675_MISO_PIN
|
||||||
|
#elif PIN_EXISTS(MAX6675_DO)
|
||||||
|
#define TEMP_0_MISO_PIN MAX6675_DO_PIN
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if !PIN_EXISTS(TEMP_0_SCK) && PIN_EXISTS(MAX6675_SCK)
|
||||||
|
#define TEMP_0_SCK_PIN MAX6675_SCK_PIN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif TEMP_SENSOR_0_IS_MAX31855
|
||||||
|
#if !PIN_EXISTS(TEMP_0_MISO) // DO
|
||||||
|
#if PIN_EXISTS(MAX31855_MISO)
|
||||||
|
#define TEMP_0_MISO_PIN MAX31855_MISO_PIN
|
||||||
|
#elif PIN_EXISTS(MAX31855_DO)
|
||||||
|
#define TEMP_0_MISO_PIN MAX31855_DO_PIN
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if !PIN_EXISTS(TEMP_0_SCK) && PIN_EXISTS(MAX31855_SCK)
|
||||||
|
#define TEMP_0_SCK_PIN MAX31855_SCK_PIN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif TEMP_SENSOR_1_IS_MAX31865
|
||||||
|
#if !PIN_EXISTS(TEMP_1_MISO) // DO
|
||||||
|
#if PIN_EXISTS(MAX31865_MISO)
|
||||||
|
#define TEMP_1_MISO_PIN MAX31865_MISO_PIN
|
||||||
|
#elif PIN_EXISTS(MAX31865_DO)
|
||||||
|
#define TEMP_1_MISO_PIN MAX31865_DO_PIN
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if !PIN_EXISTS(TEMP_1_SCK) && PIN_EXISTS(MAX31865_SCK)
|
||||||
|
#define TEMP_1_SCK_PIN MAX31865_SCK_PIN
|
||||||
|
#endif
|
||||||
|
#if !PIN_EXISTS(TEMP_1_MOSI) && PIN_EXISTS(MAX31865_MOSI) // MOSI for '65 only
|
||||||
|
#define TEMP_1_MOSI_PIN MAX31865_MOSI_PIN
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Software SPI - enable if MISO/SCK are defined.
|
||||||
|
#if PIN_EXISTS(TEMP_0_MISO) && PIN_EXISTS(TEMP_0_SCK) && DISABLED(TEMP_SENSOR_0_FORCE_HW_SPI)
|
||||||
|
#if TEMP_SENSOR_0_IS_MAX31865 && !PIN_EXISTS(TEMP_0_MOSI)
|
||||||
|
#error "TEMP_SENSOR_0 MAX31865 requires TEMP_0_MOSI_PIN defined for Software SPI. To use Hardware SPI instead, undefine MISO/SCK or enable TEMP_SENSOR_0_FORCE_HW_SPI."
|
||||||
|
#else
|
||||||
|
#define TEMP_SENSOR_0_HAS_SPI_PINS 1
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // TEMP_SENSOR_0_IS_MAX_TC
|
||||||
|
|
||||||
|
#if TEMP_SENSOR_1_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 1)
|
||||||
|
|
||||||
|
#if !PIN_EXISTS(TEMP_1_CS) // SS2, CS2
|
||||||
|
#if PIN_EXISTS(MAX6675_SS2)
|
||||||
|
#define TEMP_1_CS_PIN MAX6675_SS2_PIN
|
||||||
|
#elif PIN_EXISTS(MAX6675_CS)
|
||||||
|
#define TEMP_1_CS_PIN MAX6675_CS2_PIN
|
||||||
|
#elif PIN_EXISTS(MAX31855_SS2)
|
||||||
|
#define TEMP_1_CS_PIN MAX31855_SS2_PIN
|
||||||
|
#elif PIN_EXISTS(MAX31855_CS2)
|
||||||
|
#define TEMP_1_CS_PIN MAX31855_CS2_PIN
|
||||||
|
#elif PIN_EXISTS(MAX31865_SS2)
|
||||||
|
#define TEMP_1_CS_PIN MAX31865_SS2_PIN
|
||||||
|
#elif PIN_EXISTS(MAX31865_CS2)
|
||||||
|
#define TEMP_1_CS_PIN MAX31865_CS2_PIN
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if TEMP_SENSOR_1_IS_MAX6675
|
||||||
|
#if !PIN_EXISTS(TEMP_1_MISO) // DO
|
||||||
|
#if PIN_EXISTS(MAX6675_MISO)
|
||||||
|
#define TEMP_1_MISO_PIN MAX6675_MISO_PIN
|
||||||
|
#elif PIN_EXISTS(MAX6675_DO)
|
||||||
|
#define TEMP_1_MISO_PIN MAX6675_DO_PIN
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if !PIN_EXISTS(TEMP_1_SCK) && PIN_EXISTS(MAX6675_SCK)
|
||||||
|
#define TEMP_1_SCK_PIN MAX6675_SCK_PIN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif TEMP_SENSOR_1_IS_MAX31855
|
||||||
|
#if !PIN_EXISTS(TEMP_1_MISO) // DO
|
||||||
|
#if PIN_EXISTS(MAX31855_MISO)
|
||||||
|
#define TEMP_1_MISO_PIN MAX31855_MISO_PIN
|
||||||
|
#elif PIN_EXISTS(MAX31855_DO)
|
||||||
|
#define TEMP_1_MISO_PIN MAX31855_DO_PIN
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if !PIN_EXISTS(TEMP_1_SCK) && PIN_EXISTS(MAX31855_SCK)
|
||||||
|
#define TEMP_1_SCK_PIN MAX31855_SCK_PIN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif TEMP_SENSOR_1_IS_MAX31865
|
||||||
|
#if !PIN_EXISTS(TEMP_1_MISO) // DO
|
||||||
|
#if PIN_EXISTS(MAX31865_MISO)
|
||||||
|
#define TEMP_1_MISO_PIN MAX31865_MISO_PIN
|
||||||
|
#elif PIN_EXISTS(MAX31865_DO)
|
||||||
|
#define TEMP_1_MISO_PIN MAX31865_DO_PIN
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if !PIN_EXISTS(TEMP_1_SCK) && PIN_EXISTS(MAX31865_SCK)
|
||||||
|
#define TEMP_1_SCK_PIN MAX31865_SCK_PIN
|
||||||
|
#endif
|
||||||
|
#if !PIN_EXISTS(TEMP_1_MOSI) && PIN_EXISTS(MAX31865_MOSI) // MOSI for '65 only
|
||||||
|
#define TEMP_1_MOSI_PIN MAX31865_MOSI_PIN
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Software SPI - enable if MISO/SCK are defined.
|
||||||
|
#if PIN_EXISTS(TEMP_1_MISO) && PIN_EXISTS(TEMP_1_SCK) && DISABLED(TEMP_SENSOR_1_FORCE_HW_SPI)
|
||||||
|
#if TEMP_SENSOR_1_IS_MAX31865 && !PIN_EXISTS(TEMP_1_MOSI)
|
||||||
|
#error "TEMP_SENSOR_1 MAX31865 requires TEMP_1_MOSI_PIN defined for Software SPI. To use Hardware SPI instead, undefine MISO/SCK or enable TEMP_SENSOR_1_FORCE_HW_SPI."
|
||||||
|
#else
|
||||||
|
#define TEMP_SENSOR_1_HAS_SPI_PINS 1
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // TEMP_SENSOR_1_IS_MAX_TC
|
||||||
|
|
||||||
|
//
|
||||||
|
// 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
|
#endif
|
||||||
#endif
|
#if BOTH(HAS_MAX31855, LIB_MAX31855)
|
||||||
|
#define LIB_USR_MAX31855 1
|
||||||
#if PIN_EXISTS(MAX6675_SS2)
|
|
||||||
#if TEMP_SENSOR_IS_MAX(1, MAX31855)
|
|
||||||
#define MAX31855_CS2_PIN MAX6675_SS2_PIN
|
|
||||||
#elif TEMP_SENSOR_IS_MAX(1, MAX31865)
|
|
||||||
#define MAX31865_CS2_PIN MAX6675_SS2_PIN
|
|
||||||
#elif TEMP_SENSOR_IS_MAX(1, MAX6675)
|
|
||||||
#define MAX6675_CS2_PIN MAX6675_SS2_PIN
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#if BOTH(HAS_MAX31865, LIB_MAX31865)
|
||||||
|
|
||||||
#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
|
#define LIB_USR_MAX31865 1
|
||||||
#else
|
#elif HAS_MAX31865
|
||||||
#define LIB_ADAFRUIT_MAX31865 1
|
#define LIB_INTERNAL_MAX31865 1
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
#endif //HAS_MAX_TC
|
||||||
|
|
||||||
#if TEMP_SENSOR_2 == -4
|
#if TEMP_SENSOR_2 == -4
|
||||||
#define TEMP_SENSOR_2_IS_AD8495 1
|
#define TEMP_SENSOR_2_IS_AD8495 1
|
||||||
|
@ -2722,6 +2817,77 @@
|
||||||
#define BED_OR_CHAMBER_OR_FAN 1
|
#define BED_OR_CHAMBER_OR_FAN 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Up to 3 PWM fans
|
||||||
|
*/
|
||||||
|
#ifndef FAN_INVERTING
|
||||||
|
#define FAN_INVERTING false
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAS_FAN7
|
||||||
|
#define FAN_COUNT 8
|
||||||
|
#elif HAS_FAN6
|
||||||
|
#define FAN_COUNT 7
|
||||||
|
#elif HAS_FAN5
|
||||||
|
#define FAN_COUNT 6
|
||||||
|
#elif HAS_FAN4
|
||||||
|
#define FAN_COUNT 5
|
||||||
|
#elif HAS_FAN3
|
||||||
|
#define FAN_COUNT 4
|
||||||
|
#elif HAS_FAN2
|
||||||
|
#define FAN_COUNT 3
|
||||||
|
#elif HAS_FAN1
|
||||||
|
#define FAN_COUNT 2
|
||||||
|
#elif HAS_FAN0
|
||||||
|
#define FAN_COUNT 1
|
||||||
|
#else
|
||||||
|
#define FAN_COUNT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if FAN_COUNT > 0
|
||||||
|
#define HAS_FAN 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Part Cooling fan multipliexer
|
||||||
|
*/
|
||||||
|
#if PIN_EXISTS(FANMUX0)
|
||||||
|
#define HAS_FANMUX 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MIN/MAX fan PWM scaling
|
||||||
|
*/
|
||||||
|
#ifndef FAN_OFF_PWM
|
||||||
|
#define FAN_OFF_PWM 0
|
||||||
|
#endif
|
||||||
|
#ifndef FAN_MIN_PWM
|
||||||
|
#if FAN_OFF_PWM > 0
|
||||||
|
#define FAN_MIN_PWM (FAN_OFF_PWM + 1)
|
||||||
|
#else
|
||||||
|
#define FAN_MIN_PWM 0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifndef FAN_MAX_PWM
|
||||||
|
#define FAN_MAX_PWM 255
|
||||||
|
#endif
|
||||||
|
#if FAN_MIN_PWM < 0 || FAN_MIN_PWM > 255
|
||||||
|
#error "FAN_MIN_PWM must be a value from 0 to 255."
|
||||||
|
#elif FAN_MAX_PWM < 0 || FAN_MAX_PWM > 255
|
||||||
|
#error "FAN_MAX_PWM must be a value from 0 to 255."
|
||||||
|
#elif FAN_MIN_PWM > FAN_MAX_PWM
|
||||||
|
#error "FAN_MIN_PWM must be less than or equal to FAN_MAX_PWM."
|
||||||
|
#elif FAN_OFF_PWM > FAN_MIN_PWM
|
||||||
|
#error "FAN_OFF_PWM must be less than or equal to FAN_MIN_PWM."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FAST PWM FAN Settings
|
||||||
|
*/
|
||||||
|
#if ENABLED(FAST_PWM_FAN) && !defined(FAST_PWM_FAN_FREQUENCY)
|
||||||
|
#define FAST_PWM_FAN_FREQUENCY ((F_CPU) / (2 * 255 * 1)) // Fan frequency default
|
||||||
|
#endif
|
||||||
|
|
||||||
// Servos
|
// Servos
|
||||||
#if PIN_EXISTS(SERVO0) && NUM_SERVOS > 0
|
#if PIN_EXISTS(SERVO0) && NUM_SERVOS > 0
|
||||||
#define HAS_SERVO_0 1
|
#define HAS_SERVO_0 1
|
||||||
|
@ -2996,77 +3162,6 @@
|
||||||
#undef PREHEAT_SHORTCUT_MENU_ITEM
|
#undef PREHEAT_SHORTCUT_MENU_ITEM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* Up to 3 PWM fans
|
|
||||||
*/
|
|
||||||
#ifndef FAN_INVERTING
|
|
||||||
#define FAN_INVERTING false
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAS_FAN7
|
|
||||||
#define FAN_COUNT 8
|
|
||||||
#elif HAS_FAN6
|
|
||||||
#define FAN_COUNT 7
|
|
||||||
#elif HAS_FAN5
|
|
||||||
#define FAN_COUNT 6
|
|
||||||
#elif HAS_FAN4
|
|
||||||
#define FAN_COUNT 5
|
|
||||||
#elif HAS_FAN3
|
|
||||||
#define FAN_COUNT 4
|
|
||||||
#elif HAS_FAN2
|
|
||||||
#define FAN_COUNT 3
|
|
||||||
#elif HAS_FAN1
|
|
||||||
#define FAN_COUNT 2
|
|
||||||
#elif HAS_FAN0
|
|
||||||
#define FAN_COUNT 1
|
|
||||||
#else
|
|
||||||
#define FAN_COUNT 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if FAN_COUNT > 0
|
|
||||||
#define HAS_FAN 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Part Cooling fan multipliexer
|
|
||||||
*/
|
|
||||||
#if PIN_EXISTS(FANMUX0)
|
|
||||||
#define HAS_FANMUX 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MIN/MAX fan PWM scaling
|
|
||||||
*/
|
|
||||||
#ifndef FAN_OFF_PWM
|
|
||||||
#define FAN_OFF_PWM 0
|
|
||||||
#endif
|
|
||||||
#ifndef FAN_MIN_PWM
|
|
||||||
#if FAN_OFF_PWM > 0
|
|
||||||
#define FAN_MIN_PWM (FAN_OFF_PWM + 1)
|
|
||||||
#else
|
|
||||||
#define FAN_MIN_PWM 0
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#ifndef FAN_MAX_PWM
|
|
||||||
#define FAN_MAX_PWM 255
|
|
||||||
#endif
|
|
||||||
#if FAN_MIN_PWM < 0 || FAN_MIN_PWM > 255
|
|
||||||
#error "FAN_MIN_PWM must be a value from 0 to 255."
|
|
||||||
#elif FAN_MAX_PWM < 0 || FAN_MAX_PWM > 255
|
|
||||||
#error "FAN_MAX_PWM must be a value from 0 to 255."
|
|
||||||
#elif FAN_MIN_PWM > FAN_MAX_PWM
|
|
||||||
#error "FAN_MIN_PWM must be less than or equal to FAN_MAX_PWM."
|
|
||||||
#elif FAN_OFF_PWM > FAN_MIN_PWM
|
|
||||||
#error "FAN_OFF_PWM must be less than or equal to FAN_MIN_PWM."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* FAST PWM FAN Settings
|
|
||||||
*/
|
|
||||||
#if ENABLED(FAST_PWM_FAN) && !defined(FAST_PWM_FAN_FREQUENCY)
|
|
||||||
#define FAST_PWM_FAN_FREQUENCY ((F_CPU) / (2 * 255 * 1)) // Fan frequency default
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MIN/MAX case light PWM scaling
|
* MIN/MAX case light PWM scaling
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -416,8 +416,19 @@
|
||||||
#error "MBL_Z_STEP is now MESH_EDIT_Z_STEP."
|
#error "MBL_Z_STEP is now MESH_EDIT_Z_STEP."
|
||||||
#elif defined(CHDK)
|
#elif defined(CHDK)
|
||||||
#error "CHDK is now CHDK_PIN."
|
#error "CHDK is now CHDK_PIN."
|
||||||
#elif defined(MAX6675_SS) || defined(MAX6675_SS2)
|
#elif ANY_PIN( \
|
||||||
#error "MAX6675_SS / MAX6675_SS2 is now MAX6675_SS_PIN / MAX6675_SS2_PIN."
|
MAX6675_SS, MAX6675_SS2, MAX6675_CS, MAX6675_CS2, \
|
||||||
|
MAX31855_SS, MAX31855_SS2, MAX31855_CS, MAX31855_CS2, \
|
||||||
|
MAX31865_SS, MAX31865_SS2, MAX31865_CS, MAX31865_CS2)
|
||||||
|
#warning "MAX*_SS_PIN, MAX*_SS2_PIN, MAX*_CS_PIN, and MAX*_CS2_PIN are deprecated and will be removed in a future version. Please use TEMP_0_CS_PIN/TEMP_1_CS_PIN instead."
|
||||||
|
#elif ANY_PIN(MAX6675_SCK, MAX31855_SCK, MAX31865_SCK)
|
||||||
|
#warning "MAX*_SCK_PIN is deprecated and will be removed in a future version. Please use TEMP_0_SCK_PIN/TEMP_1_SCK_PIN instead."
|
||||||
|
#elif ANY_PIN(MAX6675_MISO, MAX6675_DO, MAX31855_MISO, MAX31855_DO, MAX31865_MISO, MAX31865_DO)
|
||||||
|
#warning "MAX*_MISO_PIN and MAX*_DO_PIN are deprecated and will be removed in a future version. Please use TEMP_0_MISO_PIN/TEMP_1_MISO_PIN instead."
|
||||||
|
#elif PIN_EXISTS(MAX31865_MOSI)
|
||||||
|
#warning "MAX31865_MOSI_PIN is deprecated and will be removed in a future version. Please use TEMP_0_MOSI_PIN/TEMP_1_MOSI_PIN instead."
|
||||||
|
#elif ANY_PIN(THERMO_CS1_PIN, THERMO_CS2_PIN, THERMO_DO_PIN, THERMO_SCK_PIN)
|
||||||
|
#error "THERMO_*_PIN is now TEMP_n_CS_PIN, TEMP_n_SCK_PIN, TEMP_n_MOSI_PIN, TEMP_n_MISO_PIN."
|
||||||
#elif defined(MAX31865_SENSOR_OHMS)
|
#elif defined(MAX31865_SENSOR_OHMS)
|
||||||
#error "MAX31865_SENSOR_OHMS is now MAX31865_SENSOR_OHMS_0."
|
#error "MAX31865_SENSOR_OHMS is now MAX31865_SENSOR_OHMS_0."
|
||||||
#elif defined(MAX31865_CALIBRATION_OHMS)
|
#elif defined(MAX31865_CALIBRATION_OHMS)
|
||||||
|
@ -1953,14 +1964,21 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pins and Sensor IDs must be set for each heater
|
* Required MAX31865 settings
|
||||||
*/
|
*/
|
||||||
#if TEMP_SENSOR_0_IS_MAX6675 && !ANY_PIN(MAX6675_SS, MAX31855_CS, MAX31865_CS, MAX6675_CS)
|
#if TEMP_SENSOR_0_IS_MAX31865 || (TEMP_SENSOR_REDUNDANT_IS_MAX31865 && TEMP_SENSOR_REDUNDANT_SOURCE == 0)
|
||||||
#error "TEMP_SENSOR_0 -2 requires a MAX6675_SS_PIN, MAX6675_CS_PIN, MAX31855_CS_PIN, or MAX31865_CS_PIN."
|
#if !defined(MAX31865_SENSOR_WIRES_0) || !WITHIN(MAX31865_SENSOR_WIRES_0, 2, 4)
|
||||||
#elif HAS_HOTEND && !HAS_TEMP_HOTEND && !TEMP_SENSOR_0_IS_DUMMY
|
#error "MAX31865_SENSOR_WIRES_0 must be defined as an integer between 2 and 4."
|
||||||
#error "TEMP_0_PIN (required for TEMP_SENSOR_0) not defined for this board."
|
#elif !defined(MAX31865_SENSOR_OHMS_0) || !defined(MAX31865_CALIBRATION_OHMS_0)
|
||||||
#elif EITHER(HAS_MULTI_HOTEND, HEATERS_PARALLEL) && !HAS_HEATER_1
|
#error "MAX31865_SENSOR_OHMS_0 and MAX31865_CALIBRATION_OHMS_0 must be set if TEMP_SENSOR_0/TEMP_SENSOR_REDUNDANT is MAX31865."
|
||||||
#error "HEATER_1_PIN is not defined. TEMP_SENSOR_1 might not be set, or the board (not EEB / EEF?) doesn't define a pin."
|
#endif
|
||||||
|
#endif
|
||||||
|
#if TEMP_SENSOR_1_IS_MAX31865 || (TEMP_SENSOR_REDUNDANT_IS_MAX31865 && TEMP_SENSOR_REDUNDANT_SOURCE == 1)
|
||||||
|
#if !defined(MAX31865_SENSOR_WIRES_1) || !WITHIN(MAX31865_SENSOR_WIRES_1, 2, 4)
|
||||||
|
#error "MAX31865_SENSOR_WIRES_1 must be defined as an integer between 2 and 4."
|
||||||
|
#elif !defined(MAX31865_SENSOR_OHMS_1) || !defined(MAX31865_CALIBRATION_OHMS_1)
|
||||||
|
#error "MAX31865_SENSOR_OHMS_1 and MAX31865_CALIBRATION_OHMS_1 must be set if TEMP_SENSOR_1/TEMP_SENSOR_REDUNDANT is MAX31865."
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2023,20 +2041,36 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||||
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be Cooler (-5): requires TEMP_COOLER_PIN"
|
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be Cooler (-5): requires TEMP_COOLER_PIN"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 0 && !PIN_EXISTS(MAX6675_SS)
|
#if TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 0 && !PIN_EXISTS(TEMP_0_CS)
|
||||||
#error "TEMP_SENSOR_REDUNDANT MAX Thermocouple with TEMP_SENSOR_REDUNDANT_SOURCE 0 requires a MAX6675_SS_PIN, MAX6675_CS_PIN, MAX31855_CS_PIN, or MAX31865_CS_PIN."
|
#error "TEMP_SENSOR_REDUNDANT MAX Thermocouple with TEMP_SENSOR_REDUNDANT_SOURCE 0 requires TEMP_0_CS_PIN."
|
||||||
#elif TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 1 && !PIN_EXISTS(MAX6675_SS2)
|
#elif TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 1 && !PIN_EXISTS(TEMP_1_CS)
|
||||||
#error "TEMP_SENSOR_REDUNDANT MAX Thermocouple with TEMP_SENSOR_REDUNDANT_SOURCE 1 requires a MAX6675_SS2_PIN, MAX6675_CS_PIN, MAX31855_CS_PIN, or MAX31865_CS_PIN."
|
#error "TEMP_SENSOR_REDUNDANT MAX Thermocouple with TEMP_SENSOR_REDUNDANT_SOURCE 1 requires TEMP_1_CS_PIN."
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test Sensor & Heater pin combos.
|
||||||
|
* Pins and Sensor IDs must be set for each heater
|
||||||
|
*/
|
||||||
|
#if !ANY_PIN(TEMP_0, TEMP_0_CS)
|
||||||
|
#error "TEMP_0_PIN or TEMP_0_CS_PIN not defined for this board."
|
||||||
|
#elif !HAS_HEATER_0 && EXTRUDERS
|
||||||
|
#error "HEATER_0_PIN not defined for this board."
|
||||||
|
#elif TEMP_SENSOR_0_IS_MAX_TC && !PIN_EXISTS(TEMP_0_CS)
|
||||||
|
#error "TEMP_SENSOR_0 MAX thermocouple requires TEMP_0_CS_PIN."
|
||||||
|
#elif HAS_HOTEND && !HAS_TEMP_HOTEND && !TEMP_SENSOR_0_IS_DUMMY
|
||||||
|
#error "TEMP_0_PIN (required for TEMP_SENSOR_0) not defined for this board."
|
||||||
|
#elif EITHER(HAS_MULTI_HOTEND, HEATERS_PARALLEL) && !HAS_HEATER_1
|
||||||
|
#error "HEATER_1_PIN is not defined. TEMP_SENSOR_1 might not be set, or the board (not EEB / EEF?) doesn't define a pin."
|
||||||
|
#endif
|
||||||
|
|
||||||
#if HAS_MULTI_HOTEND
|
#if HAS_MULTI_HOTEND
|
||||||
#if TEMP_SENSOR_1_IS_MAX6675 && !ANY_PIN(MAX6675_SS2, MAX31855_CS2, MAX31865_CS2, MAX6675_CS2)
|
#if TEMP_SENSOR_1_IS_MAX_TC && !PIN_EXISTS(TEMP_1_CS)
|
||||||
#error "TEMP_SENSOR_1 requires a MAX6675_SS2_PIN, MAX6675_CS2_PIN, MAX31855_CS2_PIN, or MAX31865_CS2_PIN."
|
#error "TEMP_SENSOR_1 MAX thermocouple requires TEMP_1_CS_PIN."
|
||||||
#elif TEMP_SENSOR_1 == 0
|
#elif TEMP_SENSOR_1 == 0
|
||||||
#error "TEMP_SENSOR_1 is required with 2 or more HOTENDS."
|
#error "TEMP_SENSOR_1 is required with 2 or more HOTENDS."
|
||||||
#elif !ANY_PIN(TEMP_1, MAX6675_SS2) && !TEMP_SENSOR_1_IS_DUMMY
|
#elif !ANY_PIN(TEMP_1, TEMP_1_CS) && !TEMP_SENSOR_1_IS_DUMMY
|
||||||
#error "TEMP_1_PIN or MAX6675_SS2_PIN not defined for this board."
|
#error "TEMP_1_PIN or TEMP_1_CS_PIN not defined for this board."
|
||||||
#endif
|
#endif
|
||||||
#if HOTENDS > 2
|
#if HOTENDS > 2
|
||||||
#if TEMP_SENSOR_2 == 0
|
#if TEMP_SENSOR_2 == 0
|
||||||
|
@ -2148,14 +2182,31 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||||
#error "TEMP_SENSOR_6 shouldn't be set with only 1 HOTEND."
|
#error "TEMP_SENSOR_6 shouldn't be set with only 1 HOTEND."
|
||||||
#elif TEMP_SENSOR_7 != 0
|
#elif TEMP_SENSOR_7 != 0
|
||||||
#error "TEMP_SENSOR_7 shouldn't be set with only 1 HOTEND."
|
#error "TEMP_SENSOR_7 shouldn't be set with only 1 HOTEND."
|
||||||
#endif
|
#endif // HAS_MULTI_HOTEND
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pins must be set for temp sensors, with some other feature requirements.
|
||||||
|
*/
|
||||||
#if TEMP_SENSOR_CHAMBER && !PIN_EXISTS(TEMP_CHAMBER)
|
#if TEMP_SENSOR_CHAMBER && !PIN_EXISTS(TEMP_CHAMBER)
|
||||||
#error "TEMP_SENSOR_CHAMBER requires TEMP_CHAMBER_PIN."
|
#error "TEMP_SENSOR_CHAMBER requires TEMP_CHAMBER_PIN."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TEMP_SENSOR_COOLER && !(PIN_EXISTS(TEMP_COOLER) && ENABLED(LASER_FEATURE))
|
#if TEMP_SENSOR_COOLER
|
||||||
#error "TEMP_SENSOR_COOLER requires LASER_FEATURE and TEMP_COOLER_PIN."
|
#if !PIN_EXISTS(TEMP_COOLER)
|
||||||
|
#error "TEMP_SENSOR_COOLER requires TEMP_COOLER_PIN."
|
||||||
|
#elif DISABLED(LASER_FEATURE)
|
||||||
|
#error "TEMP_SENSOR_COOLER requires LASER_FEATURE."
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if TEMP_SENSOR_PROBE
|
||||||
|
#if !PIN_EXISTS(TEMP_PROBE)
|
||||||
|
#error "TEMP_SENSOR_PROBE requires TEMP_PROBE_PIN."
|
||||||
|
#elif !HAS_TEMP_ADC_PROBE
|
||||||
|
#error "TEMP_PROBE_PIN must be an ADC pin."
|
||||||
|
#elif DISABLED(FIX_MOUNTED_PROBE)
|
||||||
|
#error "TEMP_SENSOR_PROBE shouldn't be set without FIX_MOUNTED_PROBE."
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(LASER_COOLANT_FLOW_METER) && !(PIN_EXISTS(FLOWMETER) && ENABLED(LASER_FEATURE))
|
#if ENABLED(LASER_COOLANT_FLOW_METER) && !(PIN_EXISTS(FLOWMETER) && ENABLED(LASER_FEATURE))
|
||||||
|
@ -2186,41 +2237,6 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TEMP_SENSOR_PROBE
|
|
||||||
#if !PIN_EXISTS(TEMP_PROBE)
|
|
||||||
#error "TEMP_SENSOR_PROBE requires TEMP_PROBE_PIN."
|
|
||||||
#elif !HAS_TEMP_ADC_PROBE
|
|
||||||
#error "TEMP_PROBE_PIN must be an ADC pin."
|
|
||||||
#elif DISABLED(FIX_MOUNTED_PROBE)
|
|
||||||
#error "TEMP_SENSOR_PROBE shouldn't be set without FIX_MOUNTED_PROBE."
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if TEMP_SENSOR_IS_MAX(0, MAX31865) && !(defined(MAX31865_SENSOR_OHMS_0) && defined(MAX31865_CALIBRATION_OHMS_0))
|
|
||||||
#error "MAX31865_SENSOR_OHMS_0 and MAX31865_CALIBRATION_OHMS_0 must be set if TEMP_SENSOR_0/TEMP_SENSOR_REDUNDANT is MAX31865."
|
|
||||||
#elif TEMP_SENSOR_IS_MAX(1, MAX31865) && !(defined(MAX31865_SENSOR_OHMS_1) && defined(MAX31865_CALIBRATION_OHMS_1))
|
|
||||||
#error "MAX31865_SENSOR_OHMS_1 and MAX31865_CALIBRATION_OHMS_1 must be set if TEMP_SENSOR_1/TEMP_SENSOR_REDUNDANT is MAX31865."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test Heater, Temp Sensor, and Extruder Pins
|
|
||||||
*/
|
|
||||||
#if !HAS_HEATER_0 && EXTRUDERS
|
|
||||||
#error "HEATER_0_PIN not defined for this board."
|
|
||||||
#elif !ANY_PIN(TEMP_0, MAX6675_SS)
|
|
||||||
#error "TEMP_0_PIN or MAX6675_SS not defined for this board."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAS_EXTRUDERS
|
|
||||||
#if ((defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && !PINS_EXIST(E0_STEP, E0_DIR))
|
|
||||||
#error "E0_STEP_PIN or E0_DIR_PIN not defined for this board."
|
|
||||||
#elif ( !(defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && (!PINS_EXIST(E0_STEP, E0_DIR) || !HAS_E0_ENABLE))
|
|
||||||
#error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board."
|
|
||||||
#elif EXTRUDERS && TEMP_SENSOR_0 == 0
|
|
||||||
#error "TEMP_SENSOR_0 is required if there are any extruders."
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Temperature status LEDs
|
* Temperature status LEDs
|
||||||
*/
|
*/
|
||||||
|
@ -2262,6 +2278,16 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||||
/**
|
/**
|
||||||
* Test Extruder Stepper Pins
|
* Test Extruder Stepper Pins
|
||||||
*/
|
*/
|
||||||
|
#if HAS_EXTRUDERS
|
||||||
|
#if ((defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && !PINS_EXIST(E0_STEP, E0_DIR))
|
||||||
|
#error "E0_STEP_PIN or E0_DIR_PIN not defined for this board."
|
||||||
|
#elif ( !(defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && (!PINS_EXIST(E0_STEP, E0_DIR) || !HAS_E0_ENABLE))
|
||||||
|
#error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board."
|
||||||
|
#elif EXTRUDERS && TEMP_SENSOR_0 == 0
|
||||||
|
#error "TEMP_SENSOR_0 is required if there are any extruders."
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if E_STEPPERS
|
#if E_STEPPERS
|
||||||
#if !(PINS_EXIST(E0_STEP, E0_DIR) && HAS_E0_ENABLE)
|
#if !(PINS_EXIST(E0_STEP, E0_DIR) && HAS_E0_ENABLE)
|
||||||
#error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board."
|
#error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board."
|
||||||
|
|
500
Marlin/src/libs/MAX31865.cpp
Normal file
500
Marlin/src/libs/MAX31865.cpp
Normal file
|
@ -0,0 +1,500 @@
|
||||||
|
/**
|
||||||
|
* Marlin 3D Printer Firmware
|
||||||
|
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
|
*
|
||||||
|
* Based on Sprinter and grbl.
|
||||||
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Based on Based on Adafruit MAX31865 library:
|
||||||
|
*
|
||||||
|
* This is a library for the Adafruit PT100/P1000 RTD Sensor w/MAX31865
|
||||||
|
* Designed specifically to work with the Adafruit RTD Sensor
|
||||||
|
* https://www.adafruit.com/products/3328
|
||||||
|
*
|
||||||
|
* This sensor uses SPI to communicate, 4 pins are required to interface.
|
||||||
|
*
|
||||||
|
* Adafruit invests time and resources providing this open source code,
|
||||||
|
* please support Adafruit and open-source hardware by purchasing
|
||||||
|
* products from Adafruit!
|
||||||
|
*
|
||||||
|
* Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||||
|
*
|
||||||
|
* Modifications by JoAnn Manges (@GadgetAngel)
|
||||||
|
* Copyright (c) 2020, JoAnn Manges
|
||||||
|
* All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Useful for RTD debugging.
|
||||||
|
//#define MAX31865_DEBUG
|
||||||
|
//#define MAX31865_DEBUG_SPI
|
||||||
|
|
||||||
|
//TODO: switch to SPIclass/SoftSPI
|
||||||
|
|
||||||
|
#include "../inc/MarlinConfig.h"
|
||||||
|
|
||||||
|
#if HAS_MAX31865 && !LIB_USR_MAX31865
|
||||||
|
|
||||||
|
#include "MAX31865.h"
|
||||||
|
|
||||||
|
// The maximum speed the MAX31865 can do is 5 MHz
|
||||||
|
SPISettings MAX31865::spiConfig = SPISettings(
|
||||||
|
#if defined(TARGET_LPC1768)
|
||||||
|
SPI_QUARTER_SPEED
|
||||||
|
#elif defined(ARDUINO_ARCH_STM32)
|
||||||
|
SPI_CLOCK_DIV4
|
||||||
|
#else
|
||||||
|
500000
|
||||||
|
#endif
|
||||||
|
, MSBFIRST
|
||||||
|
, SPI_MODE_1 // CPOL0 CPHA1
|
||||||
|
);
|
||||||
|
|
||||||
|
#ifndef LARGE_PINMAP
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the interface object using software (bitbang) SPI for PIN values
|
||||||
|
* less than or equal to 127.
|
||||||
|
*
|
||||||
|
* @param spi_cs the SPI CS pin to use
|
||||||
|
* @param spi_mosi the SPI MOSI pin to use
|
||||||
|
* @param spi_miso the SPI MISO pin to use
|
||||||
|
* @param spi_clk the SPI clock pin to use
|
||||||
|
*/
|
||||||
|
MAX31865::MAX31865(int8_t spi_cs, int8_t spi_mosi, int8_t spi_miso, int8_t spi_clk) {
|
||||||
|
_cs = spi_cs;
|
||||||
|
_mosi = spi_mosi;
|
||||||
|
_miso = spi_miso;
|
||||||
|
_sclk = spi_clk;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the interface object using hardware SPI for PIN for PIN values less
|
||||||
|
* than or equal to 127.
|
||||||
|
*
|
||||||
|
* @param spi_cs the SPI CS pin to use along with the default SPI device
|
||||||
|
*/
|
||||||
|
MAX31865::MAX31865(int8_t spi_cs) {
|
||||||
|
_cs = spi_cs;
|
||||||
|
_sclk = _miso = _mosi = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the interface object using software (bitbang) SPI for PIN values
|
||||||
|
* which are larger than 127. If you have PIN values less than or equal to
|
||||||
|
* 127 use the other call for SW SPI.
|
||||||
|
*
|
||||||
|
* @param spi_cs the SPI CS pin to use
|
||||||
|
* @param spi_mosi the SPI MOSI pin to use
|
||||||
|
* @param spi_miso the SPI MISO pin to use
|
||||||
|
* @param spi_clk the SPI clock pin to use
|
||||||
|
* @param pin_mapping set to 1 for positive pin values
|
||||||
|
*/
|
||||||
|
MAX31865::MAX31865(uint32_t spi_cs, uint32_t spi_mosi,
|
||||||
|
uint32_t spi_miso, uint32_t spi_clk,
|
||||||
|
uint8_t pin_mapping) {
|
||||||
|
_cs = spi_cs;
|
||||||
|
_mosi = spi_mosi;
|
||||||
|
_miso = spi_miso;
|
||||||
|
_sclk = spi_clk;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the interface object using hardware SPI for PIN values which are
|
||||||
|
* larger than 127. If you have PIN values less than or equal to 127 use
|
||||||
|
* the other call for HW SPI.
|
||||||
|
*
|
||||||
|
* @param spi_cs the SPI CS pin to use along with the default SPI device
|
||||||
|
* @param pin_mapping set to 1 for positive pin values
|
||||||
|
*/
|
||||||
|
MAX31865::MAX31865(uint32_t spi_cs, uint8_t pin_mapping) {
|
||||||
|
_cs = spi_cs;
|
||||||
|
_sclk = _miso = _mosi = -1UL; //-1UL or 0xFFFFFFFF or 4294967295
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // LARGE_PINMAP
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Instance & Class methods
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the SPI interface and set the number of RTD wires used
|
||||||
|
*
|
||||||
|
* @param wires The number of wires in enum format. Can be MAX31865_2WIRE, MAX31865_3WIRE, or MAX31865_4WIRE.
|
||||||
|
* @param zero The resistance of the RTD at 0 degC, in ohms.
|
||||||
|
* @param ref The resistance of the reference resistor, in ohms.
|
||||||
|
*/
|
||||||
|
void MAX31865::begin(max31865_numwires_t wires, float zero, float ref) {
|
||||||
|
Rzero = zero;
|
||||||
|
Rref = ref;
|
||||||
|
|
||||||
|
OUT_WRITE(_cs, HIGH);
|
||||||
|
|
||||||
|
if (_sclk != TERN(LARGE_PINMAP, -1UL, -1)) {
|
||||||
|
// define pin modes for Software SPI
|
||||||
|
#ifdef MAX31865_DEBUG
|
||||||
|
SERIAL_ECHOLN("Initializing MAX31865 Software SPI");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
OUT_WRITE(_sclk, LOW);
|
||||||
|
SET_OUTPUT(_mosi);
|
||||||
|
SET_INPUT(_miso);
|
||||||
|
} else {
|
||||||
|
// start and configure hardware SPI
|
||||||
|
#ifdef MAX31865_DEBUG
|
||||||
|
SERIAL_ECHOLN("Initializing MAX31865 Hardware SPI");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
SPI.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
setWires(wires);
|
||||||
|
enableBias(false);
|
||||||
|
autoConvert(false);
|
||||||
|
clearFault();
|
||||||
|
|
||||||
|
#ifdef MAX31865_DEBUG_SPI
|
||||||
|
#ifndef LARGE_PINMAP
|
||||||
|
SERIAL_ECHOLNPAIR(
|
||||||
|
"Regular begin call with _cs: ", _cs,
|
||||||
|
" _miso: ", _miso,
|
||||||
|
" _sclk: ", _sclk,
|
||||||
|
" _mosi: ", _mosi
|
||||||
|
);
|
||||||
|
#else
|
||||||
|
SERIAL_ECHOLNPAIR(
|
||||||
|
"LARGE_PINMAP begin call with _cs: ", _cs,
|
||||||
|
" _miso: ", _miso,
|
||||||
|
" _sclk: ", _sclk,
|
||||||
|
" _mosi: ", _mosi
|
||||||
|
);
|
||||||
|
#endif // LARGE_PINMAP
|
||||||
|
|
||||||
|
SERIAL_ECHOLNPAIR("config: ", readRegister8(MAX31856_CONFIG_REG));
|
||||||
|
SERIAL_EOL();
|
||||||
|
#endif // MAX31865_DEBUG_SPI
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the raw 8-bit FAULTSTAT register
|
||||||
|
*
|
||||||
|
* @return The raw unsigned 8-bit FAULT status register
|
||||||
|
*/
|
||||||
|
uint8_t MAX31865::readFault() {
|
||||||
|
return readRegister8(MAX31856_FAULTSTAT_REG);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear all faults in FAULTSTAT.
|
||||||
|
*/
|
||||||
|
void MAX31865::clearFault() {
|
||||||
|
setConfig(MAX31856_CONFIG_FAULTSTAT, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether we want to have continuous conversions (50/60 Hz)
|
||||||
|
*
|
||||||
|
* @param b If true, auto conversion is enabled
|
||||||
|
*/
|
||||||
|
void MAX31865::autoConvert(bool b) {
|
||||||
|
setConfig(MAX31856_CONFIG_MODEAUTO, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether we want filter out 50Hz noise or 60Hz noise
|
||||||
|
*
|
||||||
|
* @param b If true, 50Hz noise is filtered, else 60Hz(default)
|
||||||
|
*/
|
||||||
|
void MAX31865::enable50HzFilter(bool b) {
|
||||||
|
setConfig(MAX31856_CONFIG_FILT50HZ, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable the bias voltage on the RTD sensor
|
||||||
|
*
|
||||||
|
* @param b If true bias is enabled, else disabled
|
||||||
|
*/
|
||||||
|
void MAX31865::enableBias(bool b) {
|
||||||
|
setConfig(MAX31856_CONFIG_BIAS, b);
|
||||||
|
|
||||||
|
// From the datasheet:
|
||||||
|
// Note that if VBIAS is off (to reduce supply current between conversions), any filter
|
||||||
|
// capacitors at the RTDIN inputs need to charge before an accurate conversion can be
|
||||||
|
// performed. Therefore, enable VBIAS and wait at least 10.5 time constants of the input
|
||||||
|
// RC network plus an additional 1ms before initiating the conversion.
|
||||||
|
if (b)
|
||||||
|
DELAY_US(11500); //11.5ms
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start a one-shot temperature reading.
|
||||||
|
*/
|
||||||
|
void MAX31865::oneShot() {
|
||||||
|
setConfig(MAX31856_CONFIG_1SHOT, 1);
|
||||||
|
|
||||||
|
// From the datasheet:
|
||||||
|
// Note that a single conversion requires approximately 52ms in 60Hz filter
|
||||||
|
// mode or 62.5ms in 50Hz filter mode to complete. 1-Shot is a self-clearing bit.
|
||||||
|
// TODO: switch this out depeding on the filter mode.
|
||||||
|
DELAY_US(65000); // 65ms
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* How many wires we have in our RTD setup, can be MAX31865_2WIRE,
|
||||||
|
* MAX31865_3WIRE, or MAX31865_4WIRE
|
||||||
|
*
|
||||||
|
* @param wires The number of wires in enum format
|
||||||
|
*/
|
||||||
|
void MAX31865::setWires(max31865_numwires_t wires) {
|
||||||
|
uint8_t t = readRegister8(MAX31856_CONFIG_REG);
|
||||||
|
if (wires == MAX31865_3WIRE)
|
||||||
|
t |= MAX31856_CONFIG_3WIRE;
|
||||||
|
else // 2 or 4 wire
|
||||||
|
t &= ~MAX31856_CONFIG_3WIRE;
|
||||||
|
writeRegister8(MAX31856_CONFIG_REG, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the raw 16-bit value from the RTD_REG in one shot mode. This will include
|
||||||
|
* the fault bit, D0.
|
||||||
|
*
|
||||||
|
* @return The raw unsigned 16-bit register value with ERROR bit attached, NOT temperature!
|
||||||
|
*/
|
||||||
|
uint16_t MAX31865::readRaw() {
|
||||||
|
clearFault();
|
||||||
|
enableBias(true);
|
||||||
|
|
||||||
|
oneShot();
|
||||||
|
uint16_t rtd = readRegister16(MAX31856_RTDMSB_REG);
|
||||||
|
|
||||||
|
#ifdef MAX31865_DEBUG
|
||||||
|
SERIAL_ECHOLNPAIR("RTD MSB:", (rtd >> 8), " RTD LSB:", (rtd & 0x00FF));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Disable the bias to lower power dissipation between reads.
|
||||||
|
// If the ref resistor heats up, the temperature reading will be skewed.
|
||||||
|
enableBias(false);
|
||||||
|
|
||||||
|
return rtd;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calulate and return the resistance value of the connected RTD.
|
||||||
|
*
|
||||||
|
* @param refResistor The value of the matching reference resistor, usually 430 or 4300
|
||||||
|
* @return The raw RTD resistance value, NOT temperature!
|
||||||
|
*/
|
||||||
|
float MAX31865::readResistance() {
|
||||||
|
// Strip the error bit (D0) and convert to a float ratio.
|
||||||
|
// less precise method: (readRaw() * Rref) >> 16
|
||||||
|
return (((readRaw() >> 1) / 32768.0f) * Rref);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the RTD and pass it to temperature(float) for calculation.
|
||||||
|
*
|
||||||
|
* @return Temperature in C
|
||||||
|
*/
|
||||||
|
float MAX31865::temperature() {
|
||||||
|
return temperature(readResistance());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given the 15-bit ADC value, calculate the resistance and pass it to temperature(float) for calculation.
|
||||||
|
*
|
||||||
|
* @return Temperature in C
|
||||||
|
*/
|
||||||
|
float MAX31865::temperature(uint16_t adcVal) {
|
||||||
|
return temperature(((adcVal) / 32768.0f) * Rref);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate the temperature in C from the RTD resistance.
|
||||||
|
* Uses the technique outlined in this PDF:
|
||||||
|
* http://www.analog.com/media/en/technical-documentation/application-notes/AN709_0.pdf
|
||||||
|
*
|
||||||
|
* @param Rrtd the resistance value in ohms
|
||||||
|
* @return the temperature in degC
|
||||||
|
*/
|
||||||
|
float MAX31865::temperature(float Rrtd) {
|
||||||
|
float temp = (RTD_Z1 + sqrt(RTD_Z2 + (RTD_Z3 * Rrtd))) / RTD_Z4;
|
||||||
|
|
||||||
|
// From the PDF...
|
||||||
|
//
|
||||||
|
// The previous equation is valid only for temperatures of 0°C and above.
|
||||||
|
// The equation for RRTD(t) that defines negative temperature behavior is a
|
||||||
|
// fourth-order polynomial (after expanding the third term) and is quite
|
||||||
|
// impractical to solve for a single expression of temperature as a function
|
||||||
|
// of resistance.
|
||||||
|
//
|
||||||
|
if (temp < 0) {
|
||||||
|
Rrtd = (Rrtd / Rzero) * 100; // normalize to 100 ohm
|
||||||
|
float rpoly = Rrtd;
|
||||||
|
|
||||||
|
temp = -242.02 + (2.2228 * rpoly);
|
||||||
|
rpoly *= Rrtd; // square
|
||||||
|
temp += 2.5859e-3 * rpoly;
|
||||||
|
rpoly *= Rrtd; // ^3
|
||||||
|
temp -= 4.8260e-6 * rpoly;
|
||||||
|
rpoly *= Rrtd; // ^4
|
||||||
|
temp -= 2.8183e-8 * rpoly;
|
||||||
|
rpoly *= Rrtd; // ^5
|
||||||
|
temp += 1.5243e-10 * rpoly;
|
||||||
|
}
|
||||||
|
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// private:
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a value in the configuration register.
|
||||||
|
*
|
||||||
|
* @param config 8-bit value for the config item
|
||||||
|
* @param enable whether to enable or disable the value
|
||||||
|
*/
|
||||||
|
void MAX31865::setConfig(uint8_t config, bool enable) {
|
||||||
|
uint8_t t = readRegister8(MAX31856_CONFIG_REG);
|
||||||
|
if (enable)
|
||||||
|
t |= config;
|
||||||
|
else
|
||||||
|
t &= ~config; // disable
|
||||||
|
writeRegister8(MAX31856_CONFIG_REG, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read a single byte from the specified register address.
|
||||||
|
*
|
||||||
|
* @param addr the register address
|
||||||
|
* @return the register contents
|
||||||
|
*/
|
||||||
|
uint8_t MAX31865::readRegister8(uint8_t addr) {
|
||||||
|
uint8_t ret = 0;
|
||||||
|
readRegisterN(addr, &ret, 1);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read two bytes: 1 from the specified register address, and 1 from the next address.
|
||||||
|
*
|
||||||
|
* @param addr the first register address
|
||||||
|
* @return both register contents as a single 16-bit int
|
||||||
|
*/
|
||||||
|
uint16_t MAX31865::readRegister16(uint8_t addr) {
|
||||||
|
uint8_t buffer[2] = {0, 0};
|
||||||
|
readRegisterN(addr, buffer, 2);
|
||||||
|
|
||||||
|
uint16_t ret = buffer[0];
|
||||||
|
ret <<= 8;
|
||||||
|
ret |= buffer[1];
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read +n+ bytes from a specified address into +buffer+. Set D7 to 0 to specify a read.
|
||||||
|
*
|
||||||
|
* @param addr the first register address
|
||||||
|
* @param buffer storage for the read bytes
|
||||||
|
* @param n the number of bytes to read
|
||||||
|
*/
|
||||||
|
void MAX31865::readRegisterN(uint8_t addr, uint8_t buffer[], uint8_t n) {
|
||||||
|
addr &= 0x7F; // make sure top bit is not set
|
||||||
|
if (_sclk == TERN(LARGE_PINMAP, -1UL, -1))
|
||||||
|
SPI.beginTransaction(spiConfig);
|
||||||
|
else
|
||||||
|
WRITE(_sclk, LOW);
|
||||||
|
|
||||||
|
WRITE(_cs, LOW);
|
||||||
|
spixfer(addr);
|
||||||
|
|
||||||
|
while (n--) {
|
||||||
|
buffer[0] = spixfer(0xFF);
|
||||||
|
#ifdef MAX31865_DEBUG_SPI
|
||||||
|
SERIAL_ECHOLNPAIR("buffer read ", n, " data: ", buffer[0]);
|
||||||
|
#endif
|
||||||
|
buffer++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_sclk == TERN(LARGE_PINMAP, -1UL, -1))
|
||||||
|
SPI.endTransaction();
|
||||||
|
|
||||||
|
WRITE(_cs, HIGH);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write an 8-bit value to a register. Set D7 to 1 to specify a write.
|
||||||
|
*
|
||||||
|
* @param addr the address to write to
|
||||||
|
* @param data the data to write
|
||||||
|
*/
|
||||||
|
void MAX31865::writeRegister8(uint8_t addr, uint8_t data) {
|
||||||
|
if (_sclk == TERN(LARGE_PINMAP, -1UL, -1))
|
||||||
|
SPI.beginTransaction(spiConfig);
|
||||||
|
else
|
||||||
|
WRITE(_sclk, LOW);
|
||||||
|
|
||||||
|
WRITE(_cs, LOW);
|
||||||
|
|
||||||
|
spixfer(addr | 0x80); // make sure top bit is set
|
||||||
|
spixfer(data);
|
||||||
|
|
||||||
|
if (_sclk == TERN(LARGE_PINMAP, -1UL, -1))
|
||||||
|
SPI.endTransaction();
|
||||||
|
|
||||||
|
WRITE(_cs, HIGH);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transfer SPI data +x+ and read the response. From the datasheet...
|
||||||
|
* Input data (SDI) is latched on the internal strobe edge and output data (SDO) is
|
||||||
|
* shifted out on the shift edge. There is one clock for each bit transferred.
|
||||||
|
* Address and data bits are transferred in groups of eight, MSB first.
|
||||||
|
*
|
||||||
|
* @param x an 8-bit chunk of data to write
|
||||||
|
* @return the 8-bit response
|
||||||
|
*/
|
||||||
|
uint8_t MAX31865::spixfer(uint8_t x) {
|
||||||
|
if (_sclk == TERN(LARGE_PINMAP, -1UL, -1))
|
||||||
|
return SPI.transfer(x);
|
||||||
|
|
||||||
|
uint8_t reply = 0;
|
||||||
|
for (int i = 7; i >= 0; i--) {
|
||||||
|
reply <<= 1;
|
||||||
|
WRITE(_sclk, HIGH);
|
||||||
|
WRITE(_mosi, x & (1 << i));
|
||||||
|
WRITE(_sclk, LOW);
|
||||||
|
if (READ(_miso))
|
||||||
|
reply |= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return reply;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // HAS_MAX31865 && !LIB_USR_MAX31865
|
131
Marlin/src/libs/MAX31865.h
Normal file
131
Marlin/src/libs/MAX31865.h
Normal file
|
@ -0,0 +1,131 @@
|
||||||
|
/**
|
||||||
|
* Marlin 3D Printer Firmware
|
||||||
|
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
|
*
|
||||||
|
* Based on Sprinter and grbl.
|
||||||
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Based on Adafruit MAX31865 library:
|
||||||
|
*
|
||||||
|
* This is a library for the Adafruit PT100/P1000 RTD Sensor w/MAX31865
|
||||||
|
* Designed specifically to work with the Adafruit RTD Sensor
|
||||||
|
* https://www.adafruit.com/products/3328
|
||||||
|
*
|
||||||
|
* This sensor uses SPI to communicate, 4 pins are required to interface.
|
||||||
|
*
|
||||||
|
* Adafruit invests time and resources providing this open source code,
|
||||||
|
* please support Adafruit and open-source hardware by purchasing
|
||||||
|
* products from Adafruit!
|
||||||
|
*
|
||||||
|
* Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||||
|
*
|
||||||
|
* Modifications by JoAnn Manges (@GadgetAngel)
|
||||||
|
* Copyright (c) 2020, JoAnn Manges
|
||||||
|
* All rights reserved.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "../inc/MarlinConfig.h"
|
||||||
|
#include "../HAL/shared/Delay.h"
|
||||||
|
#include HAL_PATH(../HAL, MarlinSPI.h)
|
||||||
|
|
||||||
|
#define MAX31856_CONFIG_REG 0x00
|
||||||
|
#define MAX31856_CONFIG_BIAS 0x80
|
||||||
|
#define MAX31856_CONFIG_MODEAUTO 0x40
|
||||||
|
#define MAX31856_CONFIG_MODEOFF 0x00
|
||||||
|
#define MAX31856_CONFIG_1SHOT 0x20
|
||||||
|
#define MAX31856_CONFIG_3WIRE 0x10
|
||||||
|
#define MAX31856_CONFIG_24WIRE 0x00
|
||||||
|
#define MAX31856_CONFIG_FAULTSTAT 0x02
|
||||||
|
#define MAX31856_CONFIG_FILT50HZ 0x01
|
||||||
|
#define MAX31856_CONFIG_FILT60HZ 0x00
|
||||||
|
|
||||||
|
#define MAX31856_RTDMSB_REG 0x01
|
||||||
|
#define MAX31856_RTDLSB_REG 0x02
|
||||||
|
#define MAX31856_HFAULTMSB_REG 0x03
|
||||||
|
#define MAX31856_HFAULTLSB_REG 0x04
|
||||||
|
#define MAX31856_LFAULTMSB_REG 0x05
|
||||||
|
#define MAX31856_LFAULTLSB_REG 0x06
|
||||||
|
#define MAX31856_FAULTSTAT_REG 0x07
|
||||||
|
|
||||||
|
#define MAX31865_FAULT_HIGHTHRESH 0x80 // D7
|
||||||
|
#define MAX31865_FAULT_LOWTHRESH 0x40 // D6
|
||||||
|
#define MAX31865_FAULT_REFINLOW 0x20 // D5
|
||||||
|
#define MAX31865_FAULT_REFINHIGH 0x10 // D4
|
||||||
|
#define MAX31865_FAULT_RTDINLOW 0x08 // D3
|
||||||
|
#define MAX31865_FAULT_OVUV 0x04 // D2
|
||||||
|
|
||||||
|
// http://www.analog.com/media/en/technical-documentation/application-notes/AN709_0.pdf
|
||||||
|
// constants for calulating temperature from the measured RTD resistance.
|
||||||
|
#define RTD_Z1 -0.0039083
|
||||||
|
#define RTD_Z2 0.00001758480889
|
||||||
|
#define RTD_Z3 -0.0000000231
|
||||||
|
#define RTD_Z4 -0.000001155
|
||||||
|
|
||||||
|
typedef enum max31865_numwires {
|
||||||
|
MAX31865_2WIRE = 0,
|
||||||
|
MAX31865_3WIRE = 1,
|
||||||
|
MAX31865_4WIRE = 0
|
||||||
|
} max31865_numwires_t;
|
||||||
|
|
||||||
|
/* Interface class for the MAX31865 RTD Sensor reader */
|
||||||
|
class MAX31865 {
|
||||||
|
private:
|
||||||
|
static SPISettings spiConfig;
|
||||||
|
|
||||||
|
TERN(LARGE_PINMAP, uint32_t, uint8_t) _sclk, _miso, _mosi, _cs;
|
||||||
|
float Rzero, Rref;
|
||||||
|
|
||||||
|
void setConfig(uint8_t config, bool enable);
|
||||||
|
|
||||||
|
void readRegisterN(uint8_t addr, uint8_t buffer[], uint8_t n);
|
||||||
|
uint8_t readRegister8(uint8_t addr);
|
||||||
|
uint16_t readRegister16(uint8_t addr);
|
||||||
|
|
||||||
|
void writeRegister8(uint8_t addr, uint8_t reg);
|
||||||
|
uint8_t spixfer(uint8_t addr);
|
||||||
|
|
||||||
|
public:
|
||||||
|
#ifdef LARGE_PINMAP
|
||||||
|
MAX31865(uint32_t spi_cs, uint8_t pin_mapping);
|
||||||
|
MAX31865(uint32_t spi_cs, uint32_t spi_mosi, uint32_t spi_miso,
|
||||||
|
uint32_t spi_clk, uint8_t pin_mapping);
|
||||||
|
#else
|
||||||
|
MAX31865(int8_t spi_cs);
|
||||||
|
MAX31865(int8_t spi_cs, int8_t spi_mosi, int8_t spi_miso,
|
||||||
|
int8_t spi_clk);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void begin(max31865_numwires_t wires, float zero, float ref);
|
||||||
|
|
||||||
|
uint8_t readFault();
|
||||||
|
void clearFault();
|
||||||
|
|
||||||
|
void setWires(max31865_numwires_t wires);
|
||||||
|
void autoConvert(bool b);
|
||||||
|
void enable50HzFilter(bool b);
|
||||||
|
void enableBias(bool b);
|
||||||
|
void oneShot();
|
||||||
|
|
||||||
|
uint16_t readRaw();
|
||||||
|
float readResistance();
|
||||||
|
float temperature();
|
||||||
|
float temperature(uint16_t adcVal);
|
||||||
|
float temperature(float Rrtd);
|
||||||
|
};
|
|
@ -703,8 +703,7 @@ void restore_feedrate_and_scaling() {
|
||||||
* at the same positions relative to the machine.
|
* at the same positions relative to the machine.
|
||||||
*/
|
*/
|
||||||
void update_software_endstops(const AxisEnum axis
|
void update_software_endstops(const AxisEnum axis
|
||||||
OPTARG(HAS_HOTEND_OFFSET, const uint8_t old_tool_index/*=0*/)
|
OPTARG(HAS_HOTEND_OFFSET, const uint8_t old_tool_index/*=0*/, const uint8_t new_tool_index/*=0*/)
|
||||||
OPTARG(HAS_HOTEND_OFFSET, const uint8_t new_tool_index/*=0*/)
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
#if ENABLED(DUAL_X_CARRIAGE)
|
#if ENABLED(DUAL_X_CARRIAGE)
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "temperature.h"
|
#include "temperature.h"
|
||||||
#include "endstops.h"
|
#include "endstops.h"
|
||||||
#include "planner.h"
|
#include "planner.h"
|
||||||
|
#include "printcounter.h"
|
||||||
|
|
||||||
#if EITHER(HAS_COOLER, LASER_COOLANT_FLOW_METER)
|
#if EITHER(HAS_COOLER, LASER_COOLANT_FLOW_METER)
|
||||||
#include "../feature/cooler.h"
|
#include "../feature/cooler.h"
|
||||||
|
@ -56,112 +57,56 @@
|
||||||
#include "../feature/host_actions.h"
|
#include "../feature/host_actions.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TEMP_SENSOR_IS_ANY_MAX_TC(n) (ENABLED(TEMP_SENSOR_##n##_IS_MAX_TC) || (ENABLED(TEMP_SENSOR_REDUNDANT_IS_MAX_TC) && ENABLED(TEMP_SENSOR_REDUNDANT_SOURCE) && TEMP_SENSOR_REDUNDANT_SOURCE == n))
|
// MAX TC related macros
|
||||||
|
#define TEMP_SENSOR_IS_MAX(n, M) (ENABLED(TEMP_SENSOR_##n##_IS_MAX##M) || (ENABLED(TEMP_SENSOR_REDUNDANT_IS_MAX##M) && TEMP_SENSOR_REDUNDANT_SOURCE == (n)))
|
||||||
// LIB_MAX31855 can be added to the build_flags in platformio.ini to use a user-defined library
|
#define TEMP_SENSOR_IS_ANY_MAX_TC(n) (ENABLED(TEMP_SENSOR_##n##_IS_MAX_TC) || (ENABLED(TEMP_SENSOR_REDUNDANT_IS_MAX_TC) && TEMP_SENSOR_REDUNDANT_SOURCE == n))
|
||||||
#if LIB_USR_MAX31855
|
|
||||||
#include <Adafruit_MAX31855.h>
|
|
||||||
#if PIN_EXISTS(MAX31855_MISO) && PIN_EXISTS(MAX31855_SCK)
|
|
||||||
#define MAX31855_USES_SW_SPI 1
|
|
||||||
#endif
|
|
||||||
#if TEMP_SENSOR_IS_MAX(0, MAX31855) && PIN_EXISTS(MAX31855_CS)
|
|
||||||
#define HAS_MAX31855_TEMP 1
|
|
||||||
Adafruit_MAX31855 max31855_0 = Adafruit_MAX31855(MAX31855_CS_PIN
|
|
||||||
#if MAX31855_USES_SW_SPI
|
|
||||||
, MAX31855_MISO_PIN, MAX31855_SCK_PIN // For software SPI also set MISO/SCK
|
|
||||||
#endif
|
|
||||||
#if ENABLED(LARGE_PINMAP)
|
|
||||||
, HIGH
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
#if TEMP_SENSOR_IS_MAX(1, MAX31855) && PIN_EXISTS(MAX31855_CS2)
|
|
||||||
#define HAS_MAX31855_TEMP 1
|
|
||||||
Adafruit_MAX31855 max31855_1 = Adafruit_MAX31855(MAX31855_CS2_PIN
|
|
||||||
#if MAX31855_USES_SW_SPI
|
|
||||||
, MAX31855_MISO_PIN, MAX31855_SCK_PIN // For software SPI also set MISO/SCK
|
|
||||||
#endif
|
|
||||||
#if ENABLED(LARGE_PINMAP)
|
|
||||||
, HIGH
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// LIB_MAX31865 can be added to the build_flags in platformio.ini to use a user-defined library.
|
|
||||||
// If LIB_MAX31865 is not on the build_flags then the Adafruit MAX31865 V1.1.0 library is used.
|
|
||||||
#if HAS_MAX31865
|
|
||||||
#include <Adafruit_MAX31865.h>
|
|
||||||
#ifndef MAX31865_MOSI_PIN
|
|
||||||
#define MAX31865_MOSI_PIN SD_MOSI_PIN
|
|
||||||
#endif
|
|
||||||
#if PIN_EXISTS(MAX31865_MISO) && PIN_EXISTS(MAX31865_SCK)
|
|
||||||
#define MAX31865_USES_SW_SPI 1
|
|
||||||
#endif
|
|
||||||
#if TEMP_SENSOR_IS_MAX(0, MAX31865) && PIN_EXISTS(MAX31865_CS)
|
|
||||||
#define HAS_MAX31865_TEMP 1
|
|
||||||
Adafruit_MAX31865 max31865_0 = Adafruit_MAX31865(MAX31865_CS_PIN
|
|
||||||
#if MAX31865_USES_SW_SPI && PIN_EXISTS(MAX31865_MOSI)
|
|
||||||
, MAX31865_MOSI_PIN, MAX31865_MISO_PIN, MAX31865_SCK_PIN // For software SPI also set MOSI/MISO/SCK
|
|
||||||
#endif
|
|
||||||
#if ENABLED(LARGE_PINMAP)
|
|
||||||
, HIGH
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
#if TEMP_SENSOR_IS_MAX(1, MAX31865) && PIN_EXISTS(MAX31865_CS2)
|
|
||||||
#define HAS_MAX31865_TEMP 1
|
|
||||||
Adafruit_MAX31865 max31865_1 = Adafruit_MAX31865(MAX31865_CS2_PIN
|
|
||||||
#if MAX31865_USES_SW_SPI && PIN_EXISTS(MAX31865_MOSI)
|
|
||||||
, MAX31865_MOSI_PIN, MAX31865_MISO_PIN, MAX31865_SCK_PIN // For software SPI also set MOSI/MISO/SCK
|
|
||||||
#endif
|
|
||||||
#if ENABLED(LARGE_PINMAP)
|
|
||||||
, HIGH
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// LIB_MAX6675 can be added to the build_flags in platformio.ini to use a user-defined library
|
// LIB_MAX6675 can be added to the build_flags in platformio.ini to use a user-defined library
|
||||||
#if LIB_USR_MAX6675
|
// If LIB_MAX6675 is not on the build_flags then raw SPI reads will be used.
|
||||||
|
#if HAS_MAX6675 && LIB_USR_MAX6675
|
||||||
#include <max6675.h>
|
#include <max6675.h>
|
||||||
#if PIN_EXISTS(MAX6675_MISO) && PIN_EXISTS(MAX6675_SCK)
|
#define HAS_MAX6675_LIBRARY 1
|
||||||
#define MAX6675_USES_SW_SPI 1
|
#endif
|
||||||
#endif
|
|
||||||
#if TEMP_SENSOR_IS_MAX(0, MAX6675) && PIN_EXISTS(MAX6675_CS)
|
// LIB_MAX31855 can be added to the build_flags in platformio.ini to use a user-defined library.
|
||||||
#define HAS_MAX6675_TEMP 1
|
// If LIB_MAX31855 is not on the build_flags then raw SPI reads will be used.
|
||||||
MAX6675 max6675_0 = MAX6675(MAX6675_CS_PIN
|
#if HAS_MAX31855 && LIB_USR_MAX31855
|
||||||
#if MAX6675_USES_SW_SPI
|
#include <Adafruit_MAX31855.h>
|
||||||
, MAX6675_MISO_PIN, MAX6675_SCK_PIN // For software SPI also set MISO/SCK
|
#define HAS_MAX31855_LIBRARY 1
|
||||||
#endif
|
typedef Adafruit_MAX31855 MAX31855;
|
||||||
#if ENABLED(LARGE_PINMAP)
|
#endif
|
||||||
, HIGH
|
|
||||||
#endif
|
#if HAS_MAX31865
|
||||||
);
|
#if LIB_USR_MAX31865
|
||||||
#endif
|
#include <Adafruit_MAX31865.h>
|
||||||
#if TEMP_SENSOR_IS_MAX(1, MAX6675) && PIN_EXISTS(MAX6675_CS2)
|
typedef Adafruit_MAX31865 MAX31865;
|
||||||
#define HAS_MAX6675_TEMP 1
|
#else
|
||||||
MAX6675 max6675_1 = MAX6675(MAX6675_CS2_PIN
|
#include "../libs/MAX31865.h"
|
||||||
#if MAX6675_USES_SW_SPI
|
|
||||||
, MAX6675_MISO_PIN, MAX6675_SCK_PIN // For software SPI also set MISO/SCK
|
|
||||||
#endif
|
|
||||||
#if ENABLED(LARGE_PINMAP)
|
|
||||||
, HIGH
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !HAS_MAX6675_TEMP && !HAS_MAX31855_TEMP && !HAS_MAX31865_TEMP
|
#if HAS_MAX6675_LIBRARY || HAS_MAX31855_LIBRARY || HAS_MAX31865
|
||||||
#define NO_THERMO_TEMPS 1
|
#define HAS_MAXTC_LIBRARIES 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (TEMP_SENSOR_0_IS_MAX_TC || TEMP_SENSOR_1_IS_MAX_TC || TEMP_SENSOR_REDUNDANT_IS_MAX_TC) && PINS_EXIST(MAX6675_SCK, MAX6675_DO) && NO_THERMO_TEMPS
|
// If we have a MAX TC with SCK and MISO pins defined, it's either on a separate/dedicated Hardware
|
||||||
#define THERMO_SEPARATE_SPI 1
|
// SPI bus, or some pins for Software SPI. Alternate Hardware SPI buses are not supported yet, so
|
||||||
|
// your SPI options are:
|
||||||
|
//
|
||||||
|
// 1. Only CS pin(s) defined: Hardware SPI on the default bus (usually the SD card SPI).
|
||||||
|
// 2. CS, MISO, and SCK pins defined: Software SPI on a separate bus, as defined by MISO, SCK.
|
||||||
|
// 3. CS, MISO, and SCK pins w/ FORCE_HW_SPI: Hardware SPI on the default bus, ignoring MISO, SCK.
|
||||||
|
//
|
||||||
|
#if TEMP_SENSOR_IS_ANY_MAX_TC(0) && TEMP_SENSOR_0_HAS_SPI_PINS && DISABLED(TEMP_SENSOR_FORCE_HW_SPI)
|
||||||
|
#define TEMP_SENSOR_0_USES_SW_SPI 1
|
||||||
|
#endif
|
||||||
|
#if TEMP_SENSOR_IS_ANY_MAX_TC(1) && TEMP_SENSOR_1_HAS_SPI_PINS && DISABLED(TEMP_SENSOR_FORCE_HW_SPI)
|
||||||
|
#define TEMP_SENSOR_1_USES_SW_SPI 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if THERMO_SEPARATE_SPI
|
#if (TEMP_SENSOR_0_USES_SW_SPI || TEMP_SENSOR_1_USES_SW_SPI) && !HAS_MAXTC_LIBRARIES
|
||||||
#include "../libs/private_spi.h"
|
#include "../libs/private_spi.h"
|
||||||
|
#define HAS_MAXTC_SW_SPI 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(PID_EXTRUSION_SCALING)
|
#if ENABLED(PID_EXTRUSION_SCALING)
|
||||||
|
@ -172,8 +117,6 @@
|
||||||
#include "../feature/babystep.h"
|
#include "../feature/babystep.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "printcounter.h"
|
|
||||||
|
|
||||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||||
#include "../feature/filwidth.h"
|
#include "../feature/filwidth.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -246,7 +189,67 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
|
||||||
#define _E_PSTR(h,N) ((HOTENDS) > N && (h) == N) ? PSTR(LCD_STR_E##N) :
|
#define _E_PSTR(h,N) ((HOTENDS) > N && (h) == N) ? PSTR(LCD_STR_E##N) :
|
||||||
#define HEATER_PSTR(h) _BED_PSTR(h) _CHAMBER_PSTR(h) _COOLER_PSTR(h) _E_PSTR(h,1) _E_PSTR(h,2) _E_PSTR(h,3) _E_PSTR(h,4) _E_PSTR(h,5) PSTR(LCD_STR_E0)
|
#define HEATER_PSTR(h) _BED_PSTR(h) _CHAMBER_PSTR(h) _COOLER_PSTR(h) _E_PSTR(h,1) _E_PSTR(h,2) _E_PSTR(h,3) _E_PSTR(h,4) _E_PSTR(h,5) PSTR(LCD_STR_E0)
|
||||||
|
|
||||||
// public:
|
//
|
||||||
|
// Initialize MAX TC objects/SPI
|
||||||
|
//
|
||||||
|
#if HAS_MAX_TC
|
||||||
|
|
||||||
|
#if HAS_MAXTC_SW_SPI
|
||||||
|
// Initialize SoftSPI for non-lib Software SPI; Libraries take care of it themselves.
|
||||||
|
template<uint8_t MisoPin, uint8_t MosiPin, uint8_t SckPin>
|
||||||
|
SoftSPI<MisoPin, MosiPin, SckPin> SPIclass<MisoPin, MosiPin, SckPin>::softSPI;
|
||||||
|
SPIclass<TEMP_0_MISO_PIN, TEMP_0_MOSI_PIN, TEMP_0_SCK_PIN> max_tc_spi;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MAXTC_INIT(n, M) \
|
||||||
|
MAX##M max##M##_##n = MAX##M( \
|
||||||
|
TEMP_##n##_CS_PIN \
|
||||||
|
OPTARG(_MAX31865_##n##_SW, TEMP_##n##_MOSI_PIN) \
|
||||||
|
OPTARG(TEMP_SENSOR_##n##_USES_SW_SPI, TEMP_##n##_MISO_PIN, TEMP_##n##_SCK_PIN) \
|
||||||
|
OPTARG(LARGE_PINMAP, HIGH) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#if HAS_MAX6675_LIBRARY
|
||||||
|
#if TEMP_SENSOR_IS_MAX(0, 6675)
|
||||||
|
MAXTC_INIT(0, 6675);
|
||||||
|
#endif
|
||||||
|
#if TEMP_SENSOR_IS_MAX(1, 6675)
|
||||||
|
MAXTC_INIT(1, 6675);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAS_MAX31855_LIBRARY
|
||||||
|
#if TEMP_SENSOR_IS_MAX(0, 31855)
|
||||||
|
MAXTC_INIT(0, 31855);
|
||||||
|
#endif
|
||||||
|
#if TEMP_SENSOR_IS_MAX(1, 31855)
|
||||||
|
MAXTC_INIT(1, 31855);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// MAX31865 always uses a library, unlike '55 & 6675
|
||||||
|
#if HAS_MAX31865
|
||||||
|
#define _MAX31865_0_SW TEMP_SENSOR_0_USES_SW_SPI
|
||||||
|
#define _MAX31865_1_SW TEMP_SENSOR_1_USES_SW_SPI
|
||||||
|
|
||||||
|
#if TEMP_SENSOR_IS_MAX(0, 31865)
|
||||||
|
MAXTC_INIT(0, 31865);
|
||||||
|
#endif
|
||||||
|
#if TEMP_SENSOR_IS_MAX(1, 31865)
|
||||||
|
MAXTC_INIT(1, 31865);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef _MAX31865_0_SW
|
||||||
|
#undef _MAX31865_1_SW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef MAXTC_INIT
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* public:
|
||||||
|
*/
|
||||||
|
|
||||||
#if ENABLED(NO_FAN_SLOWING_IN_PID_TUNING)
|
#if ENABLED(NO_FAN_SLOWING_IN_PID_TUNING)
|
||||||
bool Temperature::adaptive_fan_slowing = true;
|
bool Temperature::adaptive_fan_slowing = true;
|
||||||
|
@ -274,6 +277,25 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
|
||||||
uint8_t Temperature::coolerfan_speed; // = 0
|
uint8_t Temperature::coolerfan_speed; // = 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Init fans according to whether they're native PWM or Software PWM
|
||||||
|
#ifdef BOARD_OPENDRAIN_MOSFETS
|
||||||
|
#define _INIT_SOFT_FAN(P) OUT_WRITE_OD(P, FAN_INVERTING ? LOW : HIGH)
|
||||||
|
#else
|
||||||
|
#define _INIT_SOFT_FAN(P) OUT_WRITE(P, FAN_INVERTING ? LOW : HIGH)
|
||||||
|
#endif
|
||||||
|
#if ENABLED(FAN_SOFT_PWM)
|
||||||
|
#define _INIT_FAN_PIN(P) _INIT_SOFT_FAN(P)
|
||||||
|
#else
|
||||||
|
#define _INIT_FAN_PIN(P) do{ if (PWM_PIN(P)) SET_PWM(P); else _INIT_SOFT_FAN(P); }while(0)
|
||||||
|
#endif
|
||||||
|
#if ENABLED(FAST_PWM_FAN)
|
||||||
|
#define SET_FAST_PWM_FREQ(P) set_pwm_frequency(P, FAST_PWM_FAN_FREQUENCY)
|
||||||
|
#else
|
||||||
|
#define SET_FAST_PWM_FREQ(P) NOOP
|
||||||
|
#endif
|
||||||
|
#define INIT_FAN_PIN(P) do{ _INIT_FAN_PIN(P); SET_FAST_PWM_FREQ(P); }while(0)
|
||||||
|
|
||||||
|
// HAS_FAN does not include CONTROLLER_FAN
|
||||||
#if HAS_FAN
|
#if HAS_FAN
|
||||||
|
|
||||||
uint8_t Temperature::fan_speed[FAN_COUNT]; // = { 0 }
|
uint8_t Temperature::fan_speed[FAN_COUNT]; // = { 0 }
|
||||||
|
@ -419,7 +441,18 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
|
||||||
celsius_t Temperature::extrude_min_temp = EXTRUDE_MINTEMP;
|
celsius_t Temperature::extrude_min_temp = EXTRUDE_MINTEMP;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// private:
|
#if HAS_ADC_BUTTONS
|
||||||
|
uint32_t Temperature::current_ADCKey_raw = HAL_ADC_RANGE;
|
||||||
|
uint16_t Temperature::ADCKey_count = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ENABLED(PID_EXTRUSION_SCALING)
|
||||||
|
int16_t Temperature::lpq_len; // Initialized in settings.cpp
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* private:
|
||||||
|
*/
|
||||||
|
|
||||||
volatile bool Temperature::raw_temps_ready = false;
|
volatile bool Temperature::raw_temps_ready = false;
|
||||||
|
|
||||||
|
@ -472,16 +505,10 @@ volatile bool Temperature::raw_temps_ready = false;
|
||||||
bool Temperature::paused_for_probing;
|
bool Temperature::paused_for_probing;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// public:
|
/**
|
||||||
|
* public:
|
||||||
#if HAS_ADC_BUTTONS
|
* Class and Instance Methods
|
||||||
uint32_t Temperature::current_ADCKey_raw = HAL_ADC_RANGE;
|
*/
|
||||||
uint16_t Temperature::ADCKey_count = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLED(PID_EXTRUSION_SCALING)
|
|
||||||
int16_t Temperature::lpq_len; // Initialized in settings.cpp
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAS_PID_HEATING
|
#if HAS_PID_HEATING
|
||||||
|
|
||||||
|
@ -758,10 +785,6 @@ volatile bool Temperature::raw_temps_ready = false;
|
||||||
|
|
||||||
#endif // HAS_PID_HEATING
|
#endif // HAS_PID_HEATING
|
||||||
|
|
||||||
/**
|
|
||||||
* Class and Instance Methods
|
|
||||||
*/
|
|
||||||
|
|
||||||
int16_t Temperature::getHeaterPower(const heater_id_t heater_id) {
|
int16_t Temperature::getHeaterPower(const heater_id_t heater_id) {
|
||||||
switch (heater_id) {
|
switch (heater_id) {
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
|
@ -781,6 +804,16 @@ int16_t Temperature::getHeaterPower(const heater_id_t heater_id) {
|
||||||
#define _EFANOVERLAP(A,B) _FANOVERLAP(E##A,B)
|
#define _EFANOVERLAP(A,B) _FANOVERLAP(E##A,B)
|
||||||
|
|
||||||
#if HAS_AUTO_FAN
|
#if HAS_AUTO_FAN
|
||||||
|
#if EXTRUDER_AUTO_FAN_SPEED != 255
|
||||||
|
#define INIT_E_AUTO_FAN_PIN(P) do{ if (P == FAN1_PIN || P == FAN2_PIN) { SET_PWM(P); SET_FAST_PWM_FREQ(P); } else SET_OUTPUT(P); }while(0)
|
||||||
|
#else
|
||||||
|
#define INIT_E_AUTO_FAN_PIN(P) SET_OUTPUT(P)
|
||||||
|
#endif
|
||||||
|
#if CHAMBER_AUTO_FAN_SPEED != 255
|
||||||
|
#define INIT_CHAMBER_AUTO_FAN_PIN(P) do{ if (P == FAN1_PIN || P == FAN2_PIN) { SET_PWM(P); SET_FAST_PWM_FREQ(P); } else SET_OUTPUT(P); }while(0)
|
||||||
|
#else
|
||||||
|
#define INIT_CHAMBER_AUTO_FAN_PIN(P) SET_OUTPUT(P)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CHAMBER_FAN_INDEX HOTENDS
|
#define CHAMBER_FAN_INDEX HOTENDS
|
||||||
|
|
||||||
|
@ -1668,11 +1701,6 @@ void Temperature::manage_heater() {
|
||||||
}
|
}
|
||||||
|
|
||||||
celsius_float_t Temperature::user_thermistor_to_deg_c(const uint8_t t_index, const int16_t raw) {
|
celsius_float_t Temperature::user_thermistor_to_deg_c(const uint8_t t_index, const int16_t raw) {
|
||||||
//#if (MOTHERBOARD == BOARD_RAMPS_14_EFB)
|
|
||||||
// static uint32_t clocks_total = 0;
|
|
||||||
// static uint32_t calls = 0;
|
|
||||||
// uint32_t tcnt5 = TCNT5;
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
if (!WITHIN(t_index, 0, COUNT(user_thermistor) - 1)) return 25;
|
if (!WITHIN(t_index, 0, COUNT(user_thermistor) - 1)) return 25;
|
||||||
|
|
||||||
|
@ -1700,14 +1728,6 @@ void Temperature::manage_heater() {
|
||||||
value += t.sh_c_coeff * cu(log_resistance);
|
value += t.sh_c_coeff * cu(log_resistance);
|
||||||
value = 1.0f / value;
|
value = 1.0f / value;
|
||||||
|
|
||||||
//#if (MOTHERBOARD == BOARD_RAMPS_14_EFB)
|
|
||||||
// int32_t clocks = TCNT5 - tcnt5;
|
|
||||||
// if (clocks >= 0) {
|
|
||||||
// clocks_total += clocks;
|
|
||||||
// calls++;
|
|
||||||
// }
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
// Return degrees C (up to 999, as the LCD only displays 3 digits)
|
// Return degrees C (up to 999, as the LCD only displays 3 digits)
|
||||||
return _MIN(value + THERMISTOR_ABS_ZERO_C, 999);
|
return _MIN(value + THERMISTOR_ABS_ZERO_C, 999);
|
||||||
}
|
}
|
||||||
|
@ -1730,7 +1750,14 @@ void Temperature::manage_heater() {
|
||||||
#if TEMP_SENSOR_0_IS_CUSTOM
|
#if TEMP_SENSOR_0_IS_CUSTOM
|
||||||
return user_thermistor_to_deg_c(CTI_HOTEND_0, raw);
|
return user_thermistor_to_deg_c(CTI_HOTEND_0, raw);
|
||||||
#elif TEMP_SENSOR_0_IS_MAX_TC
|
#elif TEMP_SENSOR_0_IS_MAX_TC
|
||||||
return TERN(TEMP_SENSOR_0_IS_MAX31865, max31865_0.temperature(MAX31865_SENSOR_OHMS_0, MAX31865_CALIBRATION_OHMS_0), raw * 0.25);
|
#if TEMP_SENSOR_0_IS_MAX31865
|
||||||
|
return TERN(LIB_INTERNAL_MAX31865,
|
||||||
|
max31865_0.temperature((uint16_t)raw),
|
||||||
|
max31865_0.temperature(MAX31865_SENSOR_OHMS_0, MAX31865_CALIBRATION_OHMS_0)
|
||||||
|
);
|
||||||
|
#else
|
||||||
|
return raw * 0.25;
|
||||||
|
#endif
|
||||||
#elif TEMP_SENSOR_0_IS_AD595
|
#elif TEMP_SENSOR_0_IS_AD595
|
||||||
return TEMP_AD595(raw);
|
return TEMP_AD595(raw);
|
||||||
#elif TEMP_SENSOR_0_IS_AD8495
|
#elif TEMP_SENSOR_0_IS_AD8495
|
||||||
|
@ -1742,7 +1769,14 @@ void Temperature::manage_heater() {
|
||||||
#if TEMP_SENSOR_1_IS_CUSTOM
|
#if TEMP_SENSOR_1_IS_CUSTOM
|
||||||
return user_thermistor_to_deg_c(CTI_HOTEND_1, raw);
|
return user_thermistor_to_deg_c(CTI_HOTEND_1, raw);
|
||||||
#elif TEMP_SENSOR_1_IS_MAX_TC
|
#elif TEMP_SENSOR_1_IS_MAX_TC
|
||||||
return TERN(TEMP_SENSOR_1_IS_MAX31865, max31865_1.temperature(MAX31865_SENSOR_OHMS_1, MAX31865_CALIBRATION_OHMS_1), raw * 0.25);
|
#if TEMP_SENSOR_0_IS_MAX31865
|
||||||
|
return TERN(LIB_INTERNAL_MAX31865,
|
||||||
|
max31865_1.temperature((uint16_t)raw),
|
||||||
|
max31865_1.temperature(MAX31865_SENSOR_OHMS_1, MAX31865_CALIBRATION_OHMS_1)
|
||||||
|
);
|
||||||
|
#else
|
||||||
|
return raw * 0.25;
|
||||||
|
#endif
|
||||||
#elif TEMP_SENSOR_1_IS_AD595
|
#elif TEMP_SENSOR_1_IS_AD595
|
||||||
return TEMP_AD595(raw);
|
return TEMP_AD595(raw);
|
||||||
#elif TEMP_SENSOR_1_IS_AD8495
|
#elif TEMP_SENSOR_1_IS_AD8495
|
||||||
|
@ -1901,9 +1935,9 @@ void Temperature::manage_heater() {
|
||||||
#if TEMP_SENSOR_REDUNDANT_IS_CUSTOM
|
#if TEMP_SENSOR_REDUNDANT_IS_CUSTOM
|
||||||
return user_thermistor_to_deg_c(CTI_REDUNDANT, raw);
|
return user_thermistor_to_deg_c(CTI_REDUNDANT, raw);
|
||||||
#elif TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 0
|
#elif TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 0
|
||||||
return TERN(TEMP_SENSOR_REDUNDANT_IS_MAX31865, max31865_0.temperature(MAX31865_SENSOR_OHMS_0, MAX31865_CALIBRATION_OHMS_0), raw * 0.25);
|
return TERN(TEMP_SENSOR_REDUNDANT_IS_MAX31865, max31865_0.temperature((uint16_t)raw), raw * 0.25);
|
||||||
#elif TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 1
|
#elif TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 1
|
||||||
return TERN(TEMP_SENSOR_REDUNDANT_IS_MAX31865, max31865_1.temperature(MAX31865_SENSOR_OHMS_1, MAX31865_CALIBRATION_OHMS_1), raw * 0.25);
|
return TERN(TEMP_SENSOR_REDUNDANT_IS_MAX31865, max31865_1.temperature((uint16_t)raw), raw * 0.25);
|
||||||
#elif TEMP_SENSOR_REDUNDANT_IS_THERMISTOR
|
#elif TEMP_SENSOR_REDUNDANT_IS_THERMISTOR
|
||||||
SCAN_THERMISTOR_TABLE(TEMPTABLE_REDUNDANT, TEMPTABLE_REDUNDANT_LEN);
|
SCAN_THERMISTOR_TABLE(TEMPTABLE_REDUNDANT, TEMPTABLE_REDUNDANT_LEN);
|
||||||
#elif TEMP_SENSOR_REDUNDANT_IS_AD595
|
#elif TEMP_SENSOR_REDUNDANT_IS_AD595
|
||||||
|
@ -1936,6 +1970,7 @@ void Temperature::updateTemperaturesFromRawValues() {
|
||||||
TERN_(TEMP_SENSOR_0_IS_MAX_TC, temp_hotend[0].raw = READ_MAX_TC(0));
|
TERN_(TEMP_SENSOR_0_IS_MAX_TC, temp_hotend[0].raw = READ_MAX_TC(0));
|
||||||
TERN_(TEMP_SENSOR_1_IS_MAX_TC, temp_hotend[1].raw = READ_MAX_TC(1));
|
TERN_(TEMP_SENSOR_1_IS_MAX_TC, temp_hotend[1].raw = READ_MAX_TC(1));
|
||||||
TERN_(TEMP_SENSOR_REDUNDANT_IS_MAX_TC, temp_redundant.raw = READ_MAX_TC(TEMP_SENSOR_REDUNDANT_SOURCE));
|
TERN_(TEMP_SENSOR_REDUNDANT_IS_MAX_TC, temp_redundant.raw = READ_MAX_TC(TEMP_SENSOR_REDUNDANT_SOURCE));
|
||||||
|
|
||||||
#if HAS_HOTEND
|
#if HAS_HOTEND
|
||||||
HOTEND_LOOP() temp_hotend[e].celsius = analog_to_celsius_hotend(temp_hotend[e].raw, e);
|
HOTEND_LOOP() temp_hotend[e].celsius = analog_to_celsius_hotend(temp_hotend[e].raw, e);
|
||||||
#endif
|
#endif
|
||||||
|
@ -2008,40 +2043,7 @@ void Temperature::updateTemperaturesFromRawValues() {
|
||||||
if (cutter.unitPower > 0 && COOLERCMP(temp_cooler.raw, maxtemp_raw_COOLER)) max_temp_error(H_COOLER);
|
if (cutter.unitPower > 0 && COOLERCMP(temp_cooler.raw, maxtemp_raw_COOLER)) max_temp_error(H_COOLER);
|
||||||
if (COOLERCMP(mintemp_raw_COOLER, temp_cooler.raw)) min_temp_error(H_COOLER);
|
if (COOLERCMP(mintemp_raw_COOLER, temp_cooler.raw)) min_temp_error(H_COOLER);
|
||||||
#endif
|
#endif
|
||||||
}
|
} // Temperature::updateTemperaturesFromRawValues
|
||||||
|
|
||||||
#if THERMO_SEPARATE_SPI
|
|
||||||
template<uint8_t MisoPin, uint8_t MosiPin, uint8_t SckPin> SoftSPI<MisoPin, MosiPin, SckPin> SPIclass<MisoPin, MosiPin, SckPin>::softSPI;
|
|
||||||
SPIclass<MAX6675_DO_PIN, SD_MOSI_PIN, MAX6675_SCK_PIN> max_tc_spi;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Init fans according to whether they're native PWM or Software PWM
|
|
||||||
#ifdef BOARD_OPENDRAIN_MOSFETS
|
|
||||||
#define _INIT_SOFT_FAN(P) OUT_WRITE_OD(P, FAN_INVERTING ? LOW : HIGH)
|
|
||||||
#else
|
|
||||||
#define _INIT_SOFT_FAN(P) OUT_WRITE(P, FAN_INVERTING ? LOW : HIGH)
|
|
||||||
#endif
|
|
||||||
#if ENABLED(FAN_SOFT_PWM)
|
|
||||||
#define _INIT_FAN_PIN(P) _INIT_SOFT_FAN(P)
|
|
||||||
#else
|
|
||||||
#define _INIT_FAN_PIN(P) do{ if (PWM_PIN(P)) SET_PWM(P); else _INIT_SOFT_FAN(P); }while(0)
|
|
||||||
#endif
|
|
||||||
#if ENABLED(FAST_PWM_FAN)
|
|
||||||
#define SET_FAST_PWM_FREQ(P) set_pwm_frequency(P, FAST_PWM_FAN_FREQUENCY)
|
|
||||||
#else
|
|
||||||
#define SET_FAST_PWM_FREQ(P) NOOP
|
|
||||||
#endif
|
|
||||||
#define INIT_FAN_PIN(P) do{ _INIT_FAN_PIN(P); SET_FAST_PWM_FREQ(P); }while(0)
|
|
||||||
#if EXTRUDER_AUTO_FAN_SPEED != 255
|
|
||||||
#define INIT_E_AUTO_FAN_PIN(P) do{ if (P == FAN1_PIN || P == FAN2_PIN) { SET_PWM(P); SET_FAST_PWM_FREQ(P); } else SET_OUTPUT(P); }while(0)
|
|
||||||
#else
|
|
||||||
#define INIT_E_AUTO_FAN_PIN(P) SET_OUTPUT(P)
|
|
||||||
#endif
|
|
||||||
#if CHAMBER_AUTO_FAN_SPEED != 255
|
|
||||||
#define INIT_CHAMBER_AUTO_FAN_PIN(P) do{ if (P == FAN1_PIN || P == FAN2_PIN) { SET_PWM(P); SET_FAST_PWM_FREQ(P); } else SET_OUTPUT(P); }while(0)
|
|
||||||
#else
|
|
||||||
#define INIT_CHAMBER_AUTO_FAN_PIN(P) SET_OUTPUT(P)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the temperature manager
|
* Initialize the temperature manager
|
||||||
|
@ -2070,50 +2072,47 @@ void Temperature::init() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Init (and disable) SPI thermocouples
|
// Init (and disable) SPI thermocouples
|
||||||
#if TEMP_SENSOR_IS_MAX(0, MAX6675) && PIN_EXISTS(MAX6675_CS)
|
#if TEMP_SENSOR_IS_ANY_MAX_TC(0) && PIN_EXISTS(TEMP_0_CS)
|
||||||
OUT_WRITE(MAX6675_CS_PIN, HIGH);
|
OUT_WRITE(TEMP_0_CS_PIN, HIGH);
|
||||||
#endif
|
#endif
|
||||||
#if TEMP_SENSOR_IS_MAX(1, MAX6675) && PIN_EXISTS(MAX6675_CS2)
|
#if TEMP_SENSOR_IS_ANY_MAX_TC(1) && PIN_EXISTS(TEMP_1_CS)
|
||||||
OUT_WRITE(MAX6675_CS2_PIN, HIGH);
|
OUT_WRITE(TEMP_1_CS_PIN, HIGH);
|
||||||
#endif
|
|
||||||
#if TEMP_SENSOR_IS_MAX(0, MAX6675) && PIN_EXISTS(MAX31855_CS)
|
|
||||||
OUT_WRITE(MAX31855_CS_PIN, HIGH);
|
|
||||||
#endif
|
|
||||||
#if TEMP_SENSOR_IS_MAX(1, MAX6675) && PIN_EXISTS(MAX31855_CS2)
|
|
||||||
OUT_WRITE(MAX31855_CS2_PIN, HIGH);
|
|
||||||
#endif
|
|
||||||
#if TEMP_SENSOR_IS_MAX(0, MAX6675) && PIN_EXISTS(MAX31865_CS)
|
|
||||||
OUT_WRITE(MAX31865_CS_PIN, HIGH);
|
|
||||||
#endif
|
|
||||||
#if TEMP_SENSOR_IS_MAX(1, MAX6675) && PIN_EXISTS(MAX31865_CS2)
|
|
||||||
OUT_WRITE(MAX31865_CS2_PIN, HIGH);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_MAX31865_TEMP
|
// Setup objects for library-based polling of MAX TCs
|
||||||
#if TEMP_SENSOR_IS_MAX(0, MAX31865)
|
#if HAS_MAXTC_LIBRARIES
|
||||||
max31865_0.begin(MAX31865_2WIRE); // MAX31865_2WIRE, MAX31865_3WIRE, MAX31865_4WIRE
|
#define _MAX31865_WIRES(n) MAX31865_##n##WIRE
|
||||||
#endif
|
#define MAX31865_WIRES(n) _MAX31865_WIRES(n)
|
||||||
#if TEMP_SENSOR_IS_MAX(1, MAX31865)
|
|
||||||
max31865_1.begin(MAX31865_2WIRE);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAS_MAX31855_TEMP
|
#if TEMP_SENSOR_IS_MAX(0, 6675) && HAS_MAX6675_LIBRARY
|
||||||
#if TEMP_SENSOR_IS_MAX(0, MAX31855)
|
max6675_0.begin();
|
||||||
max31855_0.begin(MAX31855);
|
#elif TEMP_SENSOR_IS_MAX(0, 31855) && HAS_MAX31855_LIBRARY
|
||||||
|
max31855_0.begin();
|
||||||
|
#elif TEMP_SENSOR_IS_MAX(0, 31865)
|
||||||
|
max31865_0.begin(
|
||||||
|
MAX31865_WIRES(MAX31865_SENSOR_WIRES_0) // MAX31865_2WIRE, MAX31865_3WIRE, MAX31865_4WIRE
|
||||||
|
OPTARG(LIB_INTERNAL_MAX31865, MAX31865_SENSOR_OHMS_0, MAX31865_CALIBRATION_OHMS_0)
|
||||||
|
);
|
||||||
|
#if defined(LIB_INTERNAL_MAX31865) && ENABLED(MAX31865_50HZ_FILTER)
|
||||||
|
max31865_0.enable50HzFilter(1);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if TEMP_SENSOR_IS_MAX(1, MAX31855)
|
|
||||||
max31855_1.begin(MAX31855);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAS_MAX6675_TEMP
|
#if TEMP_SENSOR_IS_MAX(1, 6675) && HAS_MAX6675_LIBRARY
|
||||||
#if TEMP_SENSOR_IS_MAX(0, MAX6675)
|
max6675_1.begin();
|
||||||
max6675_0.begin(MAX6675);
|
#elif TEMP_SENSOR_IS_MAX(1, 31855) && HAS_MAX31855_LIBRARY
|
||||||
#endif
|
max31855_1.begin();
|
||||||
#if TEMP_SENSOR_IS_MAX(1, MAX6675)
|
#elif TEMP_SENSOR_IS_MAX(1, 31865)
|
||||||
max6675_1.begin(MAX6675);
|
max31865_1.begin(
|
||||||
|
MAX31865_WIRES(MAX31865_SENSOR_WIRES_1) // MAX31865_2WIRE, MAX31865_3WIRE, MAX31865_4WIRE
|
||||||
|
OPTARG(LIB_INTERNAL_MAX31865, MAX31865_SENSOR_OHMS_1, MAX31865_CALIBRATION_OHMS_1)
|
||||||
|
);
|
||||||
|
#if defined(LIB_INTERNAL_MAX31865) && ENABLED(MAX31865_50HZ_FILTER)
|
||||||
|
max31865_1.enable50HzFilter(1);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#undef MAX31865_WIRES
|
||||||
|
#undef _MAX31865_WIRES
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MB(RUMBA)
|
#if MB(RUMBA)
|
||||||
|
@ -2152,7 +2151,6 @@ void Temperature::init() {
|
||||||
OUT_WRITE(HEATER_0_PIN, HEATER_0_INVERTING);
|
OUT_WRITE(HEATER_0_PIN, HEATER_0_INVERTING);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_HEATER_1
|
#if HAS_HEATER_1
|
||||||
OUT_WRITE(HEATER_1_PIN, HEATER_1_INVERTING);
|
OUT_WRITE(HEATER_1_PIN, HEATER_1_INVERTING);
|
||||||
#endif
|
#endif
|
||||||
|
@ -2219,7 +2217,9 @@ void Temperature::init() {
|
||||||
INIT_FAN_PIN(CONTROLLER_FAN_PIN);
|
INIT_FAN_PIN(CONTROLLER_FAN_PIN);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TERN_(THERMO_SEPARATE_SPI, max_tc_spi.init());
|
#if HAS_MAXTC_SW_SPI
|
||||||
|
max_tc_spi.init();
|
||||||
|
#endif
|
||||||
|
|
||||||
HAL_adc_init();
|
HAL_adc_init();
|
||||||
|
|
||||||
|
@ -2318,11 +2318,7 @@ void Temperature::init() {
|
||||||
INIT_CHAMBER_AUTO_FAN_PIN(CHAMBER_AUTO_FAN_PIN);
|
INIT_CHAMBER_AUTO_FAN_PIN(CHAMBER_AUTO_FAN_PIN);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Wait for temperature measurement to settle
|
|
||||||
//delay(250);
|
|
||||||
|
|
||||||
#if HAS_HOTEND
|
#if HAS_HOTEND
|
||||||
|
|
||||||
#define _TEMP_MIN_E(NR) do{ \
|
#define _TEMP_MIN_E(NR) do{ \
|
||||||
const celsius_t tmin = _MAX(HEATER_##NR##_MINTEMP, TERN(TEMP_SENSOR_##NR##_IS_CUSTOM, 0, (int)pgm_read_word(&TEMPTABLE_##NR [TEMP_SENSOR_##NR##_MINTEMP_IND].celsius))); \
|
const celsius_t tmin = _MAX(HEATER_##NR##_MINTEMP, TERN(TEMP_SENSOR_##NR##_IS_CUSTOM, 0, (int)pgm_read_word(&TEMPTABLE_##NR [TEMP_SENSOR_##NR##_MINTEMP_IND].celsius))); \
|
||||||
temp_range[NR].mintemp = tmin; \
|
temp_range[NR].mintemp = tmin; \
|
||||||
|
@ -2386,7 +2382,6 @@ void Temperature::init() {
|
||||||
#if _MINMAX_TEST(7, MAX)
|
#if _MINMAX_TEST(7, MAX)
|
||||||
_TEMP_MAX_E(7);
|
_TEMP_MAX_E(7);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // HAS_HOTEND
|
#endif // HAS_HOTEND
|
||||||
|
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
|
@ -2520,9 +2515,8 @@ void Temperature::init() {
|
||||||
|
|
||||||
void Temperature::disable_all_heaters() {
|
void Temperature::disable_all_heaters() {
|
||||||
|
|
||||||
|
// Disable autotemp, unpause and reset everything
|
||||||
TERN_(AUTOTEMP, planner.autotemp_enabled = false);
|
TERN_(AUTOTEMP, planner.autotemp_enabled = false);
|
||||||
|
|
||||||
// Unpause and reset everything
|
|
||||||
TERN_(PROBING_HEATERS_OFF, pause_heaters(false));
|
TERN_(PROBING_HEATERS_OFF, pause_heaters(false));
|
||||||
|
|
||||||
#if HAS_HOTEND
|
#if HAS_HOTEND
|
||||||
|
@ -2558,8 +2552,6 @@ void Temperature::disable_all_heaters() {
|
||||||
|
|
||||||
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
|
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
|
||||||
|
|
||||||
#include "printcounter.h"
|
|
||||||
|
|
||||||
bool Temperature::auto_job_over_threshold() {
|
bool Temperature::auto_job_over_threshold() {
|
||||||
#if HAS_HOTEND
|
#if HAS_HOTEND
|
||||||
HOTEND_LOOP() if (degTargetHotend(e) > (EXTRUDE_MINTEMP) / 2) return true;
|
HOTEND_LOOP() if (degTargetHotend(e) > (EXTRUDE_MINTEMP) / 2) return true;
|
||||||
|
@ -2578,7 +2570,7 @@ void Temperature::disable_all_heaters() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // PRINTJOB_TIMER_AUTOSTART
|
||||||
|
|
||||||
#if ENABLED(PROBING_HEATERS_OFF)
|
#if ENABLED(PROBING_HEATERS_OFF)
|
||||||
|
|
||||||
|
@ -2616,7 +2608,7 @@ void Temperature::disable_all_heaters() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // SINGLENOZZLE_STANDBY_TEMP || SINGLENOZZLE_STANDBY_FAN
|
||||||
|
|
||||||
#if HAS_MAX_TC
|
#if HAS_MAX_TC
|
||||||
|
|
||||||
|
@ -2624,113 +2616,114 @@ void Temperature::disable_all_heaters() {
|
||||||
#define THERMOCOUPLE_MAX_ERRORS 15
|
#define THERMOCOUPLE_MAX_ERRORS 15
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int Temperature::read_max_tc(TERN_(HAS_MULTI_MAX_TC, const uint8_t hindex/*=0*/)) {
|
/**
|
||||||
#define MAX6675_HEAT_INTERVAL 250UL
|
* @brief Read MAX Thermocouple temperature.
|
||||||
|
*
|
||||||
|
* Reads the thermocouple board via HW or SW SPI, using a library (LIB_USR_x) or raw SPI reads.
|
||||||
|
* Doesn't strictly return a temperature; returns an "ADC Value" (i.e. raw register content).
|
||||||
|
*
|
||||||
|
* @param hindex the hotend we're referencing (if MULTI_MAX_TC)
|
||||||
|
* @return integer representing the board's buffer, to be converted later if needed
|
||||||
|
*/
|
||||||
|
int16_t Temperature::read_max_tc(TERN_(HAS_MULTI_MAX_TC, const uint8_t hindex/*=0*/)) {
|
||||||
|
#define MAXTC_HEAT_INTERVAL 250UL
|
||||||
|
|
||||||
#if HAS_MAX31855_TEMP
|
#if HAS_MAX31855
|
||||||
static uint32_t max_tc_temp = 2000;
|
#define MAX_TC_ERROR_MASK 7 // D2-0: SCV, SCG, OC
|
||||||
#define MAX_TC_ERROR_MASK 7
|
#define MAX_TC_DISCARD_BITS 18 // Data D31-18; sign bit D31
|
||||||
#define MAX_TC_DISCARD_BITS 18
|
#define MAX_TC_SPEED_BITS 3 // ~1MHz
|
||||||
#define MAX_TC_SPEED_BITS 3 // (_BV(SPR1)) // clock ÷ 64
|
#elif HAS_MAX31865
|
||||||
#elif HAS_MAX31865_TEMP
|
#define MAX_TC_ERROR_MASK 1 // D0 Bit on fault only
|
||||||
static uint16_t max_tc_temp = 2000; // From datasheet 16 bits D15-D0
|
|
||||||
#define MAX_TC_ERROR_MASK 1 // D0 Bit not used
|
|
||||||
#define MAX_TC_DISCARD_BITS 1 // Data is in D15-D1
|
#define MAX_TC_DISCARD_BITS 1 // Data is in D15-D1
|
||||||
#define MAX_TC_SPEED_BITS 3 // (_BV(SPR1)) // clock ÷ 64
|
#define MAX_TC_SPEED_BITS 3 // ~1MHz
|
||||||
#else
|
#else // MAX6675
|
||||||
static uint16_t max_tc_temp = 2000;
|
#define MAX_TC_ERROR_MASK 3 // D2 only; 1 = open circuit
|
||||||
#define MAX_TC_ERROR_MASK 4
|
#define MAX_TC_DISCARD_BITS 3 // Data D15-D1
|
||||||
#define MAX_TC_DISCARD_BITS 3
|
#define MAX_TC_SPEED_BITS 2 // ~2MHz
|
||||||
#define MAX_TC_SPEED_BITS 2 // (_BV(SPR0)) // clock ÷ 16
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_MULTI_MAX_TC
|
#if HAS_MULTI_MAX_TC
|
||||||
// Needed to return the correct temp when this is called between readings
|
// Needed to return the correct temp when this is called between readings
|
||||||
static celsius_t max_tc_temp_previous[MAX_TC_COUNT] = { 0 };
|
static int16_t max_tc_temp_previous[MAX_TC_COUNT] = { 0 };
|
||||||
#define THERMO_TEMP(I) max_tc_temp_previous[I]
|
#define THERMO_TEMP(I) max_tc_temp_previous[I]
|
||||||
#define THERMO_SEL(A,B) (hindex ? (B) : (A))
|
#define THERMO_SEL(A,B) (hindex ? (B) : (A))
|
||||||
#define MAX6675_WRITE(V) do{ switch (hindex) { case 1: WRITE(MAX6675_SS2_PIN, V); break; default: WRITE(MAX6675_SS_PIN, V); } }while(0)
|
#define MAXTC_CS_WRITE(V) do{ switch (hindex) { case 1: WRITE(TEMP_1_CS_PIN, V); break; default: WRITE(TEMP_0_CS_PIN, V); } }while(0)
|
||||||
#define MAX6675_SET_OUTPUT() do{ switch (hindex) { case 1: SET_OUTPUT(MAX6675_SS2_PIN); break; default: SET_OUTPUT(MAX6675_SS_PIN); } }while(0)
|
|
||||||
#else
|
#else
|
||||||
|
// When we have only 1 max tc, THERMO_SEL will pick the appropriate sensor
|
||||||
|
// variable, and MAXTC_*() macros will be hardcoded to the correct CS pin.
|
||||||
constexpr uint8_t hindex = 0;
|
constexpr uint8_t hindex = 0;
|
||||||
#define THERMO_TEMP(I) max_tc_temp
|
#define THERMO_TEMP(I) max_tc_temp
|
||||||
#if TEMP_SENSOR_IS_ANY_MAX_TC(1)
|
#if TEMP_SENSOR_IS_ANY_MAX_TC(0)
|
||||||
#define THERMO_SEL(A,B) B
|
|
||||||
#else
|
|
||||||
#define THERMO_SEL(A,B) A
|
#define THERMO_SEL(A,B) A
|
||||||
#endif
|
#define MAXTC_CS_WRITE(V) WRITE(TEMP_0_CS_PIN, V)
|
||||||
#if TEMP_SENSOR_IS_MAX(0, MAX6675)
|
|
||||||
#define MAX6675_WRITE(V) WRITE(MAX6675_SS_PIN, V)
|
|
||||||
#define MAX6675_SET_OUTPUT() SET_OUTPUT(MAX6675_SS_PIN)
|
|
||||||
#else
|
#else
|
||||||
#define MAX6675_WRITE(V) WRITE(MAX6675_SS2_PIN, V)
|
#define THERMO_SEL(A,B) B
|
||||||
#define MAX6675_SET_OUTPUT() SET_OUTPUT(MAX6675_SS2_PIN)
|
#define MAXTC_CS_WRITE(V) WRITE(TEMP_1_CS_PIN, V)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static TERN(HAS_MAX31855, uint32_t, uint16_t) max_tc_temp = THERMO_SEL(
|
||||||
|
TEMP_SENSOR_0_MAX_TC_TMAX,
|
||||||
|
TEMP_SENSOR_1_MAX_TC_TMAX
|
||||||
|
);
|
||||||
|
|
||||||
static uint8_t max_tc_errors[MAX_TC_COUNT] = { 0 };
|
static uint8_t max_tc_errors[MAX_TC_COUNT] = { 0 };
|
||||||
|
static millis_t next_max_tc_ms[MAX_TC_COUNT] = { 0 };
|
||||||
|
|
||||||
// Return last-read value between readings
|
// Return last-read value between readings
|
||||||
static millis_t next_max_tc_ms[MAX_TC_COUNT] = { 0 };
|
|
||||||
millis_t ms = millis();
|
millis_t ms = millis();
|
||||||
if (PENDING(ms, next_max_tc_ms[hindex])) return int(THERMO_TEMP(hindex));
|
if (PENDING(ms, next_max_tc_ms[hindex]))
|
||||||
next_max_tc_ms[hindex] = ms + MAX6675_HEAT_INTERVAL;
|
return (int16_t)THERMO_TEMP(hindex);
|
||||||
|
|
||||||
//
|
next_max_tc_ms[hindex] = ms + MAXTC_HEAT_INTERVAL;
|
||||||
// TODO: spiBegin, spiRec and spiInit doesn't work when soft spi is used.
|
|
||||||
//
|
|
||||||
#if !THERMO_SEPARATE_SPI && NO_THERMO_TEMPS
|
|
||||||
spiBegin();
|
|
||||||
spiInit(MAX_TC_SPEED_BITS);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if NO_THERMO_TEMPS
|
#if !HAS_MAXTC_LIBRARIES
|
||||||
MAX6675_WRITE(LOW); // enable TT_MAX6675
|
max_tc_temp = 0;
|
||||||
DELAY_NS(100); // Ensure 100ns delay
|
|
||||||
#endif
|
|
||||||
|
|
||||||
max_tc_temp = 0;
|
#if !HAS_MAXTC_SW_SPI
|
||||||
|
// Initialize SPI using the default Hardware SPI bus.
|
||||||
|
// FIXME: spiBegin, spiRec and spiInit doesn't work when soft spi is used.
|
||||||
|
spiBegin();
|
||||||
|
spiInit(MAX_TC_SPEED_BITS);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Read a big-endian temperature value
|
MAXTC_CS_WRITE(LOW); // enable MAXTC
|
||||||
#if NO_THERMO_TEMPS
|
DELAY_NS(100); // Ensure 100ns delay
|
||||||
|
|
||||||
|
// Read a big-endian temperature value without using a library
|
||||||
for (uint8_t i = sizeof(max_tc_temp); i--;) {
|
for (uint8_t i = sizeof(max_tc_temp); i--;) {
|
||||||
max_tc_temp |= TERN(THERMO_SEPARATE_SPI, max_tc_spi.receive(), spiRec());
|
max_tc_temp |= TERN(HAS_MAXTC_SW_SPI, max_tc_spi.receive(), spiRec());
|
||||||
if (i > 0) max_tc_temp <<= 8; // shift left if not the last byte
|
if (i > 0) max_tc_temp <<= 8; // shift left if not the last byte
|
||||||
}
|
}
|
||||||
MAX6675_WRITE(HIGH); // disable TT_MAX6675
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAS_MAX31855_TEMP
|
MAXTC_CS_WRITE(HIGH); // disable MAXTC
|
||||||
Adafruit_MAX31855 &max855ref = THERMO_SEL(max31855_0, max31855_1);
|
#else
|
||||||
max_tc_temp = max855ref.readRaw32();
|
#if HAS_MAX6675_LIBRARY
|
||||||
#endif
|
MAX6675 &max6675ref = THERMO_SEL(max6675_0, max6675_1);
|
||||||
|
max_tc_temp = max6675ref.readRaw16();
|
||||||
|
#endif
|
||||||
|
|
||||||
#if HAS_MAX31865_TEMP
|
#if HAS_MAX31855_LIBRARY
|
||||||
Adafruit_MAX31865 &max865ref = THERMO_SEL(max31865_0, max31865_1);
|
MAX31855 &max855ref = THERMO_SEL(max31855_0, max31855_1);
|
||||||
#if ENABLED(LIB_USR_MAX31865)
|
max_tc_temp = max855ref.readRaw32();
|
||||||
max_tc_temp = max865ref.readRTD_with_Fault();
|
#endif
|
||||||
|
|
||||||
|
#if HAS_MAX31865
|
||||||
|
MAX31865 &max865ref = THERMO_SEL(max31865_0, max31865_1);
|
||||||
|
max_tc_temp = TERN(LIB_INTERNAL_MAX31865, max865ref.readRaw(), max865ref.readRTD_with_Fault());
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_MAX6675_TEMP
|
// Handle an error. If there have been more than THERMOCOUPLE_MAX_ERRORS, send an error over serial.
|
||||||
MAX6675 &max6675ref = THERMO_SEL(max6675_0, max6675_1);
|
// Either way, return the TMAX for the thermocouple to trigger a max_temp_error()
|
||||||
max_tc_temp = max6675ref.readRaw16();
|
if (max_tc_temp & MAX_TC_ERROR_MASK) {
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLED(LIB_ADAFRUIT_MAX31865)
|
|
||||||
const uint8_t fault_31865 = max865ref.readFault() & 0x3FU;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (DISABLED(IGNORE_THERMOCOUPLE_ERRORS)
|
|
||||||
&& TERN(LIB_ADAFRUIT_MAX31865, fault_31865, (max_tc_temp & MAX_TC_ERROR_MASK))
|
|
||||||
) {
|
|
||||||
max_tc_errors[hindex]++;
|
max_tc_errors[hindex]++;
|
||||||
|
|
||||||
if (max_tc_errors[hindex] > THERMOCOUPLE_MAX_ERRORS) {
|
if (max_tc_errors[hindex] > THERMOCOUPLE_MAX_ERRORS) {
|
||||||
SERIAL_ERROR_START();
|
SERIAL_ERROR_START();
|
||||||
SERIAL_ECHOPGM("Temp measurement error! ");
|
SERIAL_ECHOPGM("Temp measurement error! ");
|
||||||
#if MAX_TC_ERROR_MASK == 7
|
#if HAS_MAX31855
|
||||||
SERIAL_ECHOPGM("MAX31855 Fault : (", max_tc_temp & 0x7, ") >> ");
|
SERIAL_ECHOPAIR("MAX31855 Fault: (", max_tc_temp & 0x7, ") >> ");
|
||||||
if (max_tc_temp & 0x1)
|
if (max_tc_temp & 0x1)
|
||||||
SERIAL_ECHOLNPGM("Open Circuit");
|
SERIAL_ECHOLNPGM("Open Circuit");
|
||||||
else if (max_tc_temp & 0x2)
|
else if (max_tc_temp & 0x2)
|
||||||
|
@ -2738,59 +2731,46 @@ void Temperature::disable_all_heaters() {
|
||||||
else if (max_tc_temp & 0x4)
|
else if (max_tc_temp & 0x4)
|
||||||
SERIAL_ECHOLNPGM("Short to VCC");
|
SERIAL_ECHOLNPGM("Short to VCC");
|
||||||
#elif HAS_MAX31865
|
#elif HAS_MAX31865
|
||||||
#if ENABLED(LIB_USR_MAX31865)
|
const uint8_t fault_31865 = max865ref.readFault();
|
||||||
// At the present time we do not have the ability to set the MAX31865 HIGH threshold
|
|
||||||
// or thr LOW threshold, so no need to check for them, zero these bits out
|
|
||||||
const uint8_t fault_31865 = max865ref.readFault() & 0x3FU;
|
|
||||||
#endif
|
|
||||||
max865ref.clearFault();
|
max865ref.clearFault();
|
||||||
if (fault_31865) {
|
if (fault_31865) {
|
||||||
SERIAL_EOL();
|
SERIAL_EOL();
|
||||||
SERIAL_ECHOLNPAIR("\nMAX31865 Fault :(", fault_31865, ") >>");
|
SERIAL_ECHOLNPAIR("\nMAX31865 Fault: (", fault_31865, ") >>");
|
||||||
if (fault_31865 & MAX31865_FAULT_HIGHTHRESH)
|
if (fault_31865 & MAX31865_FAULT_HIGHTHRESH)
|
||||||
SERIAL_ECHOLNPGM("RTD High Threshold");
|
SERIAL_ECHOLNPGM("RTD High Threshold");
|
||||||
if (fault_31865 & MAX31865_FAULT_LOWTHRESH)
|
if (fault_31865 & MAX31865_FAULT_LOWTHRESH)
|
||||||
SERIAL_ECHOLNPGM("RTD Low Threshold");
|
SERIAL_ECHOLNPGM("RTD Low Threshold");
|
||||||
if (fault_31865 & MAX31865_FAULT_REFINLOW)
|
if (fault_31865 & MAX31865_FAULT_REFINLOW)
|
||||||
SERIAL_ECHOLNPGM("REFIN- > 0.85 x Bias");
|
SERIAL_ECHOLNPGM("REFIN- > 0.85 x V bias");
|
||||||
if (fault_31865 & MAX31865_FAULT_REFINHIGH)
|
if (fault_31865 & MAX31865_FAULT_REFINHIGH)
|
||||||
SERIAL_ECHOLNPGM("REFIN- < 0.85 x Bias - FORCE- open");
|
SERIAL_ECHOLNPGM("REFIN- < 0.85 x V bias (FORCE- open)");
|
||||||
if (fault_31865 & MAX31865_FAULT_RTDINLOW)
|
if (fault_31865 & MAX31865_FAULT_RTDINLOW)
|
||||||
SERIAL_ECHOLNPGM("REFIN- < 0.85 x Bias - FORCE- open");
|
SERIAL_ECHOLNPGM("REFIN- < 0.85 x V bias (FORCE- open)");
|
||||||
if (fault_31865 & MAX31865_FAULT_OVUV)
|
if (fault_31865 & MAX31865_FAULT_OVUV)
|
||||||
SERIAL_ECHOLNPGM("Under/Over voltage");
|
SERIAL_ECHOLNPGM("Under/Over voltage");
|
||||||
}
|
}
|
||||||
#else
|
#else // MAX6675
|
||||||
SERIAL_ECHOLNPGM("MAX6675 Open Circuit");
|
SERIAL_ECHOLNPGM("MAX6675 Fault: Open Circuit");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Thermocouple open
|
// Set thermocouple above max temperature (TMAX)
|
||||||
max_tc_temp = 4 * THERMO_SEL(TEMP_SENSOR_0_MAX_TC_TMAX, TEMP_SENSOR_1_MAX_TC_TMAX);
|
max_tc_temp = THERMO_SEL(TEMP_SENSOR_0_MAX_TC_TMAX, TEMP_SENSOR_1_MAX_TC_TMAX) << (MAX_TC_DISCARD_BITS + 1);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
max_tc_temp >>= MAX_TC_DISCARD_BITS;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
max_tc_temp >>= MAX_TC_DISCARD_BITS;
|
max_tc_errors[hindex] = 0; // No error bit, reset error count
|
||||||
max_tc_errors[hindex] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_MAX31855
|
max_tc_temp >>= MAX_TC_DISCARD_BITS;
|
||||||
if (max_tc_temp & 0x00002000) max_tc_temp |= 0xFFFFC000; // Support negative temperature
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Return the RTD resistance for MAX31865 for display in SHOW_TEMP_ADC_VALUES
|
#if HAS_MAX31855
|
||||||
#if HAS_MAX31865_TEMP
|
// Support negative temperature for MAX38155
|
||||||
#if ENABLED(LIB_ADAFRUIT_MAX31865)
|
if (max_tc_temp & 0x00002000) max_tc_temp |= 0xFFFFC000;
|
||||||
max_tc_temp = (uint32_t(max865ref.readRTD()) * THERMO_SEL(MAX31865_CALIBRATION_OHMS_0, MAX31865_CALIBRATION_OHMS_1)) >> 16;
|
|
||||||
#elif ENABLED(LIB_USR_MAX31865)
|
|
||||||
max_tc_temp = (uint32_t(max_tc_temp) * THERMO_SEL(MAX31865_CALIBRATION_OHMS_0, MAX31865_CALIBRATION_OHMS_1)) >> 16;
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
THERMO_TEMP(hindex) = max_tc_temp;
|
THERMO_TEMP(hindex) = max_tc_temp;
|
||||||
|
|
||||||
return int(max_tc_temp);
|
return (int16_t)max_tc_temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_MAX_TC
|
#endif // HAS_MAX_TC
|
||||||
|
@ -2815,16 +2795,16 @@ void Temperature::update_raw_temperatures() {
|
||||||
temp_redundant.update();
|
temp_redundant.update();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TERN_(HAS_TEMP_ADC_2, temp_hotend[2].update());
|
TERN_(HAS_TEMP_ADC_2, temp_hotend[2].update());
|
||||||
TERN_(HAS_TEMP_ADC_3, temp_hotend[3].update());
|
TERN_(HAS_TEMP_ADC_3, temp_hotend[3].update());
|
||||||
TERN_(HAS_TEMP_ADC_4, temp_hotend[4].update());
|
TERN_(HAS_TEMP_ADC_4, temp_hotend[4].update());
|
||||||
TERN_(HAS_TEMP_ADC_5, temp_hotend[5].update());
|
TERN_(HAS_TEMP_ADC_5, temp_hotend[5].update());
|
||||||
TERN_(HAS_TEMP_ADC_6, temp_hotend[6].update());
|
TERN_(HAS_TEMP_ADC_6, temp_hotend[6].update());
|
||||||
TERN_(HAS_TEMP_ADC_7, temp_hotend[7].update());
|
TERN_(HAS_TEMP_ADC_7, temp_hotend[7].update());
|
||||||
TERN_(HAS_TEMP_ADC_BED, temp_bed.update());
|
TERN_(HAS_TEMP_ADC_BED, temp_bed.update());
|
||||||
TERN_(HAS_TEMP_ADC_CHAMBER, temp_chamber.update());
|
TERN_(HAS_TEMP_ADC_CHAMBER, temp_chamber.update());
|
||||||
TERN_(HAS_TEMP_ADC_PROBE, temp_probe.update());
|
TERN_(HAS_TEMP_ADC_PROBE, temp_probe.update());
|
||||||
TERN_(HAS_TEMP_ADC_COOLER, temp_cooler.update());
|
TERN_(HAS_TEMP_ADC_COOLER, temp_cooler.update());
|
||||||
|
|
||||||
TERN_(HAS_JOY_ADC_X, joystick.x.update());
|
TERN_(HAS_JOY_ADC_X, joystick.x.update());
|
||||||
TERN_(HAS_JOY_ADC_Y, joystick.y.update());
|
TERN_(HAS_JOY_ADC_Y, joystick.y.update());
|
||||||
|
@ -3465,7 +3445,7 @@ void Temperature::isr() {
|
||||||
SERIAL_PRINT(t, SFP);
|
SERIAL_PRINT(t, SFP);
|
||||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||||
// Temperature MAX SPI boards do not have an OVERSAMPLENR defined
|
// Temperature MAX SPI boards do not have an OVERSAMPLENR defined
|
||||||
SERIAL_ECHOPAIR(" (", TERN(NO_THERMO_TEMPS, false, k == 'T') ? r : r * RECIPROCAL(OVERSAMPLENR));
|
SERIAL_ECHOPAIR(" (", TERN(HAS_MAXTC_LIBRARIES, k == 'T', false) ? r : r * RECIPROCAL(OVERSAMPLENR));
|
||||||
SERIAL_CHAR(')');
|
SERIAL_CHAR(')');
|
||||||
#endif
|
#endif
|
||||||
delay(2);
|
delay(2);
|
||||||
|
|
|
@ -428,6 +428,15 @@ class Temperature {
|
||||||
|
|
||||||
static heater_idle_t heater_idle[NR_HEATER_IDLE];
|
static heater_idle_t heater_idle[NR_HEATER_IDLE];
|
||||||
|
|
||||||
|
#endif // HEATER_IDLE_TIMER
|
||||||
|
|
||||||
|
#if HAS_ADC_BUTTONS
|
||||||
|
static uint32_t current_ADCKey_raw;
|
||||||
|
static uint16_t ADCKey_count;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ENABLED(PID_EXTRUSION_SCALING)
|
||||||
|
static int16_t lpq_len;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -486,15 +495,6 @@ class Temperature {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
#if HAS_ADC_BUTTONS
|
|
||||||
static uint32_t current_ADCKey_raw;
|
|
||||||
static uint16_t ADCKey_count;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLED(PID_EXTRUSION_SCALING)
|
|
||||||
static int16_t lpq_len;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instance Methods
|
* Instance Methods
|
||||||
*/
|
*/
|
||||||
|
@ -915,7 +915,7 @@ class Temperature {
|
||||||
#else
|
#else
|
||||||
#define READ_MAX_TC(N) read_max_tc()
|
#define READ_MAX_TC(N) read_max_tc()
|
||||||
#endif
|
#endif
|
||||||
static int read_max_tc(TERN_(HAS_MULTI_MAX_TC, const uint8_t hindex=0));
|
static int16_t read_max_tc(TERN_(HAS_MULTI_MAX_TC, const uint8_t hindex=0));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void checkExtruderAutoFans();
|
static void checkExtruderAutoFans();
|
||||||
|
|
|
@ -133,11 +133,11 @@
|
||||||
#define TEMP_1_PIN 1 // Analog Input
|
#define TEMP_1_PIN 1 // Analog Input
|
||||||
#define TEMP_BED_PIN 2 // Analog Input
|
#define TEMP_BED_PIN 2 // Analog Input
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for MAX Thermocouple
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS_PIN 66 // Don't use 53 if using Display/SD card
|
#define TEMP_0_CS_PIN 66 // Don't use 53 if using Display/SD card
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS_PIN 66 // Don't use 49 (SD_DETECT_PIN)
|
#define TEMP_0_CS_PIN 66 // Don't use 49 (SD_DETECT_PIN)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -73,6 +73,19 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// CS, MISO, MOSI, and SCK for MAX Thermocouple SPI
|
||||||
|
#if HAS_MAX_TC
|
||||||
|
//#define TEMP_0_CS_PIN P...
|
||||||
|
//#define TEMP_0_MISO_PIN P...
|
||||||
|
//#define TEMP_0_MOSI_PIN P...
|
||||||
|
//#define TEMP_0_SCK_PIN P...
|
||||||
|
|
||||||
|
//#define TEMP_1_CS_PIN P...
|
||||||
|
//#define TEMP_1_MISO_PIN P...
|
||||||
|
//#define TEMP_1_MOSI_PIN P...
|
||||||
|
//#define TEMP_1_SCK_PIN P...
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Heaters / Fans
|
// Heaters / Fans
|
||||||
//
|
//
|
||||||
|
|
|
@ -248,8 +248,8 @@
|
||||||
|
|
||||||
#define PS_ON_PIN P2_12 // (12)
|
#define PS_ON_PIN P2_12 // (12)
|
||||||
|
|
||||||
#if !defined(MAX6675_SS_PIN) && DISABLED(USE_ZMAX_PLUG)
|
#if !defined(TEMP_0_CS_PIN) && DISABLED(USE_ZMAX_PLUG)
|
||||||
#define MAX6675_SS_PIN P1_28
|
#define TEMP_0_CS_PIN P1_28
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(CASE_LIGHT_ENABLE) && !PIN_EXISTS(CASE_LIGHT) && !defined(SPINDLE_LASER_ENA_PIN)
|
#if ENABLED(CASE_LIGHT_ENABLE) && !PIN_EXISTS(CASE_LIGHT) && !defined(SPINDLE_LASER_ENA_PIN)
|
||||||
|
|
|
@ -72,17 +72,17 @@
|
||||||
#define TEMP_BED_PIN 15 // Analog Input
|
#define TEMP_BED_PIN 15 // Analog Input
|
||||||
|
|
||||||
// Extruder thermocouples 0 and 1 are read out by two separate ICs using
|
// Extruder thermocouples 0 and 1 are read out by two separate ICs using
|
||||||
// SPI for Max6675 Thermocouple
|
// SPI for MAX Thermocouple
|
||||||
// Uses a separate SPI bus
|
// Uses a separate SPI bus
|
||||||
#define THERMO_SCK_PIN 78 // E2 - SCK
|
#define TEMP_0_CS_PIN 5 // E3 - CS0
|
||||||
#define THERMO_DO_PIN 3 // E5 - DO
|
#define TEMP_0_SCK_PIN 78 // E2 - SCK
|
||||||
#define THERMO_CS1_PIN 5 // E3 - CS0
|
#define TEMP_0_MISO_PIN 3 // E5 - MISO
|
||||||
#define THERMO_CS2_PIN 2 // E4 - CS1
|
//#define TEMP_0_MOSI_PIN ... // For MAX31865
|
||||||
|
|
||||||
#define MAX6675_SS_PIN THERMO_CS1_PIN
|
#define TEMP_1_CS_PIN 2 // E4 - CS1
|
||||||
#define MAX6675_SS2_PIN THERMO_CS2_PIN
|
#define TEMP_1_SCK_PIN TEMP_0_SCK_PIN
|
||||||
#define MAX6675_SCK_PIN THERMO_SCK_PIN
|
#define TEMP_1_MISO_PIN TEMP_0_MISO_PIN
|
||||||
#define MAX6675_DO_PIN THERMO_DO_PIN
|
//#define TEMP_1_MOSI_PIN TEMP_0_MOSI_PIN
|
||||||
|
|
||||||
//
|
//
|
||||||
// Heaters / Fans
|
// Heaters / Fans
|
||||||
|
|
|
@ -125,7 +125,7 @@
|
||||||
// K7 - 69 / ADC15 - 15
|
// K7 - 69 / ADC15 - 15
|
||||||
#define TEMP_BED_PIN 15
|
#define TEMP_BED_PIN 15
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for MAX Thermocouple
|
||||||
// Uses a separate SPI bus
|
// Uses a separate SPI bus
|
||||||
//
|
//
|
||||||
// 3 E5 DO (SO)
|
// 3 E5 DO (SO)
|
||||||
|
@ -133,15 +133,15 @@
|
||||||
// 2 E4 CS2
|
// 2 E4 CS2
|
||||||
// 78 E2 SCK
|
// 78 E2 SCK
|
||||||
//
|
//
|
||||||
#define THERMO_SCK_PIN 78 // E2
|
#define TEMP_0_CS_PIN 5 // E3
|
||||||
#define THERMO_DO_PIN 3 // E5
|
#define TEMP_0_SCK_PIN 78 // E2
|
||||||
#define THERMO_CS1_PIN 5 // E3
|
#define TEMP_0_MISO_PIN 3 // E5
|
||||||
#define THERMO_CS2_PIN 2 // E4
|
//#define TEMP_0_MOSI_PIN ... // For MAX31865
|
||||||
|
|
||||||
#define MAX6675_SS_PIN THERMO_CS1_PIN
|
#define TEMP_1_CS_PIN 2 // E4
|
||||||
#define MAX6675_SS2_PIN THERMO_CS2_PIN
|
#define TEMP_1_SCK_PIN TEMP_0_SCK_PIN
|
||||||
#define MAX6675_SCK_PIN THERMO_SCK_PIN
|
#define TEMP_1_MISO_PIN TEMP_0_MISO_PIN
|
||||||
#define MAX6675_DO_PIN THERMO_DO_PIN
|
//#define TEMP_1_MOSI_PIN TEMP_0_MOSI_PIN
|
||||||
|
|
||||||
//
|
//
|
||||||
// Augmentation for auto-assigning plugs
|
// Augmentation for auto-assigning plugs
|
||||||
|
|
|
@ -118,11 +118,11 @@
|
||||||
|
|
||||||
#define SSR_PIN 6
|
#define SSR_PIN 6
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for MAX Thermocouple
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS_PIN 66 // Don't use 53 if using Display/SD card
|
#define TEMP_0_CS_PIN 66 // Don't use 53 if using Display/SD card
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS_PIN 66 // Don't use 49 (SD_DETECT_PIN)
|
#define TEMP_0_CS_PIN 66 // Don't use 49 (SD_DETECT_PIN)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -760,17 +760,29 @@
|
||||||
#if PIN_EXISTS(LED_RED)
|
#if PIN_EXISTS(LED_RED)
|
||||||
REPORT_NAME_DIGITAL(__LINE__, LED_RED_PIN)
|
REPORT_NAME_DIGITAL(__LINE__, LED_RED_PIN)
|
||||||
#endif
|
#endif
|
||||||
#if PIN_EXISTS(MAX6675_DO)
|
#if PIN_EXISTS(TEMP_0_CS)
|
||||||
REPORT_NAME_DIGITAL(__LINE__, MAX6675_DO_PIN)
|
REPORT_NAME_DIGITAL(__LINE__, TEMP_0_CS_PIN)
|
||||||
#endif
|
#endif
|
||||||
#if PIN_EXISTS(MAX6675_SCK)
|
#if PIN_EXISTS(TEMP_0_SCK)
|
||||||
REPORT_NAME_DIGITAL(__LINE__, MAX6675_SCK_PIN)
|
REPORT_NAME_DIGITAL(__LINE__, TEMP_0_SCK_PIN)
|
||||||
#endif
|
#endif
|
||||||
#if PIN_EXISTS(MAX6675_SS)
|
#if PIN_EXISTS(TEMP_0_MOSI)
|
||||||
REPORT_NAME_DIGITAL(__LINE__, MAX6675_SS_PIN)
|
REPORT_NAME_DIGITAL(__LINE__, TEMP_0_MOSI_PIN)
|
||||||
#endif
|
#endif
|
||||||
#if PIN_EXISTS(MAX6675_SS2)
|
#if PIN_EXISTS(TEMP_0_MISO)
|
||||||
REPORT_NAME_DIGITAL(__LINE__, MAX6675_SS2_PIN)
|
REPORT_NAME_DIGITAL(__LINE__, TEMP_0_MISO_PIN)
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(TEMP_1_CS)
|
||||||
|
REPORT_NAME_DIGITAL(__LINE__, TEMP_1_CS_PIN)
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(TEMP_1_SCK)
|
||||||
|
REPORT_NAME_DIGITAL(__LINE__, TEMP_1_SCK_PIN)
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(TEMP_1_MOSI)
|
||||||
|
REPORT_NAME_DIGITAL(__LINE__, TEMP_1_MOSI_PIN)
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(TEMP_1_MISO)
|
||||||
|
REPORT_NAME_DIGITAL(__LINE__, TEMP_1_MISO_PIN)
|
||||||
#endif
|
#endif
|
||||||
#if PIN_EXISTS(MAX7219_CLK)
|
#if PIN_EXISTS(MAX7219_CLK)
|
||||||
REPORT_NAME_DIGITAL(__LINE__, MAX7219_CLK_PIN)
|
REPORT_NAME_DIGITAL(__LINE__, MAX7219_CLK_PIN)
|
||||||
|
@ -1010,18 +1022,6 @@
|
||||||
#if PIN_EXISTS(SUICIDE)
|
#if PIN_EXISTS(SUICIDE)
|
||||||
REPORT_NAME_DIGITAL(__LINE__, SUICIDE_PIN)
|
REPORT_NAME_DIGITAL(__LINE__, SUICIDE_PIN)
|
||||||
#endif
|
#endif
|
||||||
#if PIN_EXISTS(THERMO_CS1)
|
|
||||||
REPORT_NAME_DIGITAL(__LINE__, THERMO_CS1_PIN)
|
|
||||||
#endif
|
|
||||||
#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)
|
|
||||||
#endif
|
|
||||||
#if PIN_EXISTS(THERMO_SCK)
|
|
||||||
REPORT_NAME_DIGITAL(__LINE__, THERMO_SCK_PIN)
|
|
||||||
#endif
|
|
||||||
#if PIN_EXISTS(TLC_BLANK)
|
#if PIN_EXISTS(TLC_BLANK)
|
||||||
REPORT_NAME_DIGITAL(__LINE__, TLC_BLANK_PIN)
|
REPORT_NAME_DIGITAL(__LINE__, TLC_BLANK_PIN)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -171,10 +171,10 @@
|
||||||
#define SPINDLE_DIR_PIN 32
|
#define SPINDLE_DIR_PIN 32
|
||||||
|
|
||||||
//
|
//
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for MAX Thermocouple
|
||||||
//
|
//
|
||||||
#ifndef MAX6675_SS_PIN
|
#ifndef TEMP_0_CS_PIN
|
||||||
#define MAX6675_SS_PIN 32 // SPINDLE_DIR_PIN / STAT_LED_BLUE_PIN
|
#define TEMP_0_CS_PIN 32 // SPINDLE_DIR_PIN / STAT_LED_BLUE_PIN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -114,11 +114,11 @@
|
||||||
#define TEMP_1_PIN 15 // Analog Input
|
#define TEMP_1_PIN 15 // Analog Input
|
||||||
#define TEMP_BED_PIN 14 // Analog Input
|
#define TEMP_BED_PIN 14 // Analog Input
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for MAX Thermocouple
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS_PIN 66 // Don't use 53 if using Display/SD card
|
#define TEMP_0_CS_PIN 66 // Don't use 53 if using Display/SD card
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS_PIN 66 // Don't use 49 (SD_DETECT_PIN)
|
#define TEMP_0_CS_PIN 66 // Don't use 49 (SD_DETECT_PIN)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -111,11 +111,11 @@
|
||||||
#define TEMP_1_PIN 15 // Analog Input
|
#define TEMP_1_PIN 15 // Analog Input
|
||||||
#define TEMP_BED_PIN 3 // Analog Input
|
#define TEMP_BED_PIN 3 // Analog Input
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for MAX Thermocouple
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS_PIN 66 // Don't use 53 if using Display/SD card
|
#define TEMP_0_CS_PIN 66 // Don't use 53 if using Display/SD card
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS_PIN 66 // Don't use 49 (SD_DETECT_PIN)
|
#define TEMP_0_CS_PIN 66 // Don't use 49 (SD_DETECT_PIN)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -111,11 +111,11 @@
|
||||||
#define TEMP_1_PIN 15 // Analog Input
|
#define TEMP_1_PIN 15 // Analog Input
|
||||||
#define TEMP_BED_PIN 14 // Analog Input
|
#define TEMP_BED_PIN 14 // Analog Input
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for MAX Thermocouple
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS_PIN 66 // Don't use 53 if using Display/SD card
|
#define TEMP_0_CS_PIN 66 // Don't use 53 if using Display/SD card
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS_PIN 66 // Don't use 49 (SD_DETECT_PIN)
|
#define TEMP_0_CS_PIN 66 // Don't use 49 (SD_DETECT_PIN)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -167,10 +167,10 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for MAX Thermocouple
|
||||||
//
|
//
|
||||||
#ifndef MAX6675_SS_PIN
|
#ifndef TEMP_0_CS_PIN
|
||||||
#define MAX6675_SS_PIN 66 // Don't use 53 if using Display/SD card (SDSS) or 49 (SD_DETECT_PIN)
|
#define TEMP_0_CS_PIN 66 // Don't use 53 if using Display/SD card (SDSS) or 49 (SD_DETECT_PIN)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -74,11 +74,11 @@
|
||||||
#define TEMP_0_PIN 2 // Analog Input
|
#define TEMP_0_PIN 2 // Analog Input
|
||||||
#define TEMP_BED_PIN 1 // Analog Input
|
#define TEMP_BED_PIN 1 // Analog Input
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for MAX Thermocouple
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS_PIN 66 // Don't use 53 if using Display/SD card
|
#define TEMP_0_CS_PIN 66 // Don't use 53 if using Display/SD card
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS_PIN 66 // Don't use 49 (SD_DETECT_PIN)
|
#define TEMP_0_CS_PIN 66 // Don't use 49 (SD_DETECT_PIN)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -75,12 +75,12 @@
|
||||||
#define TEMP_1_PIN 13 // Analog Input
|
#define TEMP_1_PIN 13 // Analog Input
|
||||||
#define TEMP_BED_PIN 15 // Analog Input
|
#define TEMP_BED_PIN 15 // Analog Input
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for MAX Thermocouple
|
||||||
#undef MAX6675_SS_PIN
|
#undef TEMP_0_CS_PIN
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS_PIN 53 // Don't use pin 53 if there is even the remote possibility of using Display/SD card
|
#define TEMP_0_CS_PIN 53 // Don't use pin 53 if there is even the remote possibility of using Display/SD card
|
||||||
#else
|
#else
|
||||||
#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
|
#define TEMP_0_CS_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
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -123,11 +123,11 @@
|
||||||
#define TEMP_1_PIN 15 // Analog Input
|
#define TEMP_1_PIN 15 // Analog Input
|
||||||
#define TEMP_BED_PIN 14 // Analog Input
|
#define TEMP_BED_PIN 14 // Analog Input
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for MAX Thermocouple
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS_PIN -1 // Don't use 53 if using Display/SD card
|
#define TEMP_0_CS_PIN -1 // Don't use 53 if using Display/SD card
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS_PIN -1 // Don't use 49 (SD_DETECT_PIN)
|
#define TEMP_0_CS_PIN -1 // Don't use 49 (SD_DETECT_PIN)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -181,11 +181,11 @@
|
||||||
#define TEMP_4_PIN 12
|
#define TEMP_4_PIN 12
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for MAX Thermocouple
|
||||||
//#if DISABLED(SDSUPPORT)
|
//#if DISABLED(SDSUPPORT)
|
||||||
// #define MAX6675_SS_PIN 66 // Don't use 53 if using Display/SD card
|
// #define TEMP_0_CS_PIN 66 // Don't use 53 if using Display/SD card
|
||||||
//#else
|
//#else
|
||||||
// #define MAX6675_SS_PIN 66 // Don't use 49 (SD_DETECT_PIN)
|
// #define TEMP_0_CS_PIN 66 // Don't use 49 (SD_DETECT_PIN)
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -82,11 +82,11 @@
|
||||||
#define TEMP_2_PIN 5 // Analog Input (unused)
|
#define TEMP_2_PIN 5 // Analog Input (unused)
|
||||||
#define TEMP_BED_PIN 1 // Analog Input (BED thermistor)
|
#define TEMP_BED_PIN 1 // Analog Input (BED thermistor)
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for MAX Thermocouple
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS_PIN -1
|
#define TEMP_0_CS_PIN -1
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS_PIN -1
|
#define TEMP_0_CS_PIN -1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -71,11 +71,11 @@
|
||||||
#define TEMP_2_PIN 5 // Analog Input (OnBoard thermistor beta 3950)
|
#define TEMP_2_PIN 5 // Analog Input (OnBoard thermistor beta 3950)
|
||||||
#define TEMP_BED_PIN 1 // Analog Input (BED thermistor)
|
#define TEMP_BED_PIN 1 // Analog Input (BED thermistor)
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for MAX Thermocouple
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS_PIN 53
|
#define TEMP_0_CS_PIN 53
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS_PIN 53
|
#define TEMP_0_CS_PIN 53
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -179,11 +179,11 @@
|
||||||
#define TEMP_4_PIN 5 // dummy so will compile when PINS_DEBUGGING is enabled
|
#define TEMP_4_PIN 5 // dummy so will compile when PINS_DEBUGGING is enabled
|
||||||
#define TEMP_BED_PIN 4 // Analog Input
|
#define TEMP_BED_PIN 4 // Analog Input
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for MAX Thermocouple
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS_PIN 53
|
#define TEMP_0_CS_PIN 53
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS_PIN 49
|
#define TEMP_0_CS_PIN 49
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -60,12 +60,12 @@
|
||||||
#undef TEMP_BED_PIN
|
#undef TEMP_BED_PIN
|
||||||
#define TEMP_BED_PIN 10 // Analog Input
|
#define TEMP_BED_PIN 10 // Analog Input
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for MAX Thermocouple
|
||||||
#undef MAX6675_SS_PIN
|
#undef TEMP_0_CS_PIN
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS_PIN 69 // Don't use 53 if using Display/SD card
|
#define TEMP_0_CS_PIN 69 // Don't use 53 if using Display/SD card
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS_PIN 69 // Don't use 49 (SD_DETECT_PIN)
|
#define TEMP_0_CS_PIN 69 // Don't use 49 (SD_DETECT_PIN)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -109,11 +109,11 @@
|
||||||
#define TEMP_2_PIN 3 // Analog Input
|
#define TEMP_2_PIN 3 // Analog Input
|
||||||
#define TEMP_BED_PIN 0 // Analog Input
|
#define TEMP_BED_PIN 0 // Analog Input
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for MAX Thermocouple
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS_PIN 53
|
#define TEMP_0_CS_PIN 53
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS_PIN 49
|
#define TEMP_0_CS_PIN 49
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -94,12 +94,12 @@
|
||||||
#undef TEMP_BED_PIN
|
#undef TEMP_BED_PIN
|
||||||
#define TEMP_BED_PIN 11 // Analog Input
|
#define TEMP_BED_PIN 11 // Analog Input
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for MAX Thermocouple
|
||||||
#undef MAX6675_SS_PIN
|
#undef TEMP_0_CS_PIN
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS_PIN 67 // Don't use 53 if using Display/SD card
|
#define TEMP_0_CS_PIN 67 // Don't use 53 if using Display/SD card
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS_PIN 67 // Don't use 49 (SD_DETECT_PIN)
|
#define TEMP_0_CS_PIN 67 // Don't use 49 (SD_DETECT_PIN)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -156,12 +156,12 @@
|
||||||
#define TEMP_5_PIN 6 // A6 (Marlin 2.0 not support)
|
#define TEMP_5_PIN 6 // A6 (Marlin 2.0 not support)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for MAX Thermocouple
|
||||||
/*
|
/*
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS_PIN 53
|
#define TEMP_0_CS_PIN 53
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS_PIN 49
|
#define TEMP_0_CS_PIN 49
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -142,12 +142,12 @@
|
||||||
#define TEMP_5_PIN 6 // A6 (Marlin 2.0 not support)
|
#define TEMP_5_PIN 6 // A6 (Marlin 2.0 not support)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for MAX Thermocouple
|
||||||
/*
|
/*
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS_PIN 53
|
#define TEMP_0_CS_PIN 53
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS_PIN 49
|
#define TEMP_0_CS_PIN 49
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -149,12 +149,11 @@
|
||||||
#define SD_MISO_PIN 74
|
#define SD_MISO_PIN 74
|
||||||
#define SD_MOSI_PIN 75
|
#define SD_MOSI_PIN 75
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for MAX Thermocouple
|
||||||
#define MAX6675_SS_PIN 65
|
#define TEMP_0_CS_PIN 65
|
||||||
#define MAX31855_SS0 65
|
#define TEMP_1_CS_PIN 52
|
||||||
#define MAX31855_SS1 52
|
#define TEMP_2_CS_PIN 50
|
||||||
#define MAX31855_SS2 50
|
#define TEMP_3_CS_PIN 51
|
||||||
#define MAX31855_SS3 51
|
|
||||||
|
|
||||||
#define ENC424_SS 61
|
#define ENC424_SS 61
|
||||||
|
|
||||||
|
|
|
@ -100,10 +100,10 @@
|
||||||
//#define TEMP_0_PIN PB3 // E0 K+
|
//#define TEMP_0_PIN PB3 // E0 K+
|
||||||
#define TEMP_BED_PIN PF7 // THERM_BED
|
#define TEMP_BED_PIN PF7 // THERM_BED
|
||||||
|
|
||||||
#define MAX6675_SS_PIN PB5
|
#define TEMP_0_CS_PIN PB5
|
||||||
#define MAX6675_SCK_PIN PB3
|
#define TEMP_0_SCK_PIN PB3
|
||||||
#define MAX6675_DO_PIN PB4
|
#define TEMP_0_MISO_PIN PB4
|
||||||
#define MAX6675_MOSI_PIN PA14
|
#define TEMP_0_MOSI_PIN PA14
|
||||||
|
|
||||||
//
|
//
|
||||||
// Heaters / Fans
|
// Heaters / Fans
|
||||||
|
|
|
@ -121,8 +121,8 @@
|
||||||
//
|
//
|
||||||
// Thermocouples
|
// Thermocouples
|
||||||
//
|
//
|
||||||
//#define MAX6675_SS_PIN PE5 // TC1 - CS1
|
//#define TEMP_0_CS_PIN PE5 // TC1 - CS1
|
||||||
//#define MAX6675_SS_PIN PE6 // TC2 - CS2
|
//#define TEMP_0_CS_PIN PE6 // TC2 - CS2
|
||||||
|
|
||||||
//
|
//
|
||||||
// Filament runout sensor
|
// Filament runout sensor
|
||||||
|
|
|
@ -124,8 +124,8 @@
|
||||||
//
|
//
|
||||||
// Thermocouples
|
// Thermocouples
|
||||||
//
|
//
|
||||||
//#define MAX6675_SS_PIN PE5 // TC1 - CS1
|
//#define TEMP_0_CS_PIN PE5 // TC1 - CS1
|
||||||
//#define MAX6675_SS_PIN PE6 // TC2 - CS2
|
//#define TEMP_0_CS_PIN PE6 // TC2 - CS2
|
||||||
|
|
||||||
//
|
//
|
||||||
// Misc. Functions
|
// Misc. Functions
|
||||||
|
|
|
@ -188,8 +188,8 @@
|
||||||
//
|
//
|
||||||
// Thermocouples
|
// Thermocouples
|
||||||
//
|
//
|
||||||
//#define MAX6675_SS_PIN PE5 // TC1 - CS1
|
//#define TEMP_0_CS_PIN PE5 // TC1 - CS1
|
||||||
//#define MAX6675_SS_PIN PE6 // TC2 - CS2
|
//#define TEMP_0_CS_PIN PE6 // TC2 - CS2
|
||||||
|
|
||||||
//
|
//
|
||||||
// Misc. Functions
|
// Misc. Functions
|
||||||
|
|
|
@ -175,8 +175,8 @@
|
||||||
/**
|
/**
|
||||||
* Note: MKS Robin Pro board is using SPI2 interface. Make sure your stm32duino library is configured accordingly
|
* Note: MKS Robin Pro board is using SPI2 interface. Make sure your stm32duino library is configured accordingly
|
||||||
*/
|
*/
|
||||||
//#define MAX6675_SS_PIN PE5 // TC1 - CS1
|
//#define TEMP_0_CS_PIN PE5 // TC1 - CS1
|
||||||
//#define MAX6675_SS_PIN PF11 // TC2 - CS2
|
//#define TEMP_0_CS_PIN PF11 // TC2 - CS2
|
||||||
|
|
||||||
#define POWER_LOSS_PIN PA2 // PW_DET
|
#define POWER_LOSS_PIN PA2 // PW_DET
|
||||||
#define PS_ON_PIN PG11 // PW_OFF
|
#define PS_ON_PIN PG11 // PW_OFF
|
||||||
|
|
|
@ -298,19 +298,19 @@
|
||||||
|
|
||||||
#define TEMP_BED_PIN PC0 // T0 <-> Bed
|
#define TEMP_BED_PIN PC0 // T0 <-> Bed
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for MAX Thermocouple
|
||||||
// Uses a separate SPI bus
|
// Uses a separate SPI bus
|
||||||
// If you have a two-way thermocouple, you can customize two THERMO_CSx_PIN pins (x:1~2)
|
// If you have a two-way thermocouple, you can customize two TEMP_x_CS_PIN pins (x:0~1)
|
||||||
|
|
||||||
#define THERMO_SCK_PIN PI1 // SCK
|
#define TEMP_0_CS_PIN PH9 // GTR K-TEMP
|
||||||
#define THERMO_DO_PIN PI2 // MISO
|
#define TEMP_0_SCK_PIN PI1 // SCK
|
||||||
#define THERMO_CS1_PIN PH9 // GTR K-TEMP
|
#define TEMP_0_MISO_PIN PI2 // MISO
|
||||||
#define THERMO_CS2_PIN PH2 // M5 K-TEMP
|
//#define TEMP_0_MOSI_PIN ... // For MAX31865
|
||||||
|
|
||||||
#define MAX6675_SS_PIN THERMO_CS1_PIN
|
#define TEMP_1_CS_PIN PH2 // M5 K-TEMP
|
||||||
#define MAX6675_SS2_PIN THERMO_CS2_PIN
|
#define TEMP_1_SCK_PIN TEMP_0_SCK_PIN
|
||||||
#define MAX6675_SCK_PIN THERMO_SCK_PIN
|
#define TEMP_1_MISO_PIN TEMP_0_MISO_PIN
|
||||||
#define MAX6675_DO_PIN THERMO_DO_PIN
|
//#define TEMP_1_MOSI_PIN TEMP_0_MOSI_PIN
|
||||||
|
|
||||||
//
|
//
|
||||||
// Heaters / Fans
|
// Heaters / Fans
|
||||||
|
|
|
@ -104,16 +104,16 @@
|
||||||
// MAX6675 Cold-Junction-Compensated K-Thermocouple to Digital Converter (0°C to +1024°C)
|
// MAX6675 Cold-Junction-Compensated K-Thermocouple to Digital Converter (0°C to +1024°C)
|
||||||
// https://datasheets.maximintegrated.com/en/ds/MAX6675.pdf
|
// https://datasheets.maximintegrated.com/en/ds/MAX6675.pdf
|
||||||
|
|
||||||
#define MAX6675_SCK_PIN PB3 // max6675 datasheet: SCK pin, found with multimeter, not tested
|
#define TEMP_0_CS_PIN PC4 // max6675 datasheet: /CS pin, found with multimeter, not tested and likely wrong
|
||||||
#define MAX6675_DO_PIN PB4 // max6675 datasheet: SO pin, found with multimeter, not tested
|
#define TEMP_0_SCK_PIN PB3 // max6675 datasheet: SCK pin, found with multimeter, not tested
|
||||||
#define MAX6675_SS_PIN PC4 // max6675 datasheet: /CS pin, found with multimeter, not tested and likely wrong
|
#define TEMP_0_MISO_PIN PB4 // max6675 datasheet: SO pin, found with multimeter, not tested
|
||||||
|
|
||||||
// Expansion board with second max6675
|
// Expansion board with second max6675
|
||||||
// Warning: Some boards leave the slot unpopulated.
|
// Warning: Some boards leave the slot unpopulated.
|
||||||
|
|
||||||
//#define MAX6675_SCK2_PIN PB3 // max6675 datasheet: SCK pin, found with multimeter, not tested
|
//#define TEMP_1_CS_PIN PF1 // max6675 datasheet: /CS pin, found with multimeter, not tested
|
||||||
//#define MAX6675_DO2_PIN PB4 // max6675 datasheet: SO pin, found with multimeter, not tested
|
//#define TEMP_1_SCK_PIN PB3 // max6675 datasheet: SCK pin, found with multimeter, not tested
|
||||||
//#define MAX6675_SS2_PIN PF1 // max6675 datasheet: /CS pin, found with multimeter, not tested
|
//#define TEMP_1_MISO_PIN PB4 // max6675 datasheet: SO pin, found with multimeter, not tested
|
||||||
|
|
||||||
//
|
//
|
||||||
// Heaters / Fans
|
// Heaters / Fans
|
||||||
|
|
|
@ -172,8 +172,8 @@
|
||||||
//
|
//
|
||||||
// Thermocouples
|
// Thermocouples
|
||||||
//
|
//
|
||||||
//#define MAX6675_SS_PIN HEATER_0_PIN // TC1 - CS1
|
//#define TEMP_0_CS_PIN HEATER_0_PIN // TC1 - CS1
|
||||||
//#define MAX6675_SS_PIN HEATER_1_PIN // TC2 - CS2
|
//#define TEMP_0_CS_PIN HEATER_1_PIN // TC2 - CS2
|
||||||
|
|
||||||
//
|
//
|
||||||
// Misc. Functions
|
// Misc. Functions
|
||||||
|
|
|
@ -189,8 +189,8 @@
|
||||||
//
|
//
|
||||||
// Thermocouples
|
// Thermocouples
|
||||||
//
|
//
|
||||||
//#define MAX6675_SS_PIN PE5 // TC1 - CS1
|
//#define TEMP_0_CS_PIN PE5 // TC1 - CS1
|
||||||
//#define MAX6675_SS_PIN PE6 // TC2 - CS2
|
//#define TEMP_0_CS_PIN PE6 // TC2 - CS2
|
||||||
|
|
||||||
//
|
//
|
||||||
// Misc. Functions
|
// Misc. Functions
|
||||||
|
|
|
@ -27,9 +27,9 @@ HAS_TMC26X = TMC26XStepper=https://github.com/trinam
|
||||||
src_filter=+<src/module/TMC26X.cpp>
|
src_filter=+<src/module/TMC26X.cpp>
|
||||||
HAS_L64XX = Arduino-L6470@0.8.0
|
HAS_L64XX = Arduino-L6470@0.8.0
|
||||||
src_filter=+<src/libs/L64XX> +<src/module/stepper/L64xx.cpp> +<src/gcode/feature/L6470> +<src/HAL/shared/HAL_spi_L6470.cpp>
|
src_filter=+<src/libs/L64XX> +<src/module/stepper/L64xx.cpp> +<src/gcode/feature/L6470> +<src/HAL/shared/HAL_spi_L6470.cpp>
|
||||||
|
LIB_INTERNAL_MAX31865 = src_filter=+<src/libs/MAX31865.cpp>
|
||||||
NEOPIXEL_LED = adafruit/Adafruit NeoPixel@~1.8.0
|
NEOPIXEL_LED = adafruit/Adafruit NeoPixel@~1.8.0
|
||||||
src_filter=+<src/feature/leds/neopixel.cpp>
|
src_filter=+<src/feature/leds/neopixel.cpp>
|
||||||
TEMP_.+_IS_MAX31865 = Adafruit MAX31865 library@~1.1.0
|
|
||||||
I2C_AMMETER = peterus/INA226Lib@1.1.2
|
I2C_AMMETER = peterus/INA226Lib@1.1.2
|
||||||
USES_LIQUIDCRYSTAL = fmalpartida/LiquidCrystal@1.5.0
|
USES_LIQUIDCRYSTAL = fmalpartida/LiquidCrystal@1.5.0
|
||||||
USES_LIQUIDCRYSTAL_I2C = marcoschwartz/LiquidCrystal_I2C@1.1.4
|
USES_LIQUIDCRYSTAL_I2C = marcoschwartz/LiquidCrystal_I2C@1.1.4
|
||||||
|
|
|
@ -230,6 +230,7 @@ default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared>
|
||||||
-<src/gcode/units/M149.cpp>
|
-<src/gcode/units/M149.cpp>
|
||||||
-<src/libs/BL24CXX.cpp> -<src/libs/W25Qxx.cpp>
|
-<src/libs/BL24CXX.cpp> -<src/libs/W25Qxx.cpp>
|
||||||
-<src/libs/L64XX> -<src/module/stepper/L64xx.cpp> -<src/HAL/shared/HAL_spi_L6470.cpp>
|
-<src/libs/L64XX> -<src/module/stepper/L64xx.cpp> -<src/HAL/shared/HAL_spi_L6470.cpp>
|
||||||
|
-<src/libs/MAX31865.cpp>
|
||||||
-<src/libs/hex_print.cpp>
|
-<src/libs/hex_print.cpp>
|
||||||
-<src/libs/least_squares_fit.cpp>
|
-<src/libs/least_squares_fit.cpp>
|
||||||
-<src/libs/nozzle.cpp> -<src/gcode/feature/clean>
|
-<src/libs/nozzle.cpp> -<src/gcode/feature/clean>
|
||||||
|
|
Loading…
Reference in a new issue