🔧 Clean up TEMP_SENSOR conditionals, SKRat fix

This commit is contained in:
Scott Lahteine 2025-12-06 12:32:09 -06:00
parent ef2fbcd2b6
commit d14b8e4435
10 changed files with 66 additions and 72 deletions

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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