diff --git a/Marlin/src/inc/Conditionals-1-axes.h b/Marlin/src/inc/Conditionals-1-axes.h index 1ad256b3b8..d81aa2c746 100644 --- a/Marlin/src/inc/Conditionals-1-axes.h +++ b/Marlin/src/inc/Conditionals-1-axes.h @@ -53,14 +53,6 @@ #else #undef EXTRUDERS #define EXTRUDERS 0 - #undef TEMP_SENSOR_0 - #undef TEMP_SENSOR_1 - #undef TEMP_SENSOR_2 - #undef TEMP_SENSOR_3 - #undef TEMP_SENSOR_4 - #undef TEMP_SENSOR_5 - #undef TEMP_SENSOR_6 - #undef TEMP_SENSOR_7 #undef SINGLENOZZLE #undef SWITCHING_EXTRUDER #undef MECHANICAL_SWITCHING_EXTRUDER @@ -222,6 +214,52 @@ #undef HOTEND_OFFSET_Z #endif +// Clean up unused temperature sensors and sub-options +#define UNUSED_TEMP_SENSOR(N) (!TEMP_SENSOR_##N || N >= HOTENDS) +#if UNUSED_TEMP_SENSOR(0) + #undef TEMP_SENSOR_0 +#endif +#if UNUSED_TEMP_SENSOR(1) + #undef TEMP_SENSOR_1 +#endif +#if UNUSED_TEMP_SENSOR(2) + #undef TEMP_SENSOR_2 +#endif +#if UNUSED_TEMP_SENSOR(3) + #undef TEMP_SENSOR_3 +#endif +#if UNUSED_TEMP_SENSOR(4) + #undef TEMP_SENSOR_4 +#endif +#if UNUSED_TEMP_SENSOR(5) + #undef TEMP_SENSOR_5 +#endif +#if UNUSED_TEMP_SENSOR(6) + #undef TEMP_SENSOR_6 +#endif +#if UNUSED_TEMP_SENSOR(7) + #undef TEMP_SENSOR_7 +#endif +#if !TEMP_SENSOR_BED + #undef TEMP_SENSOR_BED +#endif +#if !TEMP_SENSOR_CHAMBER + #undef TEMP_SENSOR_CHAMBER +#endif +#if !TEMP_SENSOR_PROBE + #undef TEMP_SENSOR_PROBE +#endif +#if !TEMP_SENSOR_REDUNDANT + #undef TEMP_SENSOR_REDUNDANT +#endif +#if !TEMP_SENSOR_BOARD + #undef TEMP_SENSOR_BOARD +#endif +#if !TEMP_SENSOR_SOC + #undef TEMP_SENSOR_SOC +#endif +#undef UNUSED_TEMP_SENSOR + /** * Number of Linear Axes (e.g., XYZIJKUVW) * All the logical axes except for the tool (E) axis diff --git a/Marlin/src/inc/Conditionals-3-etc.h b/Marlin/src/inc/Conditionals-3-etc.h index 3fa80726f1..f5568b669a 100644 --- a/Marlin/src/inc/Conditionals-3-etc.h +++ b/Marlin/src/inc/Conditionals-3-etc.h @@ -40,48 +40,17 @@ // Remove irrelevant Configuration.h settings // -// Clean up unused temperature sensors and sub-options - -#define UNUSED_TEMP_SENSOR(N) (!TEMP_SENSOR_##N || N >= HOTENDS) -#if UNUSED_TEMP_SENSOR(0) - #undef TEMP_SENSOR_0 -#endif -#if UNUSED_TEMP_SENSOR(1) - #undef TEMP_SENSOR_1 -#endif -#if UNUSED_TEMP_SENSOR(2) - #undef TEMP_SENSOR_2 -#endif -#if UNUSED_TEMP_SENSOR(3) - #undef TEMP_SENSOR_3 -#endif -#if UNUSED_TEMP_SENSOR(4) - #undef TEMP_SENSOR_4 -#endif -#if UNUSED_TEMP_SENSOR(5) - #undef TEMP_SENSOR_5 -#endif -#if UNUSED_TEMP_SENSOR(6) - #undef TEMP_SENSOR_6 -#endif -#if UNUSED_TEMP_SENSOR(7) - #undef TEMP_SENSOR_7 -#endif -#undef UNUSED_TEMP_SENSOR - #if !HAS_HOTEND #undef PREHEAT_1_TEMP_HOTEND #undef PREHEAT_2_TEMP_HOTEND #endif #if !TEMP_SENSOR_BED - #undef TEMP_SENSOR_BED #undef THERMAL_PROTECTION_BED #undef MAX_BED_POWER #undef PREHEAT_1_TEMP_BED #undef PREHEAT_2_TEMP_BED #endif #if !TEMP_SENSOR_CHAMBER - #undef TEMP_SENSOR_CHAMBER #undef THERMAL_PROTECTION_CHAMBER #undef MAX_CHAMBER_POWER #undef PREHEAT_1_TEMP_CHAMBER @@ -91,18 +60,6 @@ #undef TEMP_SENSOR_COOLER #undef THERMAL_PROTECTION_COOLER #endif -#if !TEMP_SENSOR_PROBE - #undef TEMP_SENSOR_PROBE -#endif -#if !TEMP_SENSOR_REDUNDANT - #undef TEMP_SENSOR_REDUNDANT -#endif -#if !TEMP_SENSOR_BOARD - #undef TEMP_SENSOR_BOARD -#endif -#if !TEMP_SENSOR_SOC - #undef TEMP_SENSOR_SOC -#endif #if !SOFT_PWM_SCALE #undef SOFT_PWM_SCALE #endif diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 83deaa6694..819133f30d 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -348,6 +348,7 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED); #define CHECK_MAXTEMP_(N,M,S) static_assert( \ S >= 998 || M <= _MAX(TT_NAME(S)[0].celsius, TT_NAME(S)[COUNT(TT_NAME(S)) - 1].celsius) - (HOTEND_OVERSHOOT), \ "HEATER_" STRINGIFY(N) "_MAXTEMP (" STRINGIFY(M) ") is too high for thermistor_" STRINGIFY(S) ".h with HOTEND_OVERSHOOT=" STRINGIFY(HOTEND_OVERSHOOT) "."); + // This solution requires TEMP_SENSOR_* for all HOTENDS to be defined or compile fails #define CHECK_MAXTEMP(N) TERN(TEMP_SENSOR_##N##_IS_THERMISTOR, CHECK_MAXTEMP_, CODE_0)(N, HEATER_##N##_MAXTEMP, TEMP_SENSOR_##N) REPEAT(HOTENDS, CHECK_MAXTEMP) diff --git a/Marlin/src/pins/mega/pins_MEGACONTROLLER.h b/Marlin/src/pins/mega/pins_MEGACONTROLLER.h index 4ee5df8c66..d18350da47 100644 --- a/Marlin/src/pins/mega/pins_MEGACONTROLLER.h +++ b/Marlin/src/pins/mega/pins_MEGACONTROLLER.h @@ -86,13 +86,13 @@ // // Temperature Sensors // -#if TEMP_SENSOR_0 == -1 +#if TEMP_SENSOR_0_IS_AD595 #define TEMP_0_PIN 4 // Analog Input #else #define TEMP_0_PIN 0 // Analog Input #endif -#if TEMP_SENSOR_1 == -1 +#if TEMP_SENSOR_1_IS_AD595 #define TEMP_1_PIN 5 // Analog Input #else #define TEMP_1_PIN 2 // Analog Input @@ -100,7 +100,7 @@ #define TEMP_2_PIN 3 // Analog Input -#if TEMP_SENSOR_BED == -1 +#if TEMP_SENSOR_BED_IS_AD595 #define TEMP_BED_PIN 6 // Analog Input #else #define TEMP_BED_PIN 1 // Analog Input diff --git a/Marlin/src/pins/mega/pins_MEGATRONICS.h b/Marlin/src/pins/mega/pins_MEGATRONICS.h index d5616c0026..c6ffea8e1c 100644 --- a/Marlin/src/pins/mega/pins_MEGATRONICS.h +++ b/Marlin/src/pins/mega/pins_MEGATRONICS.h @@ -73,7 +73,7 @@ // // Temperature Sensors // -#if TEMP_SENSOR_0 == -1 +#if TEMP_SENSOR_0_IS_AD595 #define TEMP_0_PIN 8 // Analog Input #else #define TEMP_0_PIN 13 // Analog Input diff --git a/Marlin/src/pins/mega/pins_MEGATRONICS_2.h b/Marlin/src/pins/mega/pins_MEGATRONICS_2.h index 9f7abd3fb8..edb1295b94 100644 --- a/Marlin/src/pins/mega/pins_MEGATRONICS_2.h +++ b/Marlin/src/pins/mega/pins_MEGATRONICS_2.h @@ -77,19 +77,17 @@ // // Temperature Sensors // -#if TEMP_SENSOR_0 == -1 +#if TEMP_SENSOR_0_IS_AD595 #define TEMP_0_PIN 4 // Analog Input #else #define TEMP_0_PIN 13 // Analog Input #endif - -#if TEMP_SENSOR_1 == -1 +#if TEMP_SENSOR_1_IS_AD595 #define TEMP_1_PIN 8 // Analog Input #else #define TEMP_1_PIN 15 // Analog Input #endif - -#if TEMP_SENSOR_BED == -1 +#if TEMP_SENSOR_BED_IS_AD595 #define TEMP_BED_PIN 8 // Analog Input #else #define TEMP_BED_PIN 14 // Analog Input diff --git a/Marlin/src/pins/mega/pins_MEGATRONICS_3.h b/Marlin/src/pins/mega/pins_MEGATRONICS_3.h index 4c60ef1a5b..4e3f52f7b8 100644 --- a/Marlin/src/pins/mega/pins_MEGATRONICS_3.h +++ b/Marlin/src/pins/mega/pins_MEGATRONICS_3.h @@ -98,22 +98,22 @@ // // Temperature Sensors // -#if TEMP_SENSOR_0 == -1 +#if TEMP_SENSOR_0_IS_AD595 #define TEMP_0_PIN 11 // Analog Input #else #define TEMP_0_PIN 15 // Analog Input #endif -#if TEMP_SENSOR_1 == -1 +#if TEMP_SENSOR_1_IS_AD595 #define TEMP_1_PIN 10 // Analog Input #else #define TEMP_1_PIN 13 // Analog Input #endif -#if TEMP_SENSOR_2 == -1 +#if TEMP_SENSOR_2_IS_AD595 #define TEMP_2_PIN 9 // Analog Input #else #define TEMP_2_PIN 12 // Analog Input #endif -#if TEMP_SENSOR_BED == -1 +#if TEMP_SENSOR_BED_IS_AD595 #define TEMP_BED_PIN 8 // Analog Input #else #define TEMP_BED_PIN 14 // Analog Input diff --git a/Marlin/src/pins/ramps/pins_RUMBA.h b/Marlin/src/pins/ramps/pins_RUMBA.h index c62b68f6cc..b49487ff5f 100644 --- a/Marlin/src/pins/ramps/pins_RUMBA.h +++ b/Marlin/src/pins/ramps/pins_RUMBA.h @@ -112,7 +112,7 @@ // Temperature Sensors // #ifndef TEMP_0_PIN - #if TEMP_SENSOR_0 == -1 + #if TEMP_SENSOR_0_IS_AD595 #define TEMP_0_PIN 6 // Analog Input (connector *K1* on RUMBA thermocouple ADD ON is used) #else #define TEMP_0_PIN 15 // Analog Input (default connector for thermistor *T0* on rumba board is used) @@ -120,14 +120,14 @@ #endif #ifndef TEMP_1_PIN - #if TEMP_SENSOR_1 == -1 + #if TEMP_SENSOR_1_IS_AD595 #define TEMP_1_PIN 5 // Analog Input (connector *K2* on RUMBA thermocouple ADD ON is used) #else #define TEMP_1_PIN 14 // Analog Input (default connector for thermistor *T1* on rumba board is used) #endif #endif -#if TEMP_SENSOR_2 == -1 +#if TEMP_SENSOR_2_IS_AD595 #define TEMP_2_PIN 7 // Analog Input (connector *K3* on RUMBA thermocouple ADD ON is used <-- this can't be used when TEMP_SENSOR_BED is defined as thermocouple) #else #define TEMP_2_PIN 13 // Analog Input (default connector for thermistor *T2* on rumba board is used) @@ -140,7 +140,7 @@ //#define TEMP_CHAMBER_PIN 12 // Analog Input (default connector for thermistor *T3* on rumba board is used) #endif -#if TEMP_SENSOR_BED == -1 +#if TEMP_SENSOR_BED_IS_AD595 #define TEMP_BED_PIN 7 // Analog Input (connector *K3* on RUMBA thermocouple ADD ON is used <-- this can't be used when TEMP_SENSOR_2 is defined as thermocouple) #else #define TEMP_BED_PIN 11 // Analog Input (default connector for thermistor *THB* on rumba board is used) diff --git a/Marlin/src/pins/ramps/pins_TANGO.h b/Marlin/src/pins/ramps/pins_TANGO.h index 0f8aaca0e2..214f11e5e0 100644 --- a/Marlin/src/pins/ramps/pins_TANGO.h +++ b/Marlin/src/pins/ramps/pins_TANGO.h @@ -37,7 +37,7 @@ #endif #ifndef TEMP_0_PIN - #if TEMP_SENSOR_0 == -1 + #if TEMP_SENSOR_0_IS_AD595 #define TEMP_0_PIN 10 // Analog Input (connector *K1* on Tango thermocouple ADD ON is used) #else #define TEMP_0_PIN 15 // Analog Input (default connector for thermistor *T0* on rumba board is used) @@ -45,7 +45,7 @@ #endif #ifndef TEMP_1_PIN - #if TEMP_SENSOR_1 == -1 + #if TEMP_SENSOR_1_IS_AD595 #define TEMP_1_PIN 9 // Analog Input (connector *K2* on Tango thermocouple ADD ON is used) #else #define TEMP_1_PIN 14 // Analog Input (default connector for thermistor *T1* on rumba board is used) diff --git a/Marlin/src/pins/stm32g0/pins_BTT_SKRAT_V1_0.h b/Marlin/src/pins/stm32g0/pins_BTT_SKRAT_V1_0.h index 65bace9d50..47830d8477 100644 --- a/Marlin/src/pins/stm32g0/pins_BTT_SKRAT_V1_0.h +++ b/Marlin/src/pins/stm32g0/pins_BTT_SKRAT_V1_0.h @@ -182,10 +182,10 @@ #ifndef TEMP_BED_PIN #define TEMP_BED_PIN PB2 // TB #endif -#ifndef TEMP_SENSOR_PROBE +#ifndef TEMP_PROBE_PIN #define TEMP_PROBE_PIN PA1 // TH2 #endif -#ifndef TEMP_SENSOR_CHAMBER +#ifndef TEMP_CHAMBER_PIN #define TEMP_CHAMBER_PIN PA0 // TH3 #endif