Add TEMP_SENSOR_BOARD (#22279, #22342, #22343, #22344, #22350)

This commit is contained in:
Scott Lahteine 2021-08-18 20:12:41 -05:00
parent 9ddb4de70a
commit 416234f43a
19 changed files with 829 additions and 519 deletions

View file

@ -452,6 +452,7 @@
* 67 : 500 SliceEngineering 450°C Thermistor
* 70 : 100 bq Hephestos 2
* 75 : 100 Generic Silicon Heat Pad with NTC100K MGB18-104F39050L32
* 2000 : 100 Ultimachine Rambo TDK NTCG104LH104KT1 NTC100K motherboard Thermistor
*
* Analog Thermistors - 1 pullup - Atypical, and requires changing out the 4.7 pullup for 1.
* ------- (but gives greater accuracy and more stable PID)
@ -475,7 +476,7 @@
* 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
* Custom/Dummy/Other Thermal Sensors
* ------
* 0 : not used
* 1000 : Custom - Specify parameters in Configuration_adv.h
@ -497,6 +498,7 @@
#define TEMP_SENSOR_PROBE 0
#define TEMP_SENSOR_CHAMBER 0
#define TEMP_SENSOR_COOLER 0
#define TEMP_SENSOR_BOARD 0
#define TEMP_SENSOR_REDUNDANT 0
// Dummy thermistor constant temperature readings, for use with 998 and 999
@ -529,17 +531,11 @@
* the print will be aborted. Whichever sensor is selected will have its normal functions disabled; i.e. selecting
* the Bed sensor (-1) will disable bed heating/monitoring.
*
* Use the following to select temp sensors:
* -5 : Cooler
* -4 : Probe
* -3 : not used
* -2 : Chamber
* -1 : Bed
* 0-7 : E0 through E7
* For selecting source/target use: COOLER, PROBE, BOARD, CHAMBER, BED, E0, E1, E2, E3, E4, E5, E6, E7
*/
#if TEMP_SENSOR_REDUNDANT
#define TEMP_SENSOR_REDUNDANT_SOURCE 1 // The sensor that will provide the redundant reading.
#define TEMP_SENSOR_REDUNDANT_TARGET 0 // The sensor that we are providing a redundant reading for.
#define TEMP_SENSOR_REDUNDANT_SOURCE E1 // The sensor that will provide the redundant reading.
#define TEMP_SENSOR_REDUNDANT_TARGET E0 // The sensor that we are providing a redundant reading for.
#define TEMP_SENSOR_REDUNDANT_MAX_DIFF 10 // (°C) Temperature difference that will trigger a print abort.
#endif

View file

@ -125,6 +125,12 @@
#define PROBE_BETA 3950 // Beta value
#endif
#if TEMP_SENSOR_BOARD == 1000
#define BOARD_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
#define BOARD_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
#define BOARD_BETA 3950 // Beta value
#endif
#if TEMP_SENSOR_REDUNDANT == 1000
#define REDUNDANT_PULLUP_RESISTOR_OHMS 4700 // Pullup resistor
#define REDUNDANT_RESISTANCE_25C_OHMS 100000 // Resistance at 25C
@ -224,6 +230,18 @@
#endif
#endif
//
// Motherboard Sensor options
//
#if TEMP_SENSOR_BOARD
#define THERMAL_PROTECTION_BOARD // Halt the printer if the board sensor leaves the temp range below.
#define BOARD_MINTEMP 8 // (°C)
#define BOARD_MAXTEMP 70 // (°C)
#ifndef TEMP_BOARD_PIN
//#define TEMP_BOARD_PIN -1 // Board temp sensor pin, if not set in pins file.
#endif
#endif
//
// Laser Coolant Flow Meter
//
@ -487,6 +505,10 @@
#define CONTROLLERFAN_SPEED_ACTIVE 255 // (0-255) Active speed, used when any motor is enabled
#define CONTROLLERFAN_SPEED_IDLE 0 // (0-255) Idle speed, used when motors are disabled
#define CONTROLLERFAN_IDLE_TIME 60 // (seconds) Extra time to keep the fan running after disabling motors
// Use TEMP_SENSOR_BOARD as a trigger for enabling the controller fan
//#define CONTROLLER_FAN_MIN_BOARD_TEMP 40 // (°C) Turn on the fan if the board reaches this temperature
//#define CONTROLLER_FAN_EDITABLE // Enable M710 configurable settings
#if ENABLED(CONTROLLER_FAN_EDITABLE)
#define CONTROLLER_FAN_MENU // Enable the Controller Fan submenu

View file

@ -1218,10 +1218,10 @@ void setup() {
SETUP_RUN(HAL_init());
// 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 && REDUNDANT_TEMP_MATCH(SOURCE, E0))
OUT_WRITE(TEMP_0_CS_PIN, HIGH); // Disable
#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 && REDUNDANT_TEMP_MATCH(SOURCE, E1))
OUT_WRITE(TEMP_1_CS_PIN, HIGH);
#endif

View file

@ -231,6 +231,9 @@
#define STR_HEATER_BED "bed"
#define STR_HEATER_CHAMBER "chamber"
#define STR_COOLER "cooler"
#define STR_MOTHERBOARD "motherboard"
#define STR_PROBE "probe"
#define STR_REDUNDANT "redundant "
#define STR_LASER_TEMP "laser temperature"
#define STR_STOPPED_HEATER ", system stopped! Heater_ID: "

View file

@ -76,9 +76,14 @@ void ControllerFan::update() {
)
);
// If any of the drivers or the heated bed are enabled...
if (motor_on || TERN0(HAS_HEATED_BED, thermalManager.temp_bed.soft_pwm_amount > 0))
lastMotorOn = ms; //... set time to NOW so the fan will turn on
// If any triggers for the controller fan are true...
// - At least one stepper driver is enabled
// - The heated bed is enabled
// - TEMP_SENSOR_BOARD is reporting >= CONTROLLER_FAN_MIN_BOARD_TEMP
if ( motor_on
|| TERN0(HAS_HEATED_BED, thermalManager.temp_bed.soft_pwm_amount > 0)
|| TERN0(HAS_CONTROLLER_FAN_MIN_BOARD_TEMP, thermalManager.wholeDegBoard() >= CONTROLLER_FAN_MIN_BOARD_TEMP)
) lastMotorOn = ms; //... set time to NOW so the fan will turn on
// Fan Settings. Set fan > 0:
// - If AutoMode is on and steppers have been enabled for CONTROLLERFAN_IDLE_TIME seconds.

View file

@ -112,17 +112,419 @@
#undef STEALTHCHOP_E
#endif
#if TEMP_SENSOR_BED == 0
/**
* Temperature Sensors; define what sensor(s) we have.
*/
// Temperature sensor IDs
#define HID_REDUNDANT -6
#define HID_COOLER -5
#define HID_PROBE -4
#define HID_BOARD -3
#define HID_CHAMBER -2
#define HID_BED -1
#define HID_E0 0
#define HID_E1 1
#define HID_E2 2
#define HID_E3 3
#define HID_E4 4
#define HID_E5 5
#define HID_E6 6
#define HID_E7 7
#define ANY_TEMP_SENSOR_IS(n) (n == TEMP_SENSOR_0 || n == TEMP_SENSOR_1 || n == TEMP_SENSOR_2 || n == TEMP_SENSOR_3 \
|| n == TEMP_SENSOR_4 || n == TEMP_SENSOR_5 || n == TEMP_SENSOR_6 || n == TEMP_SENSOR_7 \
|| n == TEMP_SENSOR_BED \
|| n == TEMP_SENSOR_PROBE \
|| n == TEMP_SENSOR_CHAMBER \
|| n == TEMP_SENSOR_COOLER \
|| n == TEMP_SENSOR_REDUNDANT )
#if ANY_TEMP_SENSOR_IS(1000)
#define HAS_USER_THERMISTORS 1
#endif
#undef ANY_TEMP_SENSOR_IS
#if TEMP_SENSOR_REDUNDANT
#define _HEATER_ID(M) HID_##M
#define HEATER_ID(M) _HEATER_ID(M)
#define REDUNDANT_TEMP_MATCH(M,N) (HEATER_ID(TEMP_SENSOR_REDUNDANT_##M) == _HEATER_ID(N))
#else
#define REDUNDANT_TEMP_MATCH(...) 0
#endif
#if TEMP_SENSOR_0 == -5 || TEMP_SENSOR_0 == -3 || TEMP_SENSOR_0 == -2
#define TEMP_SENSOR_0_IS_MAX_TC 1
#if TEMP_SENSOR_0 == -5
#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
#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
#define TEMP_SENSOR_0_IS_MAX6675 1
#define TEMP_SENSOR_0_MAX_TC_TMIN 0
#define TEMP_SENSOR_0_MAX_TC_TMAX 1024
#endif
#elif TEMP_SENSOR_0 == -4
#define TEMP_SENSOR_0_IS_AD8495 1
#elif TEMP_SENSOR_0 == -1
#define TEMP_SENSOR_0_IS_AD595 1
#elif TEMP_SENSOR_0 > 0
#define TEMP_SENSOR_0_IS_THERMISTOR 1
#if TEMP_SENSOR_0 == 1000
#define TEMP_SENSOR_0_IS_CUSTOM 1
#elif TEMP_SENSOR_0 == 998 || TEMP_SENSOR_0 == 999
#define TEMP_SENSOR_0_IS_DUMMY 1
#endif
#else
#undef HEATER_0_MINTEMP
#undef HEATER_0_MAXTEMP
#endif
#if TEMP_SENSOR_1 == -5 || TEMP_SENSOR_1 == -3 || TEMP_SENSOR_1 == -2
#define TEMP_SENSOR_1_IS_MAX_TC 1
#if TEMP_SENSOR_1 == -5
#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_TMAX 1800
#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_TMAX 1024
#endif
#if TEMP_SENSOR_1 != TEMP_SENSOR_0
#if TEMP_SENSOR_1 == -5
#error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."
#elif TEMP_SENSOR_1 == -3
#error "If MAX31855 Thermocouple (-3) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."
#elif TEMP_SENSOR_1 == -2
#error "If MAX6675 Thermocouple (-2) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."
#endif
#endif
#elif TEMP_SENSOR_1 == -4
#define TEMP_SENSOR_1_IS_AD8495 1
#elif TEMP_SENSOR_1 == -1
#define TEMP_SENSOR_1_IS_AD595 1
#elif TEMP_SENSOR_1 > 0
#define TEMP_SENSOR_1_IS_THERMISTOR 1
#if TEMP_SENSOR_1 == 1000
#define TEMP_SENSOR_1_IS_CUSTOM 1
#elif TEMP_SENSOR_1 == 998 || TEMP_SENSOR_1 == 999
#define TEMP_SENSOR_1_IS_DUMMY 1
#endif
#else
#undef HEATER_1_MINTEMP
#undef HEATER_1_MAXTEMP
#endif
#if TEMP_SENSOR_REDUNDANT == -5 || TEMP_SENSOR_REDUNDANT == -3 || TEMP_SENSOR_REDUNDANT == -2
#define TEMP_SENSOR_REDUNDANT_IS_MAX_TC 1
#if TEMP_SENSOR_REDUNDANT == -5
#if !REDUNDANT_TEMP_MATCH(SOURCE, E0) && !REDUNDANT_TEMP_MATCH(SOURCE, E1)
#error "MAX31865 Thermocouples (-5) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
#endif
#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
#if !REDUNDANT_TEMP_MATCH(SOURCE, E0) && !REDUNDANT_TEMP_MATCH(SOURCE, E1)
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
#endif
#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
#if !REDUNDANT_TEMP_MATCH(SOURCE, E0) && !REDUNDANT_TEMP_MATCH(SOURCE, E1)
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1 (0/1)."
#endif
#define TEMP_SENSOR_REDUNDANT_IS_MAX6675 1
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN 0
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1024
#endif
// mimic setting up the source TEMP_SENSOR
#if REDUNDANT_TEMP_MATCH(SOURCE, E0)
#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 REDUNDANT_TEMP_MATCH(SOURCE, E1)
#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_REDUNDANT == -5
#error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match."
#elif TEMP_SENSOR_REDUNDANT == -3
#error "If MAX31855 Thermocouple (-3) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match."
#elif TEMP_SENSOR_REDUNDANT == -2
#error "If MAX6675 Thermocouple (-2) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match."
#endif
#endif
#elif TEMP_SENSOR_REDUNDANT == -4
#define TEMP_SENSOR_REDUNDANT_IS_AD8495 1
#elif TEMP_SENSOR_REDUNDANT == -1
#define TEMP_SENSOR_REDUNDANT_IS_AD595 1
#elif TEMP_SENSOR_REDUNDANT > 0
#define TEMP_SENSOR_REDUNDANT_IS_THERMISTOR 1
#if TEMP_SENSOR_REDUNDANT == 1000
#define TEMP_SENSOR_REDUNDANT_IS_CUSTOM 1
#elif TEMP_SENSOR_REDUNDANT == 998 || TEMP_SENSOR_REDUNDANT == 999
#error "Dummy sensors are not supported for TEMP_SENSOR_REDUNDANT."
#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
#define HAS_MAX31855 1
#endif
#if TEMP_SENSOR_0_IS_MAX31865 || TEMP_SENSOR_1_IS_MAX31865 || TEMP_SENSOR_REDUNDANT_IS_MAX31865
#define HAS_MAX31865 1
#endif
#if TEMP_SENSOR_2 == -4
#define TEMP_SENSOR_2_IS_AD8495 1
#elif TEMP_SENSOR_2 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_2."
#elif TEMP_SENSOR_2 == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_2."
#elif TEMP_SENSOR_2 == -1
#define TEMP_SENSOR_2_IS_AD595 1
#elif TEMP_SENSOR_2 > 0
#define TEMP_SENSOR_2_IS_THERMISTOR 1
#if TEMP_SENSOR_2 == 1000
#define TEMP_SENSOR_2_IS_CUSTOM 1
#elif TEMP_SENSOR_2 == 998 || TEMP_SENSOR_2 == 999
#define TEMP_SENSOR_2_IS_DUMMY 1
#endif
#else
#undef HEATER_2_MINTEMP
#undef HEATER_2_MAXTEMP
#endif
#if TEMP_SENSOR_3 == -4
#define TEMP_SENSOR_3_IS_AD8495 1
#elif TEMP_SENSOR_3 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_3."
#elif TEMP_SENSOR_3 == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_3."
#elif TEMP_SENSOR_3 == -1
#define TEMP_SENSOR_3_IS_AD595 1
#elif TEMP_SENSOR_3 > 0
#define TEMP_SENSOR_3_IS_THERMISTOR 1
#if TEMP_SENSOR_3 == 1000
#define TEMP_SENSOR_3_IS_CUSTOM 1
#elif TEMP_SENSOR_3 == 998 || TEMP_SENSOR_3 == 999
#define TEMP_SENSOR_3_IS_DUMMY 1
#endif
#else
#undef HEATER_3_MINTEMP
#undef HEATER_3_MAXTEMP
#endif
#if TEMP_SENSOR_4 == -4
#define TEMP_SENSOR_4_IS_AD8495 1
#elif TEMP_SENSOR_4 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_4."
#elif TEMP_SENSOR_4 == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_4."
#elif TEMP_SENSOR_4 == -1
#define TEMP_SENSOR_4_IS_AD595 1
#elif TEMP_SENSOR_4 > 0
#define TEMP_SENSOR_4_IS_THERMISTOR 1
#if TEMP_SENSOR_4 == 1000
#define TEMP_SENSOR_4_IS_CUSTOM 1
#elif TEMP_SENSOR_4 == 998 || TEMP_SENSOR_4 == 999
#define TEMP_SENSOR_4_IS_DUMMY 1
#endif
#else
#undef HEATER_4_MINTEMP
#undef HEATER_4_MAXTEMP
#endif
#if TEMP_SENSOR_5 == -4
#define TEMP_SENSOR_5_IS_AD8495 1
#elif TEMP_SENSOR_5 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_5."
#elif TEMP_SENSOR_5 == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_5."
#elif TEMP_SENSOR_5 == -1
#define TEMP_SENSOR_5_IS_AD595 1
#elif TEMP_SENSOR_5 > 0
#define TEMP_SENSOR_5_IS_THERMISTOR 1
#if TEMP_SENSOR_5 == 1000
#define TEMP_SENSOR_5_IS_CUSTOM 1
#elif TEMP_SENSOR_5 == 998 || TEMP_SENSOR_5 == 999
#define TEMP_SENSOR_5_IS_DUMMY 1
#endif
#else
#undef HEATER_5_MINTEMP
#undef HEATER_5_MAXTEMP
#endif
#if TEMP_SENSOR_6 == -4
#define TEMP_SENSOR_6_IS_AD8495 1
#elif TEMP_SENSOR_6 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_6."
#elif TEMP_SENSOR_6 == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_6."
#elif TEMP_SENSOR_6 == -1
#define TEMP_SENSOR_6_IS_AD595 1
#elif TEMP_SENSOR_6 > 0
#define TEMP_SENSOR_6_IS_THERMISTOR 1
#if TEMP_SENSOR_6 == 1000
#define TEMP_SENSOR_6_IS_CUSTOM 1
#elif TEMP_SENSOR_6 == 998 || TEMP_SENSOR_6 == 999
#define TEMP_SENSOR_6_IS_DUMMY 1
#endif
#else
#undef HEATER_6_MINTEMP
#undef HEATER_6_MAXTEMP
#endif
#if TEMP_SENSOR_7 == -4
#define TEMP_SENSOR_7_IS_AD8495 1
#elif TEMP_SENSOR_7 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_7."
#elif TEMP_SENSOR_7 == -2
#error "MAX7775 Thermocouples (-2) not supported for TEMP_SENSOR_7."
#elif TEMP_SENSOR_7 == -1
#define TEMP_SENSOR_7_IS_AD595 1
#elif TEMP_SENSOR_7 > 0
#define TEMP_SENSOR_7_IS_THERMISTOR 1
#if TEMP_SENSOR_7 == 1000
#define TEMP_SENSOR_7_IS_CUSTOM 1
#elif TEMP_SENSOR_7 == 998 || TEMP_SENSOR_7 == 999
#define TEMP_SENSOR_7_IS_DUMMY 1
#endif
#else
#undef HEATER_7_MINTEMP
#undef HEATER_7_MAXTEMP
#endif
#if TEMP_SENSOR_BED == -4
#define TEMP_SENSOR_BED_IS_AD8495 1
#elif TEMP_SENSOR_BED == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_BED."
#elif TEMP_SENSOR_BED == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_BED."
#elif TEMP_SENSOR_BED == -1
#define TEMP_SENSOR_BED_IS_AD595 1
#elif TEMP_SENSOR_BED > 0
#define TEMP_SENSOR_BED_IS_THERMISTOR 1
#if TEMP_SENSOR_BED == 1000
#define TEMP_SENSOR_BED_IS_CUSTOM 1
#elif TEMP_SENSOR_BED == 998 || TEMP_SENSOR_BED == 999
#define TEMP_SENSOR_BED_IS_DUMMY 1
#endif
#else
#undef THERMAL_PROTECTION_BED
#undef THERMAL_PROTECTION_BED_PERIOD
#undef BED_MINTEMP
#undef BED_MAXTEMP
#endif
#if TEMP_SENSOR_CHAMBER == 0
#if TEMP_SENSOR_CHAMBER == -4
#define TEMP_SENSOR_CHAMBER_IS_AD8495 1
#elif TEMP_SENSOR_CHAMBER == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_CHAMBER."
#elif TEMP_SENSOR_CHAMBER == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_CHAMBER."
#elif TEMP_SENSOR_CHAMBER == -1
#define TEMP_SENSOR_CHAMBER_IS_AD595 1
#elif TEMP_SENSOR_CHAMBER > 0
#define TEMP_SENSOR_CHAMBER_IS_THERMISTOR 1
#if TEMP_SENSOR_CHAMBER == 1000
#define TEMP_SENSOR_CHAMBER_IS_CUSTOM 1
#elif TEMP_SENSOR_CHAMBER == 998 || TEMP_SENSOR_CHAMBER == 999
#define TEMP_SENSOR_CHAMBER_IS_DUMMY 1
#endif
#else
#undef THERMAL_PROTECTION_CHAMBER
#undef CHAMBER_MINTEMP
#undef CHAMBER_MAXTEMP
#endif
#if TEMP_SENSOR_COOLER == 0
#if TEMP_SENSOR_COOLER == -4
#define TEMP_SENSOR_COOLER_IS_AD8495 1
#elif TEMP_SENSOR_COOLER == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_COOLER."
#elif TEMP_SENSOR_COOLER == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_COOLER."
#elif TEMP_SENSOR_COOLER == -1
#define TEMP_SENSOR_COOLER_IS_AD595 1
#elif TEMP_SENSOR_COOLER > 0
#define TEMP_SENSOR_COOLER_IS_THERMISTOR 1
#if TEMP_SENSOR_COOLER == 1000
#define TEMP_SENSOR_COOLER_IS_CUSTOM 1
#elif TEMP_SENSOR_COOLER == 998 || TEMP_SENSOR_COOLER == 999
#define TEMP_SENSOR_COOLER_IS_DUMMY 1
#endif
#else
#undef THERMAL_PROTECTION_COOLER
#undef COOLER_MINTEMP
#undef COOLER_MAXTEMP
#endif
#if TEMP_SENSOR_PROBE == -4
#define TEMP_SENSOR_PROBE_IS_AD8495 1
#elif TEMP_SENSOR_PROBE == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_PROBE."
#elif TEMP_SENSOR_PROBE == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_PROBE."
#elif TEMP_SENSOR_PROBE == -1
#define TEMP_SENSOR_PROBE_IS_AD595 1
#elif TEMP_SENSOR_PROBE > 0
#define TEMP_SENSOR_PROBE_IS_THERMISTOR 1
#if TEMP_SENSOR_PROBE == 1000
#define TEMP_SENSOR_PROBE_IS_CUSTOM 1
#elif TEMP_SENSOR_PROBE == 998 || TEMP_SENSOR_PROBE == 999
#define TEMP_SENSOR_PROBE_IS_DUMMY 1
#endif
#endif
#if TEMP_SENSOR_BOARD == -4
#define TEMP_SENSOR_BOARD_IS_AD8495 1
#elif TEMP_SENSOR_BOARD == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_BOARD."
#elif TEMP_SENSOR_BOARD == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_BOARD."
#elif TEMP_SENSOR_BOARD == -1
#define TEMP_SENSOR_BOARD_IS_AD595 1
#elif TEMP_SENSOR_BOARD > 0
#define TEMP_SENSOR_BOARD_IS_THERMISTOR 1
#if TEMP_SENSOR_BOARD == 1000
#define TEMP_SENSOR_BOARD_IS_CUSTOM 1
#elif TEMP_SENSOR_BOARD == 998 || TEMP_SENSOR_BOARD == 999
#define TEMP_SENSOR_BOARD_IS_DUMMY 1
#endif
#endif
#if ENABLED(MIXING_EXTRUDER) && (ENABLED(RETRACT_SYNC_MIXING) || BOTH(FILAMENT_LOAD_UNLOAD_GCODES, FILAMENT_UNLOAD_ALL_EXTRUDERS))

View file

@ -513,103 +513,90 @@
#endif
/**
* Temp Sensor defines
* Temp Sensor defines; set up pins as needed.
*/
#define ANY_TEMP_SENSOR_IS(n) ( \
n == TEMP_SENSOR_0 || n == TEMP_SENSOR_1 || n == TEMP_SENSOR_2 || n == TEMP_SENSOR_3 \
|| n == TEMP_SENSOR_4 || n == TEMP_SENSOR_5 || n == TEMP_SENSOR_6 || n == TEMP_SENSOR_7 \
|| n == TEMP_SENSOR_BED \
|| n == TEMP_SENSOR_PROBE \
|| n == TEMP_SENSOR_CHAMBER \
|| n == TEMP_SENSOR_COOLER \
|| n == TEMP_SENSOR_REDUNDANT )
#if ANY_TEMP_SENSOR_IS(1000)
#define HAS_USER_THERMISTORS 1
#endif
#undef ANY_TEMP_SENSOR_IS
// Usurp a sensor to do redundant readings
#if TEMP_SENSOR_REDUNDANT
#ifndef TEMP_SENSOR_REDUNDANT_SOURCE
#define TEMP_SENSOR_REDUNDANT_SOURCE 1
#define TEMP_SENSOR_REDUNDANT_SOURCE E1
#endif
#ifndef TEMP_SENSOR_REDUNDANT_TARGET
#define TEMP_SENSOR_REDUNDANT_TARGET 0
#define TEMP_SENSOR_REDUNDANT_TARGET E0
#endif
#if !PIN_EXISTS(TEMP_REDUNDANT)
#ifndef TEMP_SENSOR_REDUNDANT_MAX_DIFF
#define TEMP_SENSOR_REDUNDANT_MAX_DIFF 10
#endif
#if TEMP_SENSOR_REDUNDANT_SOURCE == -5
#if REDUNDANT_TEMP_MATCH(SOURCE, COOLER)
#if !PIN_EXISTS(TEMP_COOLER)
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to COOLER requires TEMP_COOLER_PIN."
#else
#define TEMP_REDUNDANT_PIN TEMP_COOLER_PIN
#endif
#elif TEMP_SENSOR_REDUNDANT_SOURCE == -4
#elif REDUNDANT_TEMP_MATCH(SOURCE, PROBE)
#if !PIN_EXISTS(TEMP_PROBE)
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to PROBE requires TEMP_PROBE_PIN."
#else
#define TEMP_REDUNDANT_PIN TEMP_PROBE_PIN
#endif
#elif TEMP_SENSOR_REDUNDANT_SOURCE == -2
#elif REDUNDANT_TEMP_MATCH(SOURCE, CHAMBER)
#if !PIN_EXISTS(TEMP_CHAMBER)
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to CHAMBER requires TEMP_CHAMBER_PIN."
#else
#define TEMP_REDUNDANT_PIN TEMP_CHAMBER_PIN
#endif
#elif TEMP_SENSOR_REDUNDANT_SOURCE == -1
#elif REDUNDANT_TEMP_MATCH(SOURCE, BED)
#if !PIN_EXISTS(TEMP_BED)
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to BED requires TEMP_BED_PIN."
#else
#define TEMP_REDUNDANT_PIN TEMP_BED_PIN
#endif
#elif TEMP_SENSOR_REDUNDANT_SOURCE == 0
#elif REDUNDANT_TEMP_MATCH(SOURCE, E0)
#if !PIN_EXISTS(TEMP_0)
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to 0 requires TEMP_0_PIN."
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to E0 requires TEMP_0_PIN."
#else
#define TEMP_REDUNDANT_PIN TEMP_0_PIN
#endif
#elif TEMP_SENSOR_REDUNDANT_SOURCE == 1
#elif REDUNDANT_TEMP_MATCH(SOURCE, E1)
#if !PIN_EXISTS(TEMP_1)
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to 1 requires TEMP_1_PIN."
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to E1 requires TEMP_1_PIN."
#else
#define TEMP_REDUNDANT_PIN TEMP_1_PIN
#endif
#elif TEMP_SENSOR_REDUNDANT_SOURCE == 2
#elif REDUNDANT_TEMP_MATCH(SOURCE, E2)
#if !PIN_EXISTS(TEMP_2)
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to 2 requires TEMP_2_PIN."
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to E2 requires TEMP_2_PIN."
#else
#define TEMP_REDUNDANT_PIN TEMP_2_PIN
#endif
#elif TEMP_SENSOR_REDUNDANT_SOURCE == 3
#elif REDUNDANT_TEMP_MATCH(SOURCE, E3)
#if !PIN_EXISTS(TEMP_3)
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to 3 requires TEMP_3_PIN."
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to E3 requires TEMP_3_PIN."
#else
#define TEMP_REDUNDANT_PIN TEMP_3_PIN
#endif
#elif TEMP_SENSOR_REDUNDANT_SOURCE == 4
#elif REDUNDANT_TEMP_MATCH(SOURCE, E4)
#if !PIN_EXISTS(TEMP_4)
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to 4 requires TEMP_4_PIN."
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to E4 requires TEMP_4_PIN."
#else
#define TEMP_REDUNDANT_PIN TEMP_4_PIN
#endif
#elif TEMP_SENSOR_REDUNDANT_SOURCE == 5
#elif REDUNDANT_TEMP_MATCH(SOURCE, E5)
#if !PIN_EXISTS(TEMP_5)
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to 5 requires TEMP_5_PIN."
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to E5 requires TEMP_5_PIN."
#else
#define TEMP_REDUNDANT_PIN TEMP_5_PIN
#endif
#elif TEMP_SENSOR_REDUNDANT_SOURCE == 6
#elif REDUNDANT_TEMP_MATCH(SOURCE, E6)
#if !PIN_EXISTS(TEMP_6)
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to 6 requires TEMP_6_PIN."
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to E6 requires TEMP_6_PIN."
#else
#define TEMP_REDUNDANT_PIN TEMP_6_PIN
#endif
#elif TEMP_SENSOR_REDUNDANT_SOURCE == 7
#elif REDUNDANT_TEMP_MATCH(SOURCE, E7)
#if !PIN_EXISTS(TEMP_7)
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to 7 requires TEMP_7_PIN."
#error "TEMP_SENSOR_REDUNDANT_SOURCE set to E7 requires TEMP_7_PIN."
#else
#define TEMP_REDUNDANT_PIN TEMP_7_PIN
#endif
@ -617,170 +604,13 @@
#endif
#endif
#if TEMP_SENSOR_0 == -5 || TEMP_SENSOR_0 == -3 || TEMP_SENSOR_0 == -2
#define TEMP_SENSOR_0_IS_MAX_TC 1
#if TEMP_SENSOR_0 == -5
#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
#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
#define TEMP_SENSOR_0_IS_MAX6675 1
#define TEMP_SENSOR_0_MAX_TC_TMIN 0
#define TEMP_SENSOR_0_MAX_TC_TMAX 1024
#endif
#elif TEMP_SENSOR_0 == -4
#define TEMP_SENSOR_0_IS_AD8495 1
#elif TEMP_SENSOR_0 == -1
#define TEMP_SENSOR_0_IS_AD595 1
#elif TEMP_SENSOR_0 > 0
#define TEMP_SENSOR_0_IS_THERMISTOR 1
#if TEMP_SENSOR_0 == 1000
#define TEMP_SENSOR_0_IS_CUSTOM 1
#elif TEMP_SENSOR_0 == 998 || TEMP_SENSOR_0 == 999
#define TEMP_SENSOR_0_IS_DUMMY 1
#endif
#else
#undef HEATER_0_MINTEMP
#undef HEATER_0_MAXTEMP
#endif
#if TEMP_SENSOR_1 == -5 || TEMP_SENSOR_1 == -3 || TEMP_SENSOR_1 == -2
#define TEMP_SENSOR_1_IS_MAX_TC 1
#if TEMP_SENSOR_1 == -5
#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_TMAX 1800
#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_TMAX 1024
#endif
#if TEMP_SENSOR_1 != TEMP_SENSOR_0
#if TEMP_SENSOR_1 == -5
#error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."
#elif TEMP_SENSOR_1 == -3
#error "If MAX31855 Thermocouple (-3) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."
#elif TEMP_SENSOR_1 == -2
#error "If MAX6675 Thermocouple (-2) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."
#endif
#endif
#elif TEMP_SENSOR_1 == -4
#define TEMP_SENSOR_1_IS_AD8495 1
#elif TEMP_SENSOR_1 == -1
#define TEMP_SENSOR_1_IS_AD595 1
#elif TEMP_SENSOR_1 > 0
#define TEMP_SENSOR_1_IS_THERMISTOR 1
#if TEMP_SENSOR_1 == 1000
#define TEMP_SENSOR_1_IS_CUSTOM 1
#elif TEMP_SENSOR_1 == 998 || TEMP_SENSOR_1 == 999
#define TEMP_SENSOR_1_IS_DUMMY 1
#endif
#else
#undef HEATER_1_MINTEMP
#undef HEATER_1_MAXTEMP
#endif
#if TEMP_SENSOR_REDUNDANT == -5 || TEMP_SENSOR_REDUNDANT == -3 || TEMP_SENSOR_REDUNDANT == -2
#define TEMP_SENSOR_REDUNDANT_IS_MAX_TC 1
#if TEMP_SENSOR_REDUNDANT == -5
#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)."
#endif
#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
#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)."
#endif
#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
#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)."
#endif
#define TEMP_SENSOR_REDUNDANT_IS_MAX6675 1
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN 0
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1024
#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_REDUNDANT == -5
#error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match."
#elif TEMP_SENSOR_REDUNDANT == -3
#error "If MAX31855 Thermocouple (-3) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match."
#elif TEMP_SENSOR_REDUNDANT == -2
#error "If MAX6675 Thermocouple (-2) is used for TEMP_SENSOR_0/TEMP_SENSOR_1 then TEMP_SENSOR_REDUNDANT must match."
#endif
#endif
#elif TEMP_SENSOR_REDUNDANT == -4
#define TEMP_SENSOR_REDUNDANT_IS_AD8495 1
#elif TEMP_SENSOR_REDUNDANT == -1
#define TEMP_SENSOR_REDUNDANT_IS_AD595 1
#elif TEMP_SENSOR_REDUNDANT > 0
#define TEMP_SENSOR_REDUNDANT_IS_THERMISTOR 1
#if TEMP_SENSOR_REDUNDANT == 1000
#define TEMP_SENSOR_REDUNDANT_IS_CUSTOM 1
#elif TEMP_SENSOR_REDUNDANT == 998 || TEMP_SENSOR_REDUNDANT == 999
#error "Dummy sensors are not supported for TEMP_SENSOR_REDUNDANT."
#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
#define HAS_MAX31855 1
#endif
#if TEMP_SENSOR_0_IS_MAX31865 || TEMP_SENSOR_1_IS_MAX31865 || TEMP_SENSOR_REDUNDANT_IS_MAX31865
#define HAS_MAX31865 1
#endif
//
// Compatibility layer for MAX (SPI) temp boards
//
/**
* Compatibility layer for MAX (SPI) temp boards
*/
#if HAS_MAX_TC
// Translate old _SS, _CS, _SCK, _DO, _DI, _MISO, and _MOSI PIN defines.
#if TEMP_SENSOR_0_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && TEMP_SENSOR_REDUNDANT_SOURCE == 1)
#if TEMP_SENSOR_0_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && REDUNDANT_TEMP_MATCH(SOURCE, E1))
#if !PIN_EXISTS(TEMP_0_CS) // SS, CS
#if PIN_EXISTS(MAX6675_SS)
@ -849,7 +679,7 @@
#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 TEMP_SENSOR_1_IS_MAX_TC || (TEMP_SENSOR_REDUNDANT_IS_MAX_TC && REDUNDANT_TEMP_MATCH(SOURCE, E1))
#if !PIN_EXISTS(TEMP_1_CS) // SS2, CS2
#if PIN_EXISTS(MAX6675_SS2)
@ -938,203 +768,6 @@
#endif //HAS_MAX_TC
#if TEMP_SENSOR_2 == -4
#define TEMP_SENSOR_2_IS_AD8495 1
#elif TEMP_SENSOR_2 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_2."
#elif TEMP_SENSOR_2 == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_2."
#elif TEMP_SENSOR_2 == -1
#define TEMP_SENSOR_2_IS_AD595 1
#elif TEMP_SENSOR_2 > 0
#define TEMP_SENSOR_2_IS_THERMISTOR 1
#if TEMP_SENSOR_2 == 1000
#define TEMP_SENSOR_2_IS_CUSTOM 1
#elif TEMP_SENSOR_2 == 998 || TEMP_SENSOR_2 == 999
#define TEMP_SENSOR_2_IS_DUMMY 1
#endif
#else
#undef HEATER_2_MINTEMP
#undef HEATER_2_MAXTEMP
#endif
#if TEMP_SENSOR_3 == -4
#define TEMP_SENSOR_3_IS_AD8495 1
#elif TEMP_SENSOR_3 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_3."
#elif TEMP_SENSOR_3 == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_3."
#elif TEMP_SENSOR_3 == -1
#define TEMP_SENSOR_3_IS_AD595 1
#elif TEMP_SENSOR_3 > 0
#define TEMP_SENSOR_3_IS_THERMISTOR 1
#if TEMP_SENSOR_3 == 1000
#define TEMP_SENSOR_3_IS_CUSTOM 1
#elif TEMP_SENSOR_3 == 998 || TEMP_SENSOR_3 == 999
#define TEMP_SENSOR_3_IS_DUMMY 1
#endif
#else
#undef HEATER_3_MINTEMP
#undef HEATER_3_MAXTEMP
#endif
#if TEMP_SENSOR_4 == -4
#define TEMP_SENSOR_4_IS_AD8495 1
#elif TEMP_SENSOR_4 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_4."
#elif TEMP_SENSOR_4 == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_4."
#elif TEMP_SENSOR_4 == -1
#define TEMP_SENSOR_4_IS_AD595 1
#elif TEMP_SENSOR_4 > 0
#define TEMP_SENSOR_4_IS_THERMISTOR 1
#if TEMP_SENSOR_4 == 1000
#define TEMP_SENSOR_4_IS_CUSTOM 1
#elif TEMP_SENSOR_4 == 998 || TEMP_SENSOR_4 == 999
#define TEMP_SENSOR_4_IS_DUMMY 1
#endif
#else
#undef HEATER_4_MINTEMP
#undef HEATER_4_MAXTEMP
#endif
#if TEMP_SENSOR_5 == -4
#define TEMP_SENSOR_5_IS_AD8495 1
#elif TEMP_SENSOR_5 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_5."
#elif TEMP_SENSOR_5 == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_5."
#elif TEMP_SENSOR_5 == -1
#define TEMP_SENSOR_5_IS_AD595 1
#elif TEMP_SENSOR_5 > 0
#define TEMP_SENSOR_5_IS_THERMISTOR 1
#if TEMP_SENSOR_5 == 1000
#define TEMP_SENSOR_5_IS_CUSTOM 1
#elif TEMP_SENSOR_5 == 998 || TEMP_SENSOR_5 == 999
#define TEMP_SENSOR_5_IS_DUMMY 1
#endif
#else
#undef HEATER_5_MINTEMP
#undef HEATER_5_MAXTEMP
#endif
#if TEMP_SENSOR_6 == -4
#define TEMP_SENSOR_6_IS_AD8495 1
#elif TEMP_SENSOR_6 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_6."
#elif TEMP_SENSOR_6 == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_6."
#elif TEMP_SENSOR_6 == -1
#define TEMP_SENSOR_6_IS_AD595 1
#elif TEMP_SENSOR_6 > 0
#define TEMP_SENSOR_6_IS_THERMISTOR 1
#if TEMP_SENSOR_6 == 1000
#define TEMP_SENSOR_6_IS_CUSTOM 1
#elif TEMP_SENSOR_6 == 998 || TEMP_SENSOR_6 == 999
#define TEMP_SENSOR_6_IS_DUMMY 1
#endif
#else
#undef HEATER_6_MINTEMP
#undef HEATER_6_MAXTEMP
#endif
#if TEMP_SENSOR_7 == -4
#define TEMP_SENSOR_7_IS_AD8495 1
#elif TEMP_SENSOR_7 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_7."
#elif TEMP_SENSOR_7 == -2
#error "MAX7775 Thermocouples (-2) not supported for TEMP_SENSOR_7."
#elif TEMP_SENSOR_7 == -1
#define TEMP_SENSOR_7_IS_AD595 1
#elif TEMP_SENSOR_7 > 0
#define TEMP_SENSOR_7_IS_THERMISTOR 1
#if TEMP_SENSOR_7 == 1000
#define TEMP_SENSOR_7_IS_CUSTOM 1
#elif TEMP_SENSOR_7 == 998 || TEMP_SENSOR_7 == 999
#define TEMP_SENSOR_7_IS_DUMMY 1
#endif
#else
#undef HEATER_7_MINTEMP
#undef HEATER_7_MAXTEMP
#endif
#if TEMP_SENSOR_BED == -4
#define TEMP_SENSOR_BED_IS_AD8495 1
#elif TEMP_SENSOR_BED == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_BED."
#elif TEMP_SENSOR_BED == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_BED."
#elif TEMP_SENSOR_BED == -1
#define TEMP_SENSOR_BED_IS_AD595 1
#elif TEMP_SENSOR_BED > 0
#define TEMP_SENSOR_BED_IS_THERMISTOR 1
#if TEMP_SENSOR_BED == 1000
#define TEMP_SENSOR_BED_IS_CUSTOM 1
#elif TEMP_SENSOR_BED == 998 || TEMP_SENSOR_BED == 999
#define TEMP_SENSOR_BED_IS_DUMMY 1
#endif
#else
#undef BED_MINTEMP
#undef BED_MAXTEMP
#endif
#if TEMP_SENSOR_CHAMBER == -4
#define TEMP_SENSOR_CHAMBER_IS_AD8495 1
#elif TEMP_SENSOR_CHAMBER == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_CHAMBER."
#elif TEMP_SENSOR_CHAMBER == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_CHAMBER."
#elif TEMP_SENSOR_CHAMBER == -1
#define TEMP_SENSOR_CHAMBER_IS_AD595 1
#elif TEMP_SENSOR_CHAMBER > 0
#define TEMP_SENSOR_CHAMBER_IS_THERMISTOR 1
#if TEMP_SENSOR_CHAMBER == 1000
#define TEMP_SENSOR_CHAMBER_IS_CUSTOM 1
#elif TEMP_SENSOR_CHAMBER == 998 || TEMP_SENSOR_CHAMBER == 999
#define TEMP_SENSOR_CHAMBER_IS_DUMMY 1
#endif
#else
#undef CHAMBER_MINTEMP
#undef CHAMBER_MAXTEMP
#endif
#if TEMP_SENSOR_COOLER == -4
#define TEMP_SENSOR_COOLER_IS_AD8495 1
#elif TEMP_SENSOR_COOLER == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_COOLER."
#elif TEMP_SENSOR_COOLER == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_COOLER."
#elif TEMP_SENSOR_COOLER == -1
#define TEMP_SENSOR_COOLER_IS_AD595 1
#elif TEMP_SENSOR_COOLER > 0
#define TEMP_SENSOR_COOLER_IS_THERMISTOR 1
#if TEMP_SENSOR_COOLER == 1000
#define TEMP_SENSOR_COOLER_IS_CUSTOM 1
#elif TEMP_SENSOR_COOLER == 998 || TEMP_SENSOR_COOLER == 999
#define TEMP_SENSOR_COOLER_IS_DUMMY 1
#endif
#else
#undef COOLER_MINTEMP
#undef COOLER_MAXTEMP
#endif
#if TEMP_SENSOR_PROBE == -4
#define TEMP_SENSOR_PROBE_IS_AD8495 1
#elif TEMP_SENSOR_PROBE == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_PROBE."
#elif TEMP_SENSOR_PROBE == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_PROBE."
#elif TEMP_SENSOR_PROBE == -1
#define TEMP_SENSOR_PROBE_IS_AD595 1
#elif TEMP_SENSOR_PROBE > 0
#define TEMP_SENSOR_PROBE_IS_THERMISTOR 1
#if TEMP_SENSOR_PROBE == 1000
#define TEMP_SENSOR_PROBE_IS_CUSTOM 1
#elif TEMP_SENSOR_PROBE == 998 || TEMP_SENSOR_PROBE == 999
#define TEMP_SENSOR_PROBE_IS_DUMMY 1
#endif
#endif
/**
* X_DUAL_ENDSTOPS endstop reassignment
*/
@ -2608,6 +2241,9 @@
#if HAS_ADC_TEST(COOLER)
#define HAS_TEMP_ADC_COOLER 1
#endif
#if HAS_ADC_TEST(BOARD)
#define HAS_TEMP_ADC_BOARD 1
#endif
#if HAS_ADC_TEST(REDUNDANT)
#define HAS_TEMP_ADC_REDUNDANT 1
#endif
@ -2628,6 +2264,9 @@
#if HAS_TEMP(COOLER)
#define HAS_TEMP_COOLER 1
#endif
#if HAS_TEMP(BOARD)
#define HAS_TEMP_BOARD 1
#endif
#if HAS_TEMP(REDUNDANT)
#define HAS_TEMP_REDUNDANT 1
#endif
@ -2699,7 +2338,8 @@
#if HAS_HEATED_BED || HAS_TEMP_CHAMBER
#define BED_OR_CHAMBER 1
#endif
#if HAS_TEMP_HOTEND || BED_OR_CHAMBER || HAS_TEMP_PROBE || HAS_TEMP_COOLER
#if HAS_TEMP_HOTEND || BED_OR_CHAMBER || HAS_TEMP_PROBE || HAS_TEMP_COOLER || HAS_TEMP_BOARD
#define HAS_TEMP_SENSOR 1
#endif
@ -2837,9 +2477,6 @@
#endif
#undef _NOT_E_AUTO
#undef _HAS_FAN
#if PIN_EXISTS(CONTROLLER_FAN)
#define HAS_CONTROLLER_FAN 1
#endif
#if BED_OR_CHAMBER || HAS_FAN0
#define BED_OR_CHAMBER_OR_FAN 1
@ -2916,6 +2553,27 @@
#define FAST_PWM_FAN_FREQUENCY ((F_CPU) / (2 * 255 * 1)) // Fan frequency default
#endif
/**
* Controller Fan Settings
*/
#if PIN_EXISTS(CONTROLLER_FAN)
#define HAS_CONTROLLER_FAN 1
#if CONTROLLER_FAN_MIN_BOARD_TEMP
#define HAS_CONTROLLER_FAN_MIN_BOARD_TEMP 1
#endif
#endif
#if HAS_CONTROLLER_FAN
#if ENABLED(CONTROLLER_FAN_USE_BOARD_TEMP)
#define HAS_CONTROLLER_FAN_BOARD_TEMP_TRIGGER 1
#ifndef CONTROLLER_FAN_TRIGGER_TEMP
#define CONTROLLER_FAN_TRIGGER_TEMP 30
#endif
#else
#undef CONTROLLER_FAN_TRIGGER_TEMP
#endif
#endif
// Servos
#if PIN_EXISTS(SERVO0) && NUM_SERVOS > 0
#define HAS_SERVO_0 1

View file

@ -585,6 +585,10 @@
#error "TEMP_SENSOR_1_AS_REDUNDANT is now TEMP_SENSOR_REDUNDANT, with associated TEMP_SENSOR_REDUNDANT_* config."
#elif defined(MAX_REDUNDANT_TEMP_SENSOR_DIFF)
#error "MAX_REDUNDANT_TEMP_SENSOR_DIFF is now TEMP_SENSOR_REDUNDANT_MAX_DIFF"
#elif MOTHERBOARD == BOARD_DUE3DOM_MINI && PIN_EXISTS(TEMP_2) && DISABLED(TEMP_SENSOR_BOARD)
#warning "Onboard temperature sensor for BOARD_DUE3DOM_MINI has moved from TEMP_SENSOR_2 (TEMP_2_PIN) to TEMP_SENSOR_BOARD (TEMP_BOARD_PIN)."
#elif MOTHERBOARD == BOARD_BTT_SKR_E3_TURBO && PIN_EXISTS(TEMP_2) && DISABLED(TEMP_SENSOR_BOARD)
#warning "Onboard temperature sensor for BOARD_BTT_SKR_E3_TURBO has moved from TEMP_SENSOR_2 (TEMP_2_PIN) to TEMP_SENSOR_BOARD (TEMP_BOARD_PIN)."
#endif
constexpr float arm[] = AXIS_RELATIVE_MODES;
@ -1985,6 +1989,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#error "TEMP_SENSOR_CHAMBER 1000 requires CHAMBER_PULLUP_RESISTOR_OHMS, CHAMBER_RESISTANCE_25C_OHMS and CHAMBER_BETA in Configuration_adv.h."
#elif TEMP_SENSOR_PROBE_IS_CUSTOM && !(defined(PROBE_PULLUP_RESISTOR_OHMS) && defined(PROBE_RESISTANCE_25C_OHMS) && defined(PROBE_BETA))
#error "TEMP_SENSOR_PROBE 1000 requires PROBE_PULLUP_RESISTOR_OHMS, PROBE_RESISTANCE_25C_OHMS and PROBE_BETA in Configuration_adv.h."
#elif TEMP_SENSOR_BOARD_IS_CUSTOM && !(defined(BOARD_PULLUP_RESISTOR_OHMS) && defined(BOARD_RESISTANCE_25C_OHMS) && defined(BOARD_BETA))
#error "TEMP_SENSOR_BOARD 1000 requires BOARD_PULLUP_RESISTOR_OHMS, BOARD_RESISTANCE_25C_OHMS and BOARD_BETA in Configuration_adv.h."
#elif TEMP_SENSOR_REDUNDANT_IS_CUSTOM && !(defined(REDUNDANT_PULLUP_RESISTOR_OHMS) && defined(REDUNDANT_RESISTANCE_25C_OHMS) && defined(REDUNDANT_BETA))
#error "TEMP_SENSOR_REDUNDANT 1000 requires REDUNDANT_PULLUP_RESISTOR_OHMS, REDUNDANT_RESISTANCE_25C_OHMS and REDUNDANT_BETA in Configuration_adv.h."
#endif
@ -1992,14 +1998,14 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
/**
* Required MAX31865 settings
*/
#if TEMP_SENSOR_0_IS_MAX31865 || (TEMP_SENSOR_REDUNDANT_IS_MAX31865 && TEMP_SENSOR_REDUNDANT_SOURCE == 0)
#if TEMP_SENSOR_0_IS_MAX31865 || (TEMP_SENSOR_REDUNDANT_IS_MAX31865 && REDUNDANT_TEMP_MATCH(SOURCE, E0))
#if !defined(MAX31865_SENSOR_WIRES_0) || !WITHIN(MAX31865_SENSOR_WIRES_0, 2, 4)
#error "MAX31865_SENSOR_WIRES_0 must be defined as an integer between 2 and 4."
#elif !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."
#endif
#endif
#if TEMP_SENSOR_1_IS_MAX31865 || (TEMP_SENSOR_REDUNDANT_IS_MAX31865 && TEMP_SENSOR_REDUNDANT_SOURCE == 1)
#if TEMP_SENSOR_1_IS_MAX31865 || (TEMP_SENSOR_REDUNDANT_IS_MAX31865 && REDUNDANT_TEMP_MATCH(SOURCE, E1))
#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)
@ -2015,56 +2021,52 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#error "TEMP_SENSOR_REDUNDANT requires TEMP_SENSOR_REDUNDANT_SOURCE."
#elif !defined(TEMP_SENSOR_REDUNDANT_TARGET)
#error "TEMP_SENSOR_REDUNDANT requires TEMP_SENSOR_REDUNDANT_TARGET."
#elif TEMP_SENSOR_REDUNDANT_SOURCE == TEMP_SENSOR_REDUNDANT_TARGET
#elif REDUNDANT_TEMP_MATCH(SOURCE, TEMP_SENSOR_REDUNDANT_TARGET)
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be the same as TEMP_SENSOR_REDUNDANT_TARGET."
#elif TEMP_SENSOR_REDUNDANT_SOURCE < -5 || TEMP_SENSOR_REDUNDANT_SOURCE > 7
#error "TEMP_SENSOR_REDUNDANT_SOURCE must be between -5 and 7."
#elif TEMP_SENSOR_REDUNDANT_TARGET < -5 || TEMP_SENSOR_REDUNDANT_TARGET > 7
#error "TEMP_SENSOR_REDUNDANT_TARGET must be between -5 and 7."
#elif TEMP_SENSOR_REDUNDANT_SOURCE == -3
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be -3 (not used)."
#elif TEMP_SENSOR_REDUNDANT_TARGET == -3
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be -3 (not used)."
#elif HAS_MULTI_HOTEND && TEMP_SENSOR_REDUNDANT_SOURCE < HOTENDS
#error "TEMP_SENSOR_REDUNDANT_SOURCE must be after the last TEMP_SENSOR used with a hotend; you can't use a sensor in the middle of two hotends."
#error "TEMP_SENSOR_REDUNDANT_SOURCE must be after the last used hotend TEMP_SENSOR."
#endif
#if TEMP_SENSOR_REDUNDANT_SOURCE == 0 && HAS_HOTEND
#error "TEMP_SENSOR_REDUNDANT_SOURCE can not be 0 if a hotend is used. E0 always uses TEMP_SENSOR_0."
#elif TEMP_SENSOR_REDUNDANT_SOURCE == -5 && HAS_TEMP_COOLER
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be Cooler (-5): TEMP_SENSOR_COOLER has already defined the sensor."
#elif TEMP_SENSOR_REDUNDANT_SOURCE == -4 && HAS_TEMP_PROBE
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be Probe (-4): TEMP_SENSOR_PROBE has already defined the sensor."
#elif TEMP_SENSOR_REDUNDANT_SOURCE == -2 && HAS_TEMP_CHAMBER
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be Chamber (-2): TEMP_SENSOR_CHAMBER has already defined the sensor."
#elif TEMP_SENSOR_REDUNDANT_SOURCE == -1 && HAS_TEMP_BED
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be Bed (-1): TEMP_SENSOR_BED has already defined the sensor."
#if REDUNDANT_TEMP_MATCH(SOURCE, E0) && HAS_HOTEND
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be E0 if a hotend is used. E0 always uses TEMP_SENSOR_0."
#elif REDUNDANT_TEMP_MATCH(SOURCE, COOLER) && HAS_TEMP_COOLER
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be COOLER. TEMP_SENSOR_COOLER is in use."
#elif REDUNDANT_TEMP_MATCH(SOURCE, PROBE) && HAS_TEMP_PROBE
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be PROBE. TEMP_SENSOR_PROBE is in use."
#elif REDUNDANT_TEMP_MATCH(SOURCE, BOARD) && HAS_TEMP_BOARD
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be BOARD. TEMP_SENSOR_BOARD is in use."
#elif REDUNDANT_TEMP_MATCH(SOURCE, CHAMBER) && HAS_TEMP_CHAMBER
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be CHAMBER. TEMP_SENSOR_CHAMBER is in use."
#elif REDUNDANT_TEMP_MATCH(SOURCE, BED) && HAS_TEMP_BED
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be BED. TEMP_SENSOR_BED is in use."
#endif
#if TEMP_SENSOR_REDUNDANT_TARGET == 0 && !PIN_EXISTS(TEMP_0)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E0 (0): requires TEMP_0_PIN"
#elif TEMP_SENSOR_REDUNDANT_TARGET == 1 && !PIN_EXISTS(TEMP_1)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E1 (1): requires TEMP_1_PIN"
#elif TEMP_SENSOR_REDUNDANT_TARGET == 2 && !PIN_EXISTS(TEMP_2)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E2 (2): requires TEMP_2_PIN"
#elif TEMP_SENSOR_REDUNDANT_TARGET == 3 && !PIN_EXISTS(TEMP_3)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E3 (3): requires TEMP_3_PIN"
#elif TEMP_SENSOR_REDUNDANT_TARGET == 4 && !PIN_EXISTS(TEMP_4)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E4 (4): requires TEMP_4_PIN"
#elif TEMP_SENSOR_REDUNDANT_TARGET == 5 && !PIN_EXISTS(TEMP_5)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E5 (5): requires TEMP_5_PIN"
#elif TEMP_SENSOR_REDUNDANT_TARGET == 6 && !PIN_EXISTS(TEMP_6)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E6 (6): requires TEMP_6_PIN"
#elif TEMP_SENSOR_REDUNDANT_TARGET == 7 && !PIN_EXISTS(TEMP_7)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E7 (7): requires TEMP_7_PIN"
#elif TEMP_SENSOR_REDUNDANT_TARGET == -1 && !PIN_EXISTS(TEMP_BED)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be Bed (-1): requires TEMP_BED_PIN"
#elif TEMP_SENSOR_REDUNDANT_TARGET == -2 && !PIN_EXISTS(TEMP_CHAMBER)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be Chamber (-2): requires TEMP_CHAMBER_PIN"
#elif TEMP_SENSOR_REDUNDANT_TARGET == -4 && !PIN_EXISTS(TEMP_PROBE)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be Probe (-4): requires TEMP_PROBE_PIN"
#elif TEMP_SENSOR_REDUNDANT_TARGET == -5 && !PIN_EXISTS(TEMP_COOLER)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be Cooler (-5): requires TEMP_COOLER_PIN"
#if REDUNDANT_TEMP_MATCH(TARGET, E0) && !PIN_EXISTS(TEMP_0)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E0 without TEMP_0_PIN defined."
#elif REDUNDANT_TEMP_MATCH(TARGET, E1) && !PIN_EXISTS(TEMP_1)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E1 without TEMP_1_PIN defined."
#elif REDUNDANT_TEMP_MATCH(TARGET, E2) && !PIN_EXISTS(TEMP_2)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E2 without TEMP_2_PIN defined."
#elif REDUNDANT_TEMP_MATCH(TARGET, E3) && !PIN_EXISTS(TEMP_3)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E3 without TEMP_3_PIN defined."
#elif REDUNDANT_TEMP_MATCH(TARGET, E4) && !PIN_EXISTS(TEMP_4)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E4 without TEMP_4_PIN defined."
#elif REDUNDANT_TEMP_MATCH(TARGET, E5) && !PIN_EXISTS(TEMP_5)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E5 without TEMP_5_PIN defined."
#elif REDUNDANT_TEMP_MATCH(TARGET, E6) && !PIN_EXISTS(TEMP_6)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E6 without TEMP_6_PIN defined."
#elif REDUNDANT_TEMP_MATCH(TARGET, E7) && !PIN_EXISTS(TEMP_7)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be E7 without TEMP_7_PIN defined."
#elif REDUNDANT_TEMP_MATCH(TARGET, BED) && !PIN_EXISTS(TEMP_BED)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be BED without TEMP_BED_PIN defined."
#elif REDUNDANT_TEMP_MATCH(TARGET, CHAMBER) && !PIN_EXISTS(TEMP_CHAMBER)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be CHAMBER without TEMP_CHAMBER_PIN defined."
#elif REDUNDANT_TEMP_MATCH(TARGET, BOARD) && !PIN_EXISTS(TEMP_BOARD)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be BOARD without TEMP_BOARD_PIN defined."
#elif REDUNDANT_TEMP_MATCH(TARGET, PROBE) && !PIN_EXISTS(TEMP_PROBE)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be PROBE without TEMP_PROBE_PIN defined."
#elif REDUNDANT_TEMP_MATCH(TARGET, COOLER) && !PIN_EXISTS(TEMP_COOLER)
#error "TEMP_SENSOR_REDUNDANT_TARGET can't be COOLER without TEMP_COOLER_PIN defined."
#endif
#if TEMP_SENSOR_REDUNDANT_IS_MAX_TC && REDUNDANT_TEMP_MATCH(SOURCE, E0) && !PIN_EXISTS(TEMP_0_CS)
@ -2235,6 +2237,28 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#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_BOARD
#if !PIN_EXISTS(TEMP_BOARD)
#error "TEMP_SENSOR_BOARD requires TEMP_BOARD_PIN."
#elif !HAS_TEMP_ADC_BOARD
#error "TEMP_BOARD_PIN must be an ADC pin."
#elif ENABLED(THERMAL_PROTECTION_BOARD) && (!defined(BOARD_MINTEMP) || !defined(BOARD_MAXTEMP))
#error "THERMAL_PROTECTION_BOARD requires BOARD_MINTEMP and BOARD_MAXTEMP."
#endif
#elif CONTROLLER_FAN_MIN_BOARD_TEMP
#error "CONTROLLER_FAN_MIN_BOARD_TEMP requires TEMP_SENSOR_BOARD."
#endif
#if ENABLED(LASER_COOLANT_FLOW_METER) && !(PIN_EXISTS(FLOWMETER) && ENABLED(LASER_FEATURE))
#error "LASER_COOLANT_FLOW_METER requires FLOWMETER_PIN and LASER_FEATURE."
#endif

View file

@ -128,6 +128,8 @@
#define THERMISTOR_NAME "Pt100 1K"
#elif THERMISTOR_ID == 666
#define THERMISTOR_NAME "Einstart S"
#elif THERMISTOR_ID == 2000
#define THERMISTOR_NAME "TDK NTCG104LH104JT1"
// High Temperature thermistors
#elif THERMISTOR_ID == 61

View file

@ -58,8 +58,8 @@
#endif
// 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)))
#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))
#define TEMP_SENSOR_IS_MAX(n, M) (ENABLED(TEMP_SENSOR_##n##_IS_MAX##M) || (ENABLED(TEMP_SENSOR_REDUNDANT_IS_MAX##M) && REDUNDANT_TEMP_MATCH(SOURCE, E##n)))
#define TEMP_SENSOR_IS_ANY_MAX_TC(n) (ENABLED(TEMP_SENSOR_##n##_IS_MAX_TC) || (ENABLED(TEMP_SENSOR_REDUNDANT_IS_MAX_TC) && REDUNDANT_TEMP_MATCH(SOURCE, E##n)))
// LIB_MAX6675 can be added to the build_flags in platformio.ini to use a user-defined library
// If LIB_MAX6675 is not on the build_flags then raw SPI reads will be used.
@ -281,7 +281,7 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
#endif
#if HAS_TEMP_REDUNDANT
redundant_temp_info_t Temperature::temp_redundant;
redundant_info_t Temperature::temp_redundant;
#endif
#if ENABLED(AUTO_POWER_E_FANS)
@ -455,6 +455,14 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
probe_info_t Temperature::temp_probe; // = { 0 }
#endif
#if HAS_TEMP_BOARD
board_info_t Temperature::temp_board; // = { 0 }
#if ENABLED(THERMAL_PROTECTION_BOARD)
int16_t Temperature::mintemp_raw_BOARD = TEMP_SENSOR_BOARD_RAW_LO_TEMP,
Temperature::maxtemp_raw_BOARD = TEMP_SENSOR_BOARD_RAW_HI_TEMP;
#endif
#endif
#if ENABLED(PREVENT_COLD_EXTRUSION)
bool Temperature::allow_cold_extrude = false;
celsius_t Temperature::extrude_min_temp = EXTRUDE_MINTEMP;
@ -956,14 +964,26 @@ void Temperature::_temp_error(const heater_id_t heater_id, PGM_P const serial_ms
SERIAL_ERROR_START();
SERIAL_ECHOPGM_P(serial_msg);
SERIAL_ECHOPGM(STR_STOPPED_HEATER);
if (heater_id >= 0)
SERIAL_ECHO(heater_id);
else if (TERN0(HAS_HEATED_CHAMBER, heater_id == H_CHAMBER))
SERIAL_ECHOPGM(STR_HEATER_CHAMBER);
else if (TERN0(HAS_COOLER, heater_id == H_COOLER))
SERIAL_ECHOPGM(STR_COOLER);
else
SERIAL_ECHOPGM(STR_HEATER_BED);
heater_id_t real_heater_id = heater_id;
#if HAS_TEMP_REDUNDANT
if (heater_id == H_REDUNDANT) {
SERIAL_ECHOPGM(STR_REDUNDANT); // print redundant and cascade to print target, too.
real_heater_id = (heater_id_t)HEATER_ID(TEMP_SENSOR_REDUNDANT_TARGET);
}
#endif
switch (real_heater_id) {
OPTCODE(HAS_TEMP_COOLER, case H_COOLER: SERIAL_ECHOPGM(STR_COOLER); break)
OPTCODE(HAS_TEMP_PROBE, case H_PROBE: SERIAL_ECHOPGM(STR_PROBE); break)
OPTCODE(HAS_TEMP_BOARD, case H_BOARD: SERIAL_ECHOPGM(STR_MOTHERBOARD); break)
OPTCODE(HAS_TEMP_CHAMBER, case H_CHAMBER: SERIAL_ECHOPGM(STR_HEATER_CHAMBER); break)
OPTCODE(HAS_TEMP_BED, case H_BED: SERIAL_ECHOPGM(STR_HEATER_BED); break)
default:
if (real_heater_id >= 0)
SERIAL_ECHOLNPAIR("E", real_heater_id);
}
SERIAL_EOL();
}
@ -1322,7 +1342,7 @@ void Temperature::manage_heater() {
#if HAS_TEMP_REDUNDANT
// Make sure measured temperatures are close together
if (ABS(degRedundantTarget() - degRedundant()) > TEMP_SENSOR_REDUNDANT_MAX_DIFF)
_temp_error((heater_id_t)TEMP_SENSOR_REDUNDANT_TARGET, PSTR(STR_REDUNDANCY), GET_TEXT(MSG_ERR_REDUNDANT_TEMP));
_temp_error((heater_id_t)HEATER_ID(TEMP_SENSOR_REDUNDANT_TARGET), PSTR(STR_REDUNDANCY), GET_TEXT(MSG_ERR_REDUNDANT_TEMP));
#endif
#if HAS_AUTO_FAN
@ -1682,6 +1702,9 @@ void Temperature::manage_heater() {
#if TEMP_SENSOR_PROBE_IS_CUSTOM
{ true, 0, 0, PROBE_PULLUP_RESISTOR_OHMS, PROBE_RESISTANCE_25C_OHMS, 0, 0, PROBE_BETA, 0 },
#endif
#if TEMP_SENSOR_BOARD_IS_CUSTOM
{ true, 0, 0, BOARD_PULLUP_RESISTOR_OHMS, BOARD_RESISTANCE_25C_OHMS, 0, 0, BOARD_BETA, 0 },
#endif
#if TEMP_SENSOR_REDUNDANT_IS_CUSTOM
{ true, 0, 0, REDUNDANT_PULLUP_RESISTOR_OHMS, REDUNDANT_RESISTANCE_25C_OHMS, 0, 0, REDUNDANT_BETA, 0 },
#endif
@ -1717,6 +1740,7 @@ void Temperature::manage_heater() {
TERN_(TEMP_SENSOR_CHAMBER_IS_CUSTOM, t_index == CTI_CHAMBER ? PSTR("CHAMBER") :)
TERN_(TEMP_SENSOR_COOLER_IS_CUSTOM, t_index == CTI_COOLER ? PSTR("COOLER") :)
TERN_(TEMP_SENSOR_PROBE_IS_CUSTOM, t_index == CTI_PROBE ? PSTR("PROBE") :)
TERN_(TEMP_SENSOR_BOARD_IS_CUSTOM, t_index == CTI_BOARD ? PSTR("BOARD") :)
TERN_(TEMP_SENSOR_REDUNDANT_IS_CUSTOM, t_index == CTI_REDUNDANT ? PSTR("REDUNDANT") :)
nullptr
);
@ -1952,14 +1976,32 @@ void Temperature::manage_heater() {
}
#endif // HAS_TEMP_PROBE
#if HAS_TEMP_BOARD
// For motherboard temperature measurement.
celsius_float_t Temperature::analog_to_celsius_board(const int16_t raw) {
#if TEMP_SENSOR_BOARD_IS_CUSTOM
return user_thermistor_to_deg_c(CTI_BOARD, raw);
#elif TEMP_SENSOR_BOARD_IS_THERMISTOR
SCAN_THERMISTOR_TABLE(TEMPTABLE_BOARD, TEMPTABLE_BOARD_LEN);
#elif TEMP_SENSOR_BOARD_IS_AD595
return TEMP_AD595(raw);
#elif TEMP_SENSOR_BOARD_IS_AD8495
return TEMP_AD8495(raw);
#else
UNUSED(raw);
return 0;
#endif
}
#endif // HAS_TEMP_BOARD
#if HAS_TEMP_REDUNDANT
// For redundant temperature measurement.
celsius_float_t Temperature::analog_to_celsius_redundant(const int16_t raw) {
#if TEMP_SENSOR_REDUNDANT_IS_CUSTOM
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 && REDUNDANT_TEMP_MATCH(SOURCE, E0)
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 && REDUNDANT_TEMP_MATCH(SOURCE, E1)
return TERN(TEMP_SENSOR_REDUNDANT_IS_MAX31865, max31865_1.temperature((uint16_t)raw), raw * 0.25);
#elif TEMP_SENSOR_REDUNDANT_IS_THERMISTOR
SCAN_THERMISTOR_TABLE(TEMPTABLE_REDUNDANT, TEMPTABLE_REDUNDANT_LEN);
@ -1992,7 +2034,7 @@ void Temperature::updateTemperaturesFromRawValues() {
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_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(HEATER_ID(TEMP_SENSOR_REDUNDANT_SOURCE)));
#if HAS_HOTEND
HOTEND_LOOP() temp_hotend[e].celsius = analog_to_celsius_hotend(temp_hotend[e].raw, e);
@ -2002,6 +2044,7 @@ void Temperature::updateTemperaturesFromRawValues() {
TERN_(HAS_TEMP_CHAMBER, temp_chamber.celsius = analog_to_celsius_chamber(temp_chamber.raw));
TERN_(HAS_TEMP_COOLER, temp_cooler.celsius = analog_to_celsius_cooler(temp_cooler.raw));
TERN_(HAS_TEMP_PROBE, temp_probe.celsius = analog_to_celsius_probe(temp_probe.raw));
TERN_(HAS_TEMP_BOARD, temp_board.celsius = analog_to_celsius_board(temp_board.raw));
TERN_(HAS_TEMP_REDUNDANT, temp_redundant.celsius = analog_to_celsius_redundant(temp_redundant.raw));
TERN_(FILAMENT_WIDTH_SENSOR, filwidth.update_measured_mm());
@ -2049,23 +2092,28 @@ void Temperature::updateTemperaturesFromRawValues() {
#endif // HAS_HOTEND
#define TP_CMP(S,A,B) (TEMPDIR(S) < 0 ? ((A)<(B)) : ((A)>(B)))
#if ENABLED(THERMAL_PROTECTION_BED)
#define BEDCMP(A,B) (TEMPDIR(BED) < 0 ? ((A)<(B)) : ((A)>(B)))
if (BEDCMP(temp_bed.raw, maxtemp_raw_BED)) max_temp_error(H_BED);
if (temp_bed.target > 0 && BEDCMP(mintemp_raw_BED, temp_bed.raw)) min_temp_error(H_BED);
if (TP_CMP(BED, temp_bed.raw, maxtemp_raw_BED)) max_temp_error(H_BED);
if (temp_bed.target > 0 && TP_CMP(BED, mintemp_raw_BED, temp_bed.raw)) min_temp_error(H_BED);
#endif
#if BOTH(HAS_HEATED_CHAMBER, THERMAL_PROTECTION_CHAMBER)
#define CHAMBERCMP(A,B) (TEMPDIR(CHAMBER) < 0 ? ((A)<(B)) : ((A)>(B)))
if (CHAMBERCMP(temp_chamber.raw, maxtemp_raw_CHAMBER)) max_temp_error(H_CHAMBER);
if (temp_chamber.target > 0 && CHAMBERCMP(mintemp_raw_CHAMBER, temp_chamber.raw)) min_temp_error(H_CHAMBER);
if (TP_CMP(CHAMBER, temp_chamber.raw, maxtemp_raw_CHAMBER)) max_temp_error(H_CHAMBER);
if (temp_chamber.target > 0 && TP_CMP(CHAMBER, mintemp_raw_CHAMBER, temp_chamber.raw)) min_temp_error(H_CHAMBER);
#endif
#if BOTH(HAS_COOLER, THERMAL_PROTECTION_COOLER)
#define COOLERCMP(A,B) (TEMPDIR(COOLER) < 0 ? ((A)<(B)) : ((A)>(B)))
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 (cutter.unitPower > 0 && TP_CMP(COOLER, temp_cooler.raw, maxtemp_raw_COOLER)) max_temp_error(H_COOLER);
if (TP_CMP(COOLER, mintemp_raw_COOLER, temp_cooler.raw)) min_temp_error(H_COOLER);
#endif
#if BOTH(HAS_TEMP_BOARD, THERMAL_PROTECTION_BOARD)
if (TP_CMP(BOARD, temp_board.raw, maxtemp_raw_BOARD)) max_temp_error(H_BOARD);
if (TP_CMP(BOARD, mintemp_raw_BOARD, temp_board.raw)) min_temp_error(H_BOARD);
#endif
#undef TP_CMP
} // Temperature::updateTemperaturesFromRawValues
/**
@ -2294,6 +2342,9 @@ void Temperature::init() {
#if HAS_TEMP_ADC_PROBE
HAL_ANALOG_SELECT(TEMP_PROBE_PIN);
#endif
#if HAS_TEMP_ADC_BOARD
HAL_ANALOG_SELECT(TEMP_BOARD_PIN);
#endif
#if HAS_TEMP_ADC_REDUNDANT
HAL_ANALOG_SELECT(TEMP_REDUNDANT_PIN);
#endif
@ -2407,6 +2458,7 @@ void Temperature::init() {
#endif
#endif // HAS_HOTEND
// TODO: combine these into the macros above
#if HAS_HEATED_BED
while (analog_to_celsius_bed(mintemp_raw_BED) < BED_MINTEMP) mintemp_raw_BED += TEMPDIR(BED) * (OVERSAMPLENR);
while (analog_to_celsius_bed(maxtemp_raw_BED) > BED_MAXTEMP) maxtemp_raw_BED -= TEMPDIR(BED) * (OVERSAMPLENR);
@ -2422,18 +2474,25 @@ void Temperature::init() {
while (analog_to_celsius_cooler(maxtemp_raw_COOLER) < COOLER_MAXTEMP) maxtemp_raw_COOLER -= TEMPDIR(COOLER) * (OVERSAMPLENR);
#endif
#if BOTH(HAS_TEMP_BOARD, THERMAL_PROTECTION_BOARD)
while (analog_to_celsius_board(mintemp_raw_BOARD) < BOARD_MINTEMP) mintemp_raw_BOARD += TEMPDIR(BOARD) * (OVERSAMPLENR);
while (analog_to_celsius_board(maxtemp_raw_BOARD) > BOARD_MAXTEMP) maxtemp_raw_BOARD -= TEMPDIR(BOARD) * (OVERSAMPLENR);
#endif
#if HAS_TEMP_REDUNDANT
temp_redundant.target = &(
#if TEMP_SENSOR_REDUNDANT_TARGET == -5 && HAS_TEMP_COOLER
#if REDUNDANT_TEMP_MATCH(TARGET, COOLER) && HAS_TEMP_COOLER
temp_cooler
#elif TEMP_SENSOR_REDUNDANT_TARGET == -4 && HAS_TEMP_PROBE
#elif REDUNDANT_TEMP_MATCH(TARGET, PROBE) && HAS_TEMP_PROBE
temp_probe
#elif TEMP_SENSOR_REDUNDANT_TARGET == -2 && HAS_TEMP_CHAMBER
#elif REDUNDANT_TEMP_MATCH(TARGET, BOARD) && HAS_TEMP_BOARD
temp_board
#elif REDUNDANT_TEMP_MATCH(TARGET, CHAMBER) && HAS_TEMP_CHAMBER
temp_chamber
#elif TEMP_SENSOR_REDUNDANT_TARGET == -1 && HAS_TEMP_BED
#elif REDUNDANT_TEMP_MATCH(TARGET, BED) && HAS_TEMP_BED
temp_bed
#else
temp_hotend[TEMP_SENSOR_REDUNDANT_TARGET]
temp_hotend[HEATER_ID(TEMP_SENSOR_REDUNDANT_TARGET)]
#endif
);
#endif
@ -2806,6 +2865,7 @@ void Temperature::disable_all_heaters() {
*/
void Temperature::update_raw_temperatures() {
// TODO: can this be collapsed into a HOTEND_LOOP()?
#if HAS_TEMP_ADC_0 && !TEMP_SENSOR_0_IS_MAX_TC
temp_hotend[0].update();
#endif
@ -2827,6 +2887,7 @@ void Temperature::update_raw_temperatures() {
TERN_(HAS_TEMP_ADC_BED, temp_bed.update());
TERN_(HAS_TEMP_ADC_CHAMBER, temp_chamber.update());
TERN_(HAS_TEMP_ADC_PROBE, temp_probe.update());
TERN_(HAS_TEMP_ADC_BOARD, temp_board.update());
TERN_(HAS_TEMP_ADC_COOLER, temp_cooler.update());
TERN_(HAS_JOY_ADC_X, joystick.x.update());
@ -2857,6 +2918,7 @@ void Temperature::readings_ready() {
TERN_(HAS_TEMP_CHAMBER, temp_chamber.reset());
TERN_(HAS_TEMP_PROBE, temp_probe.reset());
TERN_(HAS_TEMP_COOLER, temp_cooler.reset());
TERN_(HAS_TEMP_BOARD, temp_board.reset());
TERN_(HAS_TEMP_REDUNDANT, temp_redundant.reset());
TERN_(HAS_JOY_ADC_X, joystick.x.reset());
@ -3283,6 +3345,11 @@ void Temperature::isr() {
case MeasureTemp_PROBE: ACCUMULATE_ADC(temp_probe); break;
#endif
#if HAS_TEMP_ADC_BOARD
case PrepareTemp_BOARD: HAL_START_ADC(TEMP_BOARD_PIN); break;
case MeasureTemp_BOARD: ACCUMULATE_ADC(temp_board); break;
#endif
#if HAS_TEMP_ADC_REDUNDANT
case PrepareTemp_REDUNDANT: HAL_START_ADC(TEMP_REDUNDANT_PIN); break;
case MeasureTemp_REDUNDANT: ACCUMULATE_ADC(temp_redundant); break;
@ -3449,6 +3516,9 @@ void Temperature::isr() {
#if HAS_TEMP_COOLER
case H_COOLER: k = 'L'; break;
#endif
#if HAS_TEMP_BOARD
case H_BOARD: k = 'M'; break;
#endif
#if HAS_TEMP_REDUNDANT
case H_REDUNDANT: k = 'R'; break;
#endif
@ -3478,7 +3548,7 @@ void Temperature::isr() {
OPTARG(HAS_TEMP_REDUNDANT, const bool include_r/*=false*/)
) {
#if HAS_TEMP_HOTEND
print_heater_state(H_NONE, degHotend(target_extruder), degTargetHotend(target_extruder) OPTARG(SHOW_TEMP_ADC_VALUES, rawHotendTemp(target_extruder)));
print_heater_state(H_E0, degHotend(target_extruder), degTargetHotend(target_extruder) OPTARG(SHOW_TEMP_ADC_VALUES, rawHotendTemp(target_extruder)));
#endif
#if HAS_HEATED_BED
print_heater_state(H_BED, degBed(), degTargetBed() OPTARG(SHOW_TEMP_ADC_VALUES, rawBedTemp()));
@ -3492,6 +3562,9 @@ void Temperature::isr() {
#if HAS_TEMP_PROBE
print_heater_state(H_PROBE, degProbe(), 0 OPTARG(SHOW_TEMP_ADC_VALUES, rawProbeTemp()));
#endif
#if HAS_TEMP_BOARD
print_heater_state(H_BOARD, degBoard(), 0 OPTARG(SHOW_TEMP_ADC_VALUES, rawBoardTemp()));
#endif
#if HAS_TEMP_REDUNDANT
if (include_r) print_heater_state(H_REDUNDANT, degRedundant(), degRedundantTarget() OPTARG(SHOW_TEMP_ADC_VALUES, rawRedundantTemp()));
#endif

View file

@ -46,9 +46,13 @@
// Element identifiers. Positive values are hotends. Negative values are other heaters or coolers.
typedef enum : int8_t {
H_NONE = -6,
H_COOLER, H_PROBE, H_REDUNDANT, H_CHAMBER, H_BED,
H_E0, H_E1, H_E2, H_E3, H_E4, H_E5, H_E6, H_E7
H_REDUNDANT = HID_REDUNDANT,
H_COOLER = HID_COOLER,
H_PROBE = HID_PROBE,
H_BOARD = HID_BOARD,
H_CHAMBER = HID_CHAMBER,
H_BED = HID_BED,
H_E0 = HID_E0, H_E1, H_E2, H_E3, H_E4, H_E5, H_E6, H_E7
} heater_id_t;
// PID storage
@ -105,6 +109,9 @@ enum ADCSensorState : char {
#if HAS_TEMP_ADC_PROBE
PrepareTemp_PROBE, MeasureTemp_PROBE,
#endif
#if HAS_TEMP_ADC_BOARD
PrepareTemp_BOARD, MeasureTemp_BOARD,
#endif
#if HAS_TEMP_ADC_REDUNDANT
PrepareTemp_REDUNDANT, MeasureTemp_REDUNDANT,
#endif
@ -192,7 +199,7 @@ typedef struct TempInfo {
// A redundant temperature sensor
typedef struct RedundantTempInfo : public TempInfo {
temp_info_t* target;
} redundant_temp_info_t;
} redundant_info_t;
#endif
// A PWM heater with temperature sensor
@ -231,6 +238,9 @@ struct PIDHeaterInfo : public HeaterInfo {
#elif HAS_TEMP_CHAMBER
typedef temp_info_t chamber_info_t;
#endif
#if HAS_TEMP_BOARD
typedef temp_info_t board_info_t;
#endif
#if EITHER(HAS_COOLER, HAS_TEMP_COOLER)
typedef heater_info_t cooler_info_t;
#endif
@ -312,6 +322,9 @@ typedef struct { int16_t raw_min, raw_max; celsius_t mintemp, maxtemp; } temp_ra
#if TEMP_SENSOR_COOLER_IS_CUSTOM
CTI_COOLER,
#endif
#if TEMP_SENSOR_BOARD_IS_CUSTOM
CTI_BOARD,
#endif
#if TEMP_SENSOR_REDUNDANT_IS_CUSTOM
CTI_REDUNDANT,
#endif
@ -352,8 +365,11 @@ class Temperature {
#if HAS_TEMP_COOLER
static cooler_info_t temp_cooler;
#endif
#if HAS_TEMP_BOARD
static board_info_t temp_board;
#endif
#if HAS_TEMP_REDUNDANT
static redundant_temp_info_t temp_redundant;
static redundant_info_t temp_redundant;
#endif
#if ENABLED(AUTO_POWER_E_FANS)
@ -478,6 +494,10 @@ class Temperature {
static int16_t mintemp_raw_COOLER, maxtemp_raw_COOLER;
#endif
#if HAS_TEMP_BOARD && ENABLED(THERMAL_PROTECTION_BOARD)
static int16_t mintemp_raw_BOARD, maxtemp_raw_BOARD;
#endif
#if MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED > 1
static uint8_t consecutive_low_temperature_error[HOTENDS];
#endif
@ -551,6 +571,9 @@ class Temperature {
#if HAS_TEMP_COOLER
static celsius_float_t analog_to_celsius_cooler(const int16_t raw);
#endif
#if HAS_TEMP_BOARD
static celsius_float_t analog_to_celsius_board(const int16_t raw);
#endif
#if HAS_TEMP_REDUNDANT
static celsius_float_t analog_to_celsius_redundant(const int16_t raw);
#endif
@ -787,6 +810,14 @@ class Temperature {
#endif
#endif
#if HAS_TEMP_BOARD
#if ENABLED(SHOW_TEMP_ADC_VALUES)
static inline int16_t rawBoardTemp() { return temp_board.raw; }
#endif
static inline celsius_float_t degBoard() { return temp_board.celsius; }
static inline celsius_t wholeDegBoard() { return static_cast<celsius_t>(temp_board.celsius + 0.5f); }
#endif
#if HAS_TEMP_REDUNDANT
#if ENABLED(SHOW_TEMP_ADC_VALUES)
static inline int16_t rawRedundantTemp() { return temp_redundant.raw; }

View file

@ -0,0 +1,60 @@
/**
* 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/>.
*
*/
#pragma once
// R25 = 100 KOhm, beta25 = 4550 K, 4.7 kOhm pull-up, TDK NTCG104LH104KT1 https://product.tdk.com/en/search/sensor/ntc/chip-ntc-thermistor/info?part_no=NTCG104LH104KT1
constexpr temp_entry_t temptable_2000[] PROGMEM = {
{ OV(313), 125 },
{ OV(347), 120 },
{ OV(383), 115 },
{ OV(422), 110 },
{ OV(463), 105 },
{ OV(506), 100 },
{ OV(549), 95 },
{ OV(594), 90 },
{ OV(638), 85 },
{ OV(681), 80 },
{ OV(722), 75 },
{ OV(762), 70 },
{ OV(799), 65 },
{ OV(833), 60 },
{ OV(863), 55 },
{ OV(890), 50 },
{ OV(914), 45 },
{ OV(934), 40 },
{ OV(951), 35 },
{ OV(966), 30 },
{ OV(978), 25 },
{ OV(988), 20 },
{ OV(996), 15 },
{ OV(1002), 10 },
{ OV(1007), 5 },
{ OV(1012), 0 },
{ OV(1015), -5 },
{ OV(1017), -10 },
{ OV(1019), -15 },
{ OV(1020), -20 },
{ OV(1021), -25 },
{ OV(1022), -30 },
{ OV(1023), -35 },
{ OV(1023), -40 }
};

View file

@ -51,6 +51,7 @@
|| TEMP_SENSOR_IS(n, CHAMBER) \
|| TEMP_SENSOR_IS(n, COOLER) \
|| TEMP_SENSOR_IS(n, PROBE) \
|| TEMP_SENSOR_IS(n, BOARD) \
|| TEMP_SENSOR_IS(n, REDUNDANT) )
typedef struct { int16_t value; celsius_t celsius; } temp_entry_t;
@ -200,6 +201,9 @@ typedef struct { int16_t value; celsius_t celsius; } temp_entry_t;
#if ANY_THERMISTOR_IS(1047) // Pt1000 with 4k7 pullup
#include "thermistor_1047.h"
#endif
#if ANY_THERMISTOR_IS(2000) // "Ultimachine Rambo TDK NTCG104LH104KT1 NTC100K motherboard Thermistor" https://product.tdk.com/en/search/sensor/ntc/chip-ntc-thermistor/info?part_no=NTCG104LH104KT1
#include "thermistor_2000.h"
#endif
#if ANY_THERMISTOR_IS(998) // User-defined table 1
#include "thermistor_998.h"
#endif
@ -305,6 +309,13 @@ typedef struct { int16_t value; celsius_t celsius; } temp_entry_t;
#define TEMPTABLE_PROBE_LEN 0
#endif
#if TEMP_SENSOR_BOARD > 0
#define TEMPTABLE_BOARD TT_NAME(TEMP_SENSOR_BOARD)
#define TEMPTABLE_BOARD_LEN COUNT(TEMPTABLE_BOARD)
#else
#define TEMPTABLE_BOARD_LEN 0
#endif
#if TEMP_SENSOR_REDUNDANT > 0
#define TEMPTABLE_REDUNDANT TT_NAME(TEMP_SENSOR_REDUNDANT)
#define TEMPTABLE_REDUNDANT_LEN COUNT(TEMPTABLE_REDUNDANT)
@ -319,6 +330,7 @@ static_assert(255 > TEMPTABLE_0_LEN || 255 > TEMPTABLE_1_LEN || 255 > TEMPTABLE_
|| 255 > TEMPTABLE_CHAMBER_LEN
|| 255 > TEMPTABLE_COOLER_LEN
|| 255 > TEMPTABLE_PROBE_LEN
|| 255 > TEMPTABLE_BOARD_LEN
|| 255 > TEMPTABLE_REDUNDANT_LEN
, "Temperature conversion tables over 255 entries need special consideration."
);
@ -513,6 +525,15 @@ static_assert(255 > TEMPTABLE_0_LEN || 255 > TEMPTABLE_1_LEN || 255 > TEMPTABLE_
#define TEMP_SENSOR_PROBE_RAW_LO_TEMP MAX_RAW_THERMISTOR_VALUE
#endif
#endif
#ifndef TEMP_SENSOR_BOARD_RAW_HI_TEMP
#if TT_REVRAW(BOARD)
#define TEMP_SENSOR_BOARD_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE
#define TEMP_SENSOR_BOARD_RAW_LO_TEMP 0
#else
#define TEMP_SENSOR_BOARD_RAW_HI_TEMP 0
#define TEMP_SENSOR_BOARD_RAW_LO_TEMP MAX_RAW_THERMISTOR_VALUE
#endif
#endif
#ifndef TEMP_SENSOR_REDUNDANT_RAW_HI_TEMP
#if TT_REVRAW(REDUNDANT)
#define TEMP_SENSOR_REDUNDANT_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE

View file

@ -65,7 +65,7 @@
#define TEMP_BED_PIN P0_23_A0 // A0 (T0) - (67) - TEMP_BED_PIN
#endif
#if HOTENDS == 1 && TEMP_SENSOR_REDUNDANT_SOURCE != 1
#if HOTENDS == 1 && !REDUNDANT_TEMP_MATCH(SOURCE, E1)
#if TEMP_SENSOR_PROBE
#define TEMP_PROBE_PIN TEMP_1_PIN
#elif TEMP_SENSOR_CHAMBER

View file

@ -165,8 +165,8 @@
//
#define TEMP_0_PIN P0_24
#define TEMP_1_PIN P0_23
//#define TEMP_2_PIN P1_30 // Onboard thermistor
#define TEMP_BED_PIN P0_25
#define TEMP_BOARD_PIN P1_30 // Onboard thermistor, NTC100K
//
// Heaters / Fans

View file

@ -114,10 +114,11 @@
//
// Temperature Sensors
//
#define TEMP_0_PIN 0 // Analog Input
#define TEMP_1_PIN 1 // Analog Input
#define TEMP_BED_PIN 2 // Analog Input
#define TEMP_PROBE_PIN 3 // Analog Input
#define TEMP_0_PIN 0 // Analog Input, Header J2
#define TEMP_1_PIN 1 // Analog Input, Header J3
#define TEMP_BOARD_PIN 91 // Onboard thermistor, 100k TDK NTCG104LH104JT1
#define TEMP_BED_PIN 2 // Analog Input, Header J6
#define TEMP_PROBE_PIN 3 // Analog Input, Header J15
//
// Heaters / Fans

View file

@ -68,8 +68,8 @@
//
#define TEMP_0_PIN 0 // Analog Input (HOTEND0 thermistor)
#define TEMP_1_PIN 2 // Analog Input (unused)
#define TEMP_2_PIN 5 // Analog Input (OnBoard thermistor beta 3950)
#define TEMP_BED_PIN 1 // Analog Input (BED thermistor)
#define TEMP_BOARD_PIN 5 // Analog Input (OnBoard thermistor beta 3950)
// SPI for MAX Thermocouple
#if DISABLED(SDSUPPORT)

View file

@ -161,6 +161,7 @@
//
#define TEMP_0_PIN PA2 // T0 <-> E0
#define TEMP_1_PIN PA0 // T1 <-> E1
#define TEMP_BOARD_PIN PC2 // Onboard thermistor, NTC100K
#define TEMP_BED_PIN PA1 // T2 <-> Bed
#define TEMP_PROBE_PIN PC3 // Shares J4 connector with PD1

View file

@ -199,6 +199,17 @@ opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT EEPROM_SETTINGS EEPROM_BOO
exec_test $1 $2 "REPRAP MEGA2560 RAMPS | Laser Feature | Air Evacuation | Air Assist | Cooler | Flowmeter | 44780 LCD " "$3"
#
# Test redundant temperature sensors + MAX TC
#
restore_configs
opt_set MOTHERBOARD BOARD_RAMPS_14_EFB EXTRUDERS 1 \
TEMP_SENSOR_0 -2 TEMP_SENSOR_REDUNDANT -2 \
TEMP_SENSOR_REDUNDANT_SOURCE E1 TEMP_SENSOR_REDUNDANT_TARGET E0 \
TEMP_0_CS_PIN 11 TEMP_1_CS_PIN 12
exec_test $1 $2 "MEGA2560 RAMPS | Redundant temperature sensor | 2x MAX6675" "$3"
#
# Language files test with REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
#