diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 94332c9268..775f6a04f0 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -132,17 +132,15 @@ #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 _SENSOR_IS(I,N) || (TEMP_SENSOR_##N == I) +#define _E_SENSOR_IS(I,N) _SENSOR_IS(N,I) +#define ANY_THERMISTOR_IS(N) (0 REPEAT2(HOTENDS, _E_SENSOR_IS, N) \ + _SENSOR_IS(N,BED) _SENSOR_IS(N,PROBE) _SENSOR_IS(N,CHAMBER) \ + _SENSOR_IS(N,COOLER) _SENSOR_IS(N,BOARD) _SENSOR_IS(N,REDUNDANT) ) + +#if ANY_THERMISTOR_IS(1000) #define HAS_USER_THERMISTORS 1 #endif -#undef ANY_TEMP_SENSOR_IS #if TEMP_SENSOR_REDUNDANT #define _HEATER_ID(M) HID_##M diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index cb3314b25f..abc38c0a5a 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2193,68 +2193,12 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #elif !PIN_EXISTS(TEMP_7) && !TEMP_SENSOR_7_IS_DUMMY #error "TEMP_7_PIN not defined for this board." #endif - #elif TEMP_SENSOR_7 != 0 - #error "TEMP_SENSOR_7 shouldn't be set with only 7 HOTENDS." - #endif - #elif TEMP_SENSOR_6 != 0 - #error "TEMP_SENSOR_6 shouldn't be set with only 6 HOTENDS." - #elif TEMP_SENSOR_7 != 0 - #error "TEMP_SENSOR_7 shouldn't be set with only 6 HOTENDS." - #endif - #elif TEMP_SENSOR_5 != 0 - #error "TEMP_SENSOR_5 shouldn't be set with only 5 HOTENDS." - #elif TEMP_SENSOR_6 != 0 - #error "TEMP_SENSOR_6 shouldn't be set with only 5 HOTENDS." - #elif TEMP_SENSOR_7 != 0 - #error "TEMP_SENSOR_7 shouldn't be set with only 5 HOTENDS." - #endif - #elif TEMP_SENSOR_4 != 0 - #error "TEMP_SENSOR_4 shouldn't be set with only 4 HOTENDS." - #elif TEMP_SENSOR_5 != 0 - #error "TEMP_SENSOR_5 shouldn't be set with only 4 HOTENDS." - #elif TEMP_SENSOR_6 != 0 - #error "TEMP_SENSOR_6 shouldn't be set with only 4 HOTENDS." - #elif TEMP_SENSOR_7 != 0 - #error "TEMP_SENSOR_7 shouldn't be set with only 4 HOTENDS." - #endif - #elif TEMP_SENSOR_3 != 0 - #error "TEMP_SENSOR_3 shouldn't be set with only 3 HOTENDS." - #elif TEMP_SENSOR_4 != 0 - #error "TEMP_SENSOR_4 shouldn't be set with only 3 HOTENDS." - #elif TEMP_SENSOR_5 != 0 - #error "TEMP_SENSOR_5 shouldn't be set with only 3 HOTENDS." - #elif TEMP_SENSOR_6 != 0 - #error "TEMP_SENSOR_6 shouldn't be set with only 3 HOTENDS." - #elif TEMP_SENSOR_7 != 0 - #error "TEMP_SENSOR_7 shouldn't be set with only 3 HOTENDS." - #endif - #elif TEMP_SENSOR_2 != 0 - #error "TEMP_SENSOR_2 shouldn't be set with only 2 HOTENDS." - #elif TEMP_SENSOR_3 != 0 - #error "TEMP_SENSOR_3 shouldn't be set with only 2 HOTENDS." - #elif TEMP_SENSOR_4 != 0 - #error "TEMP_SENSOR_4 shouldn't be set with only 2 HOTENDS." - #elif TEMP_SENSOR_5 != 0 - #error "TEMP_SENSOR_5 shouldn't be set with only 2 HOTENDS." - #elif TEMP_SENSOR_6 != 0 - #error "TEMP_SENSOR_6 shouldn't be set with only 2 HOTENDS." - #elif TEMP_SENSOR_7 != 0 - #error "TEMP_SENSOR_7 shouldn't be set with only 2 HOTENDS." - #endif -#elif TEMP_SENSOR_1 != 0 - #error "TEMP_SENSOR_1 shouldn't be set with only 1 HOTEND." -#elif TEMP_SENSOR_2 != 0 - #error "TEMP_SENSOR_2 shouldn't be set with only 1 HOTEND." -#elif TEMP_SENSOR_3 != 0 - #error "TEMP_SENSOR_3 shouldn't be set with only 1 HOTEND." -#elif TEMP_SENSOR_4 != 0 - #error "TEMP_SENSOR_4 shouldn't be set with only 1 HOTEND." -#elif TEMP_SENSOR_5 != 0 - #error "TEMP_SENSOR_5 shouldn't be set with only 1 HOTEND." -#elif TEMP_SENSOR_6 != 0 - #error "TEMP_SENSOR_6 shouldn't be set with only 1 HOTEND." -#elif TEMP_SENSOR_7 != 0 - #error "TEMP_SENSOR_7 shouldn't be set with only 1 HOTEND." + #endif // HOTENDS > 7 + #endif // HOTENDS > 6 + #endif // HOTENDS > 5 + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 #endif // HAS_MULTI_HOTEND /** @@ -3288,7 +3232,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #if HAS_MOTOR_CURRENT_I2C #if BOTH(DIGIPOT_MCP4018, DIGIPOT_MCP4451) #error "Enable only one of DIGIPOT_MCP4018 or DIGIPOT_MCP4451." -#elif !MB(MKS_SBASE, AZTEEG_X5_GT, AZTEEG_X5_MINI, AZTEEG_X5_MINI_WIFI) \ + #elif !MB(MKS_SBASE, AZTEEG_X5_GT, AZTEEG_X5_MINI, AZTEEG_X5_MINI_WIFI) \ && (!defined(DIGIPOTS_I2C_SDA_X) || !defined(DIGIPOTS_I2C_SDA_Y) || !defined(DIGIPOTS_I2C_SDA_Z) || !defined(DIGIPOTS_I2C_SDA_E0) || !defined(DIGIPOTS_I2C_SDA_E1)) #error "DIGIPOT_MCP4018/4451 requires DIGIPOTS_I2C_SDA_* pins to be defined." #endif diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index 4fdb7a84df..5e7aba3421 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -51,6 +51,9 @@ #if HAS_COOLER && DISABLED(THERMAL_PROTECTION_COOLER) #warning "Safety Alert! Enable THERMAL_PROTECTION_COOLER for the final build!" #endif +#if ANY_THERMISTOR_IS(998) || ANY_THERMISTOR_IS(999) + #warning "Warning! Don't use dummy thermistors (998/999) for final build!" +#endif #if NONE(HAS_RESUME_CONTINUE, HOST_PROMPT_SUPPORT) #warning "Your Configuration provides no method to acquire user feedback!" diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index d59ebe5695..0f6395b127 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -2207,22 +2207,22 @@ void Temperature::init() { // Thermistor activation by MCU pin #if PIN_EXISTS(TEMP_0_TR_ENABLE) - OUT_WRITE(TEMP_0_TR_ENABLE_PIN, + OUT_WRITE(TEMP_0_TR_ENABLE_PIN, ( #if TEMP_SENSOR_IS_ANY_MAX_TC(0) - 1 + HIGH #else - 0 + LOW #endif - ); + )); #endif #if PIN_EXISTS(TEMP_1_TR_ENABLE) - OUT_WRITE(TEMP_1_TR_ENABLE_PIN, + OUT_WRITE(TEMP_1_TR_ENABLE_PIN, ( #if TEMP_SENSOR_IS_ANY_MAX_TC(1) - 1 + HIGH #else - 0 + LOW #endif - ); + )); #endif #if HAS_HEATER_0 diff --git a/Marlin/src/module/thermistor/thermistors.h b/Marlin/src/module/thermistor/thermistors.h index 28a1e2f90f..85f4449636 100644 --- a/Marlin/src/module/thermistor/thermistors.h +++ b/Marlin/src/module/thermistor/thermistors.h @@ -42,18 +42,6 @@ #define OV_SCALE(N) (N) #define OV(N) int16_t(OV_SCALE(N) * (OVERSAMPLENR) * (THERMISTOR_TABLE_SCALE)) -#define TEMP_SENSOR_IS(n,H) (n == TEMP_SENSOR_##H) -#define ANY_THERMISTOR_IS(n) ( TEMP_SENSOR_IS(n, 0) || TEMP_SENSOR_IS(n, 1) \ - || TEMP_SENSOR_IS(n, 2) || TEMP_SENSOR_IS(n, 3) \ - || TEMP_SENSOR_IS(n, 4) || TEMP_SENSOR_IS(n, 5) \ - || TEMP_SENSOR_IS(n, 6) || TEMP_SENSOR_IS(n, 7) \ - || TEMP_SENSOR_IS(n, BED) \ - || 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; // Pt1000 and Pt100 handling