From 59eca253e1518f17e1ffe962ffc6e7bfa0db49a3 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 9 Nov 2020 01:17:37 -0600 Subject: [PATCH] Simplified temp sensor conditionals --- Marlin/src/inc/Conditionals_post.h | 100 ++++++++------- Marlin/src/inc/SanityCheck.h | 42 +++---- Marlin/src/module/temperature.cpp | 137 +++++++++++---------- Marlin/src/module/temperature.h | 25 ++-- Marlin/src/module/thermistor/thermistors.h | 44 +++---- 5 files changed, 170 insertions(+), 178 deletions(-) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index a8e619fb3..9eeb39f9a 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -436,7 +436,7 @@ #endif #if TEMP_SENSOR_0 == -5 || TEMP_SENSOR_0 == -3 || TEMP_SENSOR_0 == -2 - #define HEATER_0_USES_MAX6675 + #define HEATER_0_USES_MAX6675 1 #if TEMP_SENSOR_0 == -3 #define HEATER_0_MAX6675_TMIN -270 #define HEATER_0_MAX6675_TMAX 1800 @@ -445,19 +445,19 @@ #define HEATER_0_MAX6675_TMAX 1024 #endif #if TEMP_SENSOR_0 == -5 - #define MAX6675_IS_MAX31865 + #define MAX6675_IS_MAX31865 1 #elif TEMP_SENSOR_0 == -3 - #define MAX6675_IS_MAX31855 + #define MAX6675_IS_MAX31855 1 #endif #elif TEMP_SENSOR_0 == -4 - #define HEATER_0_USES_AD8495 + #define HEATER_0_USES_AD8495 1 #elif TEMP_SENSOR_0 == -1 - #define HEATER_0_USES_AD595 + #define HEATER_0_USES_AD595 1 #elif TEMP_SENSOR_0 > 0 #define THERMISTOR_HEATER_0 TEMP_SENSOR_0 - #define HEATER_0_USES_THERMISTOR + #define HEATER_0_USES_THERMISTOR 1 #if TEMP_SENSOR_0 == 1000 - #define HEATER_0_USER_THERMISTOR + #define HEATER_0_USER_THERMISTOR 1 #endif #else #undef HEATER_0_MINTEMP @@ -465,7 +465,7 @@ #endif #if TEMP_SENSOR_1 == -5 || TEMP_SENSOR_1 == -3 || TEMP_SENSOR_1 == -2 - #define HEATER_1_USES_MAX6675 + #define HEATER_1_USES_MAX6675 1 #if TEMP_SENSOR_1 == -3 #define HEATER_1_MAX6675_TMIN -270 #define HEATER_1_MAX6675_TMAX 1800 @@ -483,14 +483,14 @@ #endif #endif #elif TEMP_SENSOR_1 == -4 - #define HEATER_1_USES_AD8495 + #define HEATER_1_USES_AD8495 1 #elif TEMP_SENSOR_1 == -1 - #define HEATER_1_USES_AD595 + #define HEATER_1_USES_AD595 1 #elif TEMP_SENSOR_1 > 0 #define THERMISTOR_HEATER_1 TEMP_SENSOR_1 - #define HEATER_1_USES_THERMISTOR + #define HEATER_1_USES_THERMISTOR 1 #if TEMP_SENSOR_1 == 1000 - #define HEATER_1_USER_THERMISTOR + #define HEATER_1_USER_THERMISTOR 1 #endif #else #undef HEATER_1_MINTEMP @@ -498,18 +498,18 @@ #endif #if TEMP_SENSOR_2 == -4 - #define HEATER_2_USES_AD8495 + #define HEATER_2_USES_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 HEATER_2_USES_AD595 + #define HEATER_2_USES_AD595 1 #elif TEMP_SENSOR_2 > 0 #define THERMISTOR_HEATER_2 TEMP_SENSOR_2 - #define HEATER_2_USES_THERMISTOR + #define HEATER_2_USES_THERMISTOR 1 #if TEMP_SENSOR_2 == 1000 - #define HEATER_2_USER_THERMISTOR + #define HEATER_2_USER_THERMISTOR 1 #endif #else #undef HEATER_2_MINTEMP @@ -517,18 +517,18 @@ #endif #if TEMP_SENSOR_3 == -4 - #define HEATER_3_USES_AD8495 + #define HEATER_3_USES_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 HEATER_3_USES_AD595 + #define HEATER_3_USES_AD595 1 #elif TEMP_SENSOR_3 > 0 #define THERMISTOR_HEATER_3 TEMP_SENSOR_3 - #define HEATER_3_USES_THERMISTOR + #define HEATER_3_USES_THERMISTOR 1 #if TEMP_SENSOR_3 == 1000 - #define HEATER_3_USER_THERMISTOR + #define HEATER_3_USER_THERMISTOR 1 #endif #else #undef HEATER_3_MINTEMP @@ -536,18 +536,18 @@ #endif #if TEMP_SENSOR_4 == -4 - #define HEATER_4_USES_AD8495 + #define HEATER_4_USES_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 HEATER_4_USES_AD595 + #define HEATER_4_USES_AD595 1 #elif TEMP_SENSOR_4 > 0 #define THERMISTOR_HEATER_4 TEMP_SENSOR_4 - #define HEATER_4_USES_THERMISTOR + #define HEATER_4_USES_THERMISTOR 1 #if TEMP_SENSOR_4 == 1000 - #define HEATER_4_USER_THERMISTOR + #define HEATER_4_USER_THERMISTOR 1 #endif #else #undef HEATER_4_MINTEMP @@ -555,18 +555,18 @@ #endif #if TEMP_SENSOR_5 == -4 - #define HEATER_5_USES_AD8495 + #define HEATER_5_USES_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 HEATER_5_USES_AD595 + #define HEATER_5_USES_AD595 1 #elif TEMP_SENSOR_5 > 0 #define THERMISTOR_HEATER_5 TEMP_SENSOR_5 - #define HEATER_5_USES_THERMISTOR + #define HEATER_5_USES_THERMISTOR 1 #if TEMP_SENSOR_5 == 1000 - #define HEATER_5_USER_THERMISTOR + #define HEATER_5_USER_THERMISTOR 1 #endif #else #undef HEATER_5_MINTEMP @@ -574,18 +574,18 @@ #endif #if TEMP_SENSOR_6 == -4 - #define HEATER_6_USES_AD8495 + #define HEATER_6_USES_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 HEATER_6_USES_AD595 + #define HEATER_6_USES_AD595 1 #elif TEMP_SENSOR_6 > 0 #define THERMISTOR_HEATER_6 TEMP_SENSOR_6 - #define HEATER_6_USES_THERMISTOR + #define HEATER_6_USES_THERMISTOR 1 #if TEMP_SENSOR_6 == 1000 - #define HEATER_6_USER_THERMISTOR + #define HEATER_6_USER_THERMISTOR 1 #endif #else #undef HEATER_6_MINTEMP @@ -593,18 +593,18 @@ #endif #if TEMP_SENSOR_7 == -4 - #define HEATER_7_USES_AD8495 + #define HEATER_7_USES_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 HEATER_7_USES_AD595 + #define HEATER_7_USES_AD595 1 #elif TEMP_SENSOR_7 > 0 #define THERMISTOR_HEATER_7 TEMP_SENSOR_7 - #define HEATER_7_USES_THERMISTOR + #define HEATER_7_USES_THERMISTOR 1 #if TEMP_SENSOR_7 == 1000 - #define HEATER_7_USER_THERMISTOR + #define HEATER_7_USER_THERMISTOR 1 #endif #else #undef HEATER_7_MINTEMP @@ -612,18 +612,18 @@ #endif #if TEMP_SENSOR_BED == -4 - #define HEATER_BED_USES_AD8495 + #define HEATER_BED_USES_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 HEATER_BED_USES_AD595 + #define HEATER_BED_USES_AD595 1 #elif TEMP_SENSOR_BED > 0 #define THERMISTORBED TEMP_SENSOR_BED - #define HEATER_BED_USES_THERMISTOR + #define HEATER_BED_USES_THERMISTOR 1 #if TEMP_SENSOR_BED == 1000 - #define HEATER_BED_USER_THERMISTOR + #define HEATER_BED_USER_THERMISTOR 1 #endif #else #undef BED_MINTEMP @@ -631,18 +631,18 @@ #endif #if TEMP_SENSOR_CHAMBER == -4 - #define HEATER_CHAMBER_USES_AD8495 + #define HEATER_CHAMBER_USES_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 HEATER_CHAMBER_USES_AD595 + #define HEATER_CHAMBER_USES_AD595 1 #elif TEMP_SENSOR_CHAMBER > 0 #define THERMISTORCHAMBER TEMP_SENSOR_CHAMBER - #define HEATER_CHAMBER_USES_THERMISTOR + #define HEATER_CHAMBER_USES_THERMISTOR 1 #if TEMP_SENSOR_CHAMBER == 1000 - #define HEATER_CHAMBER_USER_THERMISTOR + #define HEATER_CHAMBER_USER_THERMISTOR 1 #endif #else #undef CHAMBER_MINTEMP @@ -650,25 +650,21 @@ #endif #if TEMP_SENSOR_PROBE == -4 - #define HEATER_PROBE_USES_AD8495 + #define HEATER_PROBE_USES_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 HEATER_PROBE_USES_AD595 + #define HEATER_PROBE_USES_AD595 1 #elif TEMP_SENSOR_PROBE > 0 #define THERMISTORPROBE TEMP_SENSOR_PROBE - #define PROBE_USES_THERMISTOR + #define HEATER_PROBE_USES_THERMISTOR 1 #if TEMP_SENSOR_PROBE == 1000 - #define PROBE_USER_THERMISTOR + #define HEATER_PROBE_USER_THERMISTOR 1 #endif #endif -#define HOTEND_USES_THERMISTOR ANY( \ - HEATER_0_USES_THERMISTOR, HEATER_1_USES_THERMISTOR, HEATER_2_USES_THERMISTOR, HEATER_3_USES_THERMISTOR, \ - HEATER_4_USES_THERMISTOR, HEATER_5_USES_THERMISTOR, HEATER_6_USES_THERMISTOR, HEATER_7_USES_THERMISTOR ) - /** * X_DUAL_ENDSTOPS endstop reassignment */ diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 108294719..3762d40c5 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1618,34 +1618,41 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal /** * Required custom thermistor settings */ -#if ENABLED(HEATER_0_USER_THERMISTOR) && !(defined(HOTEND0_PULLUP_RESISTOR_OHMS) && defined(HOTEND0_RESISTANCE_25C_OHMS) && defined(HOTEND0_BETA)) +#if HEATER_0_USER_THERMISTOR && !(defined(HOTEND0_PULLUP_RESISTOR_OHMS) && defined(HOTEND0_RESISTANCE_25C_OHMS) && defined(HOTEND0_BETA)) #error "TEMP_SENSOR_0 1000 requires HOTEND0_PULLUP_RESISTOR_OHMS, HOTEND0_RESISTANCE_25C_OHMS and HOTEND0_BETA in Configuration_adv.h." -#elif ENABLED(HEATER_1_USER_THERMISTOR) && !(defined(HOTEND1_PULLUP_RESISTOR_OHMS) && defined(HOTEND1_RESISTANCE_25C_OHMS) && defined(HOTEND1_BETA)) +#elif HEATER_1_USER_THERMISTOR && !(defined(HOTEND1_PULLUP_RESISTOR_OHMS) && defined(HOTEND1_RESISTANCE_25C_OHMS) && defined(HOTEND1_BETA)) #error "TEMP_SENSOR_1 1000 requires HOTEND1_PULLUP_RESISTOR_OHMS, HOTEND1_RESISTANCE_25C_OHMS and HOTEND1_BETA in Configuration_adv.h." -#elif ENABLED(HEATER_2_USER_THERMISTOR) && !(defined(HOTEND2_PULLUP_RESISTOR_OHMS) && defined(HOTEND2_RESISTANCE_25C_OHMS) && defined(HOTEND2_BETA)) +#elif HEATER_2_USER_THERMISTOR && !(defined(HOTEND2_PULLUP_RESISTOR_OHMS) && defined(HOTEND2_RESISTANCE_25C_OHMS) && defined(HOTEND2_BETA)) #error "TEMP_SENSOR_2 1000 requires HOTEND2_PULLUP_RESISTOR_OHMS, HOTEND2_RESISTANCE_25C_OHMS and HOTEND2_BETA in Configuration_adv.h." -#elif ENABLED(HEATER_3_USER_THERMISTOR) && !(defined(HOTEND3_PULLUP_RESISTOR_OHMS) && defined(HOTEND3_RESISTANCE_25C_OHMS) && defined(HOTEND3_BETA)) +#elif HEATER_3_USER_THERMISTOR && !(defined(HOTEND3_PULLUP_RESISTOR_OHMS) && defined(HOTEND3_RESISTANCE_25C_OHMS) && defined(HOTEND3_BETA)) #error "TEMP_SENSOR_3 1000 requires HOTEND3_PULLUP_RESISTOR_OHMS, HOTEND3_RESISTANCE_25C_OHMS and HOTEND3_BETA in Configuration_adv.h." -#elif ENABLED(HEATER_4_USER_THERMISTOR) && !(defined(HOTEND4_PULLUP_RESISTOR_OHMS) && defined(HOTEND4_RESISTANCE_25C_OHMS) && defined(HOTEND4_BETA)) +#elif HEATER_4_USER_THERMISTOR && !(defined(HOTEND4_PULLUP_RESISTOR_OHMS) && defined(HOTEND4_RESISTANCE_25C_OHMS) && defined(HOTEND4_BETA)) #error "TEMP_SENSOR_4 1000 requires HOTEND4_PULLUP_RESISTOR_OHMS, HOTEND4_RESISTANCE_25C_OHMS and HOTEND4_BETA in Configuration_adv.h." -#elif ENABLED(HEATER_5_USER_THERMISTOR) && !(defined(HOTEND5_PULLUP_RESISTOR_OHMS) && defined(HOTEND5_RESISTANCE_25C_OHMS) && defined(HOTEND5_BETA)) +#elif HEATER_5_USER_THERMISTOR && !(defined(HOTEND5_PULLUP_RESISTOR_OHMS) && defined(HOTEND5_RESISTANCE_25C_OHMS) && defined(HOTEND5_BETA)) #error "TEMP_SENSOR_5 1000 requires HOTEND5_PULLUP_RESISTOR_OHMS, HOTEND5_RESISTANCE_25C_OHMS and HOTEND5_BETA in Configuration_adv.h." -#elif ENABLED(HEATER_6_USER_THERMISTOR) && !(defined(HOTEND6_PULLUP_RESISTOR_OHMS) && defined(HOTEND6_RESISTANCE_25C_OHMS) && defined(HOTEND6_BETA)) +#elif HEATER_6_USER_THERMISTOR && !(defined(HOTEND6_PULLUP_RESISTOR_OHMS) && defined(HOTEND6_RESISTANCE_25C_OHMS) && defined(HOTEND6_BETA)) #error "TEMP_SENSOR_6 1000 requires HOTEND6_PULLUP_RESISTOR_OHMS, HOTEND6_RESISTANCE_25C_OHMS and HOTEND6_BETA in Configuration_adv.h." -#elif ENABLED(HEATER_7_USER_THERMISTOR) && !(defined(HOTEND7_PULLUP_RESISTOR_OHMS) && defined(HOTEND7_RESISTANCE_25C_OHMS) && defined(HOTEND7_BETA)) +#elif HEATER_7_USER_THERMISTOR && !(defined(HOTEND7_PULLUP_RESISTOR_OHMS) && defined(HOTEND7_RESISTANCE_25C_OHMS) && defined(HOTEND7_BETA)) #error "TEMP_SENSOR_7 1000 requires HOTEND7_PULLUP_RESISTOR_OHMS, HOTEND7_RESISTANCE_25C_OHMS and HOTEND7_BETA in Configuration_adv.h." -#elif ENABLED(HEATER_BED_USER_THERMISTOR) && !(defined(BED_PULLUP_RESISTOR_OHMS) && defined(BED_RESISTANCE_25C_OHMS) && defined(BED_BETA)) +#elif HEATER_BED_USER_THERMISTOR && !(defined(BED_PULLUP_RESISTOR_OHMS) && defined(BED_RESISTANCE_25C_OHMS) && defined(BED_BETA)) #error "TEMP_SENSOR_BED 1000 requires BED_PULLUP_RESISTOR_OHMS, BED_RESISTANCE_25C_OHMS and BED_BETA in Configuration_adv.h." -#elif ENABLED(HEATER_CHAMBER_USER_THERMISTOR) && !(defined(CHAMBER_PULLUP_RESISTOR_OHMS) && defined(CHAMBER_RESISTANCE_25C_OHMS) && defined(CHAMBER_BETA)) +#elif HEATER_CHAMBER_USER_THERMISTOR && !(defined(CHAMBER_PULLUP_RESISTOR_OHMS) && defined(CHAMBER_RESISTANCE_25C_OHMS) && defined(CHAMBER_BETA)) #error "TEMP_SENSOR_CHAMBER 1000 requires CHAMBER_PULLUP_RESISTOR_OHMS, CHAMBER_RESISTANCE_25C_OHMS and CHAMBER_BETA in Configuration_adv.h." #endif /** - * A Sensor ID has to be set for each heater + * Pins and Sensor IDs must be set for each heater */ +#if HEATER_0_USES_MAX6675 && !PIN_EXISTS(MAX6675_SS) + #error "MAX6675_SS_PIN (required for TEMP_SENSOR_0) not defined for this board." +#elif HAS_HOTEND && !HAS_TEMP_HOTEND + #error "TEMP_0_PIN (required for TEMP_SENSOR_0) not defined for this board." +#elif EITHER(HAS_MULTI_HOTEND, HEATERS_PARALLEL) && !HAS_HEATER_1 + #error "HEATER_1_PIN is not defined. TEMP_SENSOR_1 might not be set, or the board (not EEB / EEF?) doesn't define a pin." +#endif #if HAS_MULTI_HOTEND - #if ENABLED(HEATER_1_USES_MAX6675) && !PIN_EXISTS(MAX6675_SS2) + #if HEATER_1_USES_MAX6675 && !PIN_EXISTS(MAX6675_SS2) #error "MAX6675_SS2_PIN (required for TEMP_SENSOR_1) not defined for this board." #elif TEMP_SENSOR_1 == 0 #error "TEMP_SENSOR_1 is required with 2 or more HOTENDS." @@ -1808,7 +1815,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal #error "TEMP_SENSOR_1 is required with TEMP_SENSOR_1_AS_REDUNDANT." #endif -#if ENABLED(MAX6675_IS_MAX31865) && (!defined(MAX31865_SENSOR_OHMS) || !defined(MAX31865_CALIBRATION_OHMS)) +#if MAX6675_IS_MAX31865 && !(defined(MAX31865_SENSOR_OHMS) && defined(MAX31865_CALIBRATION_OHMS)) #error "MAX31865_SENSOR_OHMS and MAX31865_CALIBRATION_OHMS must be set in Configuration.h when using a MAX31865 temperature sensor." #endif @@ -1827,15 +1834,6 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal #error "TEMP_SENSOR_0 is required if there are any extruders." #endif -// Pins are required for heaters -#if ENABLED(HEATER_0_USES_MAX6675) && !PIN_EXISTS(MAX6675_SS) - #error "MAX6675_SS_PIN (required for TEMP_SENSOR_0) not defined for this board." -#elif HAS_HOTEND && !HAS_TEMP_HOTEND - #error "TEMP_0_PIN (required for TEMP_SENSOR_0) not defined for this board." -#elif EITHER(HAS_MULTI_HOTEND, HEATERS_PARALLEL) && !HAS_HEATER_1 - #error "HEATER_1_PIN is not defined. TEMP_SENSOR_1 might not be set, or the board (not EEB / EEF?) doesn't define a pin." -#endif - /** * Temperature status LEDs */ diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 4eb721651..b476b3559 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -44,7 +44,7 @@ #include "../lcd/extui/ui_api.h" #endif -#if ENABLED(MAX6675_IS_MAX31865) +#if MAX6675_IS_MAX31865 #include #ifndef MAX31865_CS_PIN #define MAX31865_CS_PIN MAX6675_SS_PIN // HW:49 SW:65 for example @@ -114,7 +114,13 @@ #if HAS_SERVOS #include "./servo.h" #endif -#if HOTEND_USES_THERMISTOR + +#if ANY(HEATER_0_USES_THERMISTOR, HEATER_1_USES_THERMISTOR, HEATER_2_USES_THERMISTOR, HEATER_3_USES_THERMISTOR, \ + HEATER_4_USES_THERMISTOR, HEATER_5_USES_THERMISTOR, HEATER_6_USES_THERMISTOR, HEATER_7_USES_THERMISTOR ) + #define HAS_HOTEND_THERMISTOR 1 +#endif + +#if HAS_HOTEND_THERMISTOR #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) static const temp_entry_t* heater_ttbl_map[2] = { HEATER_0_TEMPTABLE, HEATER_1_TEMPTABLE }; static constexpr uint8_t heater_ttbllen_map[2] = { HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN }; @@ -1046,11 +1052,11 @@ void Temperature::manage_heater() { updateTemperaturesFromRawValues(); // also resets the watchdog #if DISABLED(IGNORE_THERMOCOUPLE_ERRORS) - #if ENABLED(HEATER_0_USES_MAX6675) + #if HEATER_0_USES_MAX6675 if (temp_hotend[0].celsius > _MIN(HEATER_0_MAXTEMP, HEATER_0_MAX6675_TMAX - 1.0)) max_temp_error(H_E0); if (temp_hotend[0].celsius < _MAX(HEATER_0_MINTEMP, HEATER_0_MAX6675_TMIN + .01)) min_temp_error(H_E0); #endif - #if ENABLED(HEATER_1_USES_MAX6675) + #if HEATER_1_USES_MAX6675 if (temp_hotend[1].celsius > _MIN(HEATER_1_MAXTEMP, HEATER_1_MAX6675_TMAX - 1.0)) max_temp_error(H_E1); if (temp_hotend[1].celsius < _MAX(HEATER_1_MINTEMP, HEATER_1_MAX6675_TMIN + .01)) min_temp_error(H_E1); #endif @@ -1336,34 +1342,34 @@ void Temperature::manage_heater() { void Temperature::reset_user_thermistors() { user_thermistor_t user_thermistor[USER_THERMISTORS] = { - #if ENABLED(HEATER_0_USER_THERMISTOR) + #if HEATER_0_USER_THERMISTOR { true, 0, 0, HOTEND0_PULLUP_RESISTOR_OHMS, HOTEND0_RESISTANCE_25C_OHMS, 0, 0, HOTEND0_BETA, 0 }, #endif - #if ENABLED(HEATER_1_USER_THERMISTOR) + #if HEATER_1_USER_THERMISTOR { true, 0, 0, HOTEND1_PULLUP_RESISTOR_OHMS, HOTEND1_RESISTANCE_25C_OHMS, 0, 0, HOTEND1_BETA, 0 }, #endif - #if ENABLED(HEATER_2_USER_THERMISTOR) + #if HEATER_2_USER_THERMISTOR { true, 0, 0, HOTEND2_PULLUP_RESISTOR_OHMS, HOTEND2_RESISTANCE_25C_OHMS, 0, 0, HOTEND2_BETA, 0 }, #endif - #if ENABLED(HEATER_3_USER_THERMISTOR) + #if HEATER_3_USER_THERMISTOR { true, 0, 0, HOTEND3_PULLUP_RESISTOR_OHMS, HOTEND3_RESISTANCE_25C_OHMS, 0, 0, HOTEND3_BETA, 0 }, #endif - #if ENABLED(HEATER_4_USER_THERMISTOR) + #if HEATER_4_USER_THERMISTOR { true, 0, 0, HOTEND4_PULLUP_RESISTOR_OHMS, HOTEND4_RESISTANCE_25C_OHMS, 0, 0, HOTEND4_BETA, 0 }, #endif - #if ENABLED(HEATER_5_USER_THERMISTOR) + #if HEATER_5_USER_THERMISTOR { true, 0, 0, HOTEND5_PULLUP_RESISTOR_OHMS, HOTEND5_RESISTANCE_25C_OHMS, 0, 0, HOTEND5_BETA, 0 }, #endif - #if ENABLED(HEATER_6_USER_THERMISTOR) + #if HEATER_6_USER_THERMISTOR { true, 0, 0, HOTEND6_PULLUP_RESISTOR_OHMS, HOTEND6_RESISTANCE_25C_OHMS, 0, 0, HOTEND6_BETA, 0 }, #endif - #if ENABLED(HEATER_7_USER_THERMISTOR) + #if HEATER_7_USER_THERMISTOR { true, 0, 0, HOTEND7_PULLUP_RESISTOR_OHMS, HOTEND7_RESISTANCE_25C_OHMS, 0, 0, HOTEND7_BETA, 0 }, #endif - #if ENABLED(HEATER_BED_USER_THERMISTOR) + #if HEATER_BED_USER_THERMISTOR { true, 0, 0, BED_PULLUP_RESISTOR_OHMS, BED_RESISTANCE_25C_OHMS, 0, 0, BED_BETA, 0 }, #endif - #if ENABLED(HEATER_CHAMBER_USER_THERMISTOR) + #if HEATER_CHAMBER_USER_THERMISTOR { true, 0, 0, CHAMBER_PULLUP_RESISTOR_OHMS, CHAMBER_RESISTANCE_25C_OHMS, 0, 0, CHAMBER_BETA, 0 } #endif }; @@ -1462,91 +1468,91 @@ void Temperature::manage_heater() { switch (e) { case 0: - #if ENABLED(HEATER_0_USER_THERMISTOR) + #if HEATER_0_USER_THERMISTOR return user_thermistor_to_deg_c(CTI_HOTEND_0, raw); - #elif ENABLED(HEATER_0_USES_MAX6675) + #elif HEATER_0_USES_MAX6675 return ( - #if ENABLED(MAX6675_IS_MAX31865) + #if MAX6675_IS_MAX31865 max31865.temperature(MAX31865_SENSOR_OHMS, MAX31865_CALIBRATION_OHMS) #else raw * 0.25 #endif ); - #elif ENABLED(HEATER_0_USES_AD595) + #elif HEATER_0_USES_AD595 return TEMP_AD595(raw); - #elif ENABLED(HEATER_0_USES_AD8495) + #elif HEATER_0_USES_AD8495 return TEMP_AD8495(raw); #else break; #endif case 1: - #if ENABLED(HEATER_1_USER_THERMISTOR) + #if HEATER_1_USER_THERMISTOR return user_thermistor_to_deg_c(CTI_HOTEND_1, raw); - #elif ENABLED(HEATER_1_USES_MAX6675) + #elif HEATER_1_USES_MAX6675 return raw * 0.25; - #elif ENABLED(HEATER_1_USES_AD595) + #elif HEATER_1_USES_AD595 return TEMP_AD595(raw); - #elif ENABLED(HEATER_1_USES_AD8495) + #elif HEATER_1_USES_AD8495 return TEMP_AD8495(raw); #else break; #endif case 2: - #if ENABLED(HEATER_2_USER_THERMISTOR) + #if HEATER_2_USER_THERMISTOR return user_thermistor_to_deg_c(CTI_HOTEND_2, raw); - #elif ENABLED(HEATER_2_USES_AD595) + #elif HEATER_2_USES_AD595 return TEMP_AD595(raw); - #elif ENABLED(HEATER_2_USES_AD8495) + #elif HEATER_2_USES_AD8495 return TEMP_AD8495(raw); #else break; #endif case 3: - #if ENABLED(HEATER_3_USER_THERMISTOR) + #if HEATER_3_USER_THERMISTOR return user_thermistor_to_deg_c(CTI_HOTEND_3, raw); - #elif ENABLED(HEATER_3_USES_AD595) + #elif HEATER_3_USES_AD595 return TEMP_AD595(raw); - #elif ENABLED(HEATER_3_USES_AD8495) + #elif HEATER_3_USES_AD8495 return TEMP_AD8495(raw); #else break; #endif case 4: - #if ENABLED(HEATER_4_USER_THERMISTOR) + #if HEATER_4_USER_THERMISTOR return user_thermistor_to_deg_c(CTI_HOTEND_4, raw); - #elif ENABLED(HEATER_4_USES_AD595) + #elif HEATER_4_USES_AD595 return TEMP_AD595(raw); - #elif ENABLED(HEATER_4_USES_AD8495) + #elif HEATER_4_USES_AD8495 return TEMP_AD8495(raw); #else break; #endif case 5: - #if ENABLED(HEATER_5_USER_THERMISTOR) + #if HEATER_5_USER_THERMISTOR return user_thermistor_to_deg_c(CTI_HOTEND_5, raw); - #elif ENABLED(HEATER_5_USES_AD595) + #elif HEATER_5_USES_AD595 return TEMP_AD595(raw); - #elif ENABLED(HEATER_5_USES_AD8495) + #elif HEATER_5_USES_AD8495 return TEMP_AD8495(raw); #else break; #endif case 6: - #if ENABLED(HEATER_6_USER_THERMISTOR) + #if HEATER_6_USER_THERMISTOR return user_thermistor_to_deg_c(CTI_HOTEND_6, raw); - #elif ENABLED(HEATER_6_USES_AD595) + #elif HEATER_6_USES_AD595 return TEMP_AD595(raw); - #elif ENABLED(HEATER_6_USES_AD8495) + #elif HEATER_6_USES_AD8495 return TEMP_AD8495(raw); #else break; #endif case 7: - #if ENABLED(HEATER_7_USER_THERMISTOR) + #if HEATER_7_USER_THERMISTOR return user_thermistor_to_deg_c(CTI_HOTEND_7, raw); - #elif ENABLED(HEATER_7_USES_AD595) + #elif HEATER_7_USES_AD595 return TEMP_AD595(raw); - #elif ENABLED(HEATER_7_USES_AD8495) + #elif HEATER_7_USES_AD8495 return TEMP_AD8495(raw); #else break; @@ -1554,7 +1560,7 @@ void Temperature::manage_heater() { default: break; } - #if HOTEND_USES_THERMISTOR + #if HAS_HOTEND_THERMISTOR // Thermistor with conversion table? const temp_entry_t(*tt)[] = (temp_entry_t(*)[])(heater_ttbl_map[e]); SCAN_THERMISTOR_TABLE((*tt), heater_ttbllen_map[e]); @@ -1568,13 +1574,13 @@ void Temperature::manage_heater() { // Derived from RepRap FiveD extruder::getTemperature() // For bed temperature measurement. float Temperature::analog_to_celsius_bed(const int raw) { - #if ENABLED(HEATER_BED_USER_THERMISTOR) + #if HEATER_BED_USER_THERMISTOR return user_thermistor_to_deg_c(CTI_BED, raw); - #elif ENABLED(HEATER_BED_USES_THERMISTOR) + #elif HEATER_BED_USES_THERMISTOR SCAN_THERMISTOR_TABLE(BED_TEMPTABLE, BED_TEMPTABLE_LEN); - #elif ENABLED(HEATER_BED_USES_AD595) + #elif HEATER_BED_USES_AD595 return TEMP_AD595(raw); - #elif ENABLED(HEATER_BED_USES_AD8495) + #elif HEATER_BED_USES_AD8495 return TEMP_AD8495(raw); #else UNUSED(raw); @@ -1587,13 +1593,13 @@ void Temperature::manage_heater() { // Derived from RepRap FiveD extruder::getTemperature() // For chamber temperature measurement. float Temperature::analog_to_celsius_chamber(const int raw) { - #if ENABLED(HEATER_CHAMBER_USER_THERMISTOR) + #if HEATER_CHAMBER_USER_THERMISTOR return user_thermistor_to_deg_c(CTI_CHAMBER, raw); - #elif ENABLED(HEATER_CHAMBER_USES_THERMISTOR) + #elif HEATER_CHAMBER_USES_THERMISTOR SCAN_THERMISTOR_TABLE(CHAMBER_TEMPTABLE, CHAMBER_TEMPTABLE_LEN); - #elif ENABLED(HEATER_CHAMBER_USES_AD595) + #elif HEATER_CHAMBER_USES_AD595 return TEMP_AD595(raw); - #elif ENABLED(HEATER_CHAMBER_USES_AD8495) + #elif HEATER_CHAMBER_USES_AD8495 return TEMP_AD8495(raw); #else UNUSED(raw); @@ -1606,13 +1612,13 @@ void Temperature::manage_heater() { // Derived from RepRap FiveD extruder::getTemperature() // For probe temperature measurement. float Temperature::analog_to_celsius_probe(const int raw) { - #if ENABLED(PROBE_USER_THERMISTOR) + #if HEATER_PROBE_USER_THERMISTOR return user_thermistor_to_deg_c(CTI_PROBE, raw); - #elif ENABLED(PROBE_USES_THERMISTOR) + #elif HEATER_PROBE_USES_THERMISTOR SCAN_THERMISTOR_TABLE(PROBE_TEMPTABLE, PROBE_TEMPTABLE_LEN); - #elif ENABLED(PROBE_USES_AD595) + #elif HEATER_PROBE_USES_AD595 return TEMP_AD595(raw); - #elif ENABLED(PROBE_USES_AD8495) + #elif HEATER_PROBE_USES_AD8495 return TEMP_AD8495(raw); #else UNUSED(raw); @@ -1628,16 +1634,11 @@ void Temperature::manage_heater() { * as it would block the stepper routine. */ void Temperature::updateTemperaturesFromRawValues() { - #if ENABLED(HEATER_0_USES_MAX6675) - temp_hotend[0].raw = READ_MAX6675(0); - #endif - #if ENABLED(HEATER_1_USES_MAX6675) - temp_hotend[1].raw = READ_MAX6675(1); - #endif + TERN_(HEATER_0_USES_MAX6675, temp_hotend[0].raw = READ_MAX6675(0)); + TERN_(HEATER_1_USES_MAX6675, temp_hotend[1].raw = READ_MAX6675(1)); #if HAS_HOTEND HOTEND_LOOP() temp_hotend[e].celsius = analog_to_celsius_hotend(temp_hotend[e].raw, e); #endif - TERN_(HAS_HEATED_BED, temp_bed.celsius = analog_to_celsius_bed(temp_bed.raw)); TERN_(HAS_TEMP_CHAMBER, temp_chamber.celsius = analog_to_celsius_chamber(temp_chamber.raw)); TERN_(HAS_TEMP_PROBE, temp_probe.celsius = analog_to_celsius_probe(temp_probe.raw)); @@ -1700,7 +1701,7 @@ void Temperature::init() { #if MB(RUMBA) // Disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector - #define _AD(N) ANY(HEATER_##N##_USES_AD595, HEATER_##N##_USES_AD8495) + #define _AD(N) (HEATER_##N##_USES_AD595 || HEATER_##N##_USES_AD8495) #if _AD(0) || _AD(1) || _AD(2) || _AD(BED) || _AD(CHAMBER) MCUCR = _BV(JTD); MCUCR = _BV(JTD); @@ -1802,7 +1803,7 @@ void Temperature::init() { #endif - #if ENABLED(HEATER_1_USES_MAX6675) + #if HEATER_1_USES_MAX6675 OUT_WRITE(MAX6675_SS2_PIN, HIGH); #endif @@ -2215,7 +2216,7 @@ void Temperature::disable_all_heaters() { #define MAX6675_HEAT_INTERVAL 250UL - #if ENABLED(MAX6675_IS_MAX31855) + #if MAX6675_IS_MAX31855 static uint32_t max6675_temp = 2000; #define MAX6675_ERROR_MASK 7 #define MAX6675_DISCARD_BITS 18 @@ -2241,7 +2242,7 @@ void Temperature::disable_all_heaters() { next_max6675_ms[hindex] = ms + MAX6675_HEAT_INTERVAL; - #if ENABLED(MAX6675_IS_MAX31865) + #if MAX6675_IS_MAX31865 max6675_temp = int(max31865.temperature(MAX31865_SENSOR_OHMS, MAX31865_CALIBRATION_OHMS)); #endif @@ -2256,7 +2257,7 @@ void Temperature::disable_all_heaters() { #if COUNT_6675 > 1 #define WRITE_MAX6675(V) do{ switch (hindex) { case 1: WRITE(MAX6675_SS2_PIN, V); break; default: WRITE(MAX6675_SS_PIN, V); } }while(0) #define SET_OUTPUT_MAX6675() do{ switch (hindex) { case 1: SET_OUTPUT(MAX6675_SS2_PIN); break; default: SET_OUTPUT(MAX6675_SS_PIN); } }while(0) - #elif ENABLED(HEATER_1_USES_MAX6675) + #elif HEATER_1_USES_MAX6675 #define WRITE_MAX6675(V) WRITE(MAX6675_SS2_PIN, V) #define SET_OUTPUT_MAX6675() SET_OUTPUT(MAX6675_SS2_PIN) #else @@ -2336,14 +2337,14 @@ void Temperature::disable_all_heaters() { */ void Temperature::update_raw_temperatures() { - #if HAS_TEMP_ADC_0 && DISABLED(HEATER_0_USES_MAX6675) + #if HAS_TEMP_ADC_0 && !HEATER_0_USES_MAX6675 temp_hotend[0].update(); #endif #if HAS_TEMP_ADC_1 #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) redundant_temperature_raw = temp_hotend[1].acc; - #elif DISABLED(HEATER_1_USES_MAX6675) + #elif !HEATER_1_USES_MAX6675 temp_hotend[1].update(); #endif #endif diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index c3c3ce2d8..4090b845d 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -253,31 +253,31 @@ typedef struct { int16_t raw_min, raw_max, mintemp, maxtemp; } temp_range_t; #if HAS_USER_THERMISTORS enum CustomThermistorIndex : uint8_t { - #if ENABLED(HEATER_0_USER_THERMISTOR) + #if HEATER_0_USER_THERMISTOR CTI_HOTEND_0, #endif - #if ENABLED(HEATER_1_USER_THERMISTOR) + #if HEATER_1_USER_THERMISTOR CTI_HOTEND_1, #endif - #if ENABLED(HEATER_2_USER_THERMISTOR) + #if HEATER_2_USER_THERMISTOR CTI_HOTEND_2, #endif - #if ENABLED(HEATER_3_USER_THERMISTOR) + #if HEATER_3_USER_THERMISTOR CTI_HOTEND_3, #endif - #if ENABLED(HEATER_4_USER_THERMISTOR) + #if HEATER_4_USER_THERMISTOR CTI_HOTEND_4, #endif - #if ENABLED(HEATER_5_USER_THERMISTOR) + #if HEATER_5_USER_THERMISTOR CTI_HOTEND_5, #endif - #if ENABLED(HEATER_BED_USER_THERMISTOR) + #if HEATER_BED_USER_THERMISTOR CTI_BED, #endif - #if ENABLED(HEATER_PROBE_USER_THERMISTOR) + #if HEATER_PROBE_USER_THERMISTOR CTI_PROBE, #endif - #if ENABLED(HEATER_CHAMBER_USER_THERMISTOR) + #if HEATER_CHAMBER_USER_THERMISTOR CTI_CHAMBER, #endif USER_THERMISTORS @@ -811,15 +811,12 @@ class Temperature { #if HAS_MAX6675 #define COUNT_6675 1 + BOTH(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675) #if COUNT_6675 > 1 + #define HAS_MULTI_6675 #define READ_MAX6675(N) read_max6675(N) #else #define READ_MAX6675(N) read_max6675() #endif - static int read_max6675( - #if COUNT_6675 > 1 - const uint8_t hindex=0 - #endif - ); + static int read_max6675(TERN_(HAS_MULTI_6675, const uint8_t hindex=0)); #endif static void checkExtruderAutoFans(); diff --git a/Marlin/src/module/thermistor/thermistors.h b/Marlin/src/module/thermistor/thermistors.h index ab92102de..340712e22 100644 --- a/Marlin/src/module/thermistor/thermistors.h +++ b/Marlin/src/module/thermistor/thermistors.h @@ -206,7 +206,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t; #if THERMISTOR_HEATER_0 #define HEATER_0_TEMPTABLE TT_NAME(THERMISTOR_HEATER_0) #define HEATER_0_TEMPTABLE_LEN COUNT(HEATER_0_TEMPTABLE) -#elif defined(HEATER_0_USES_THERMISTOR) +#elif HEATER_0_USES_THERMISTOR #error "No heater 0 thermistor table specified" #else #define HEATER_0_TEMPTABLE nullptr @@ -216,7 +216,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t; #if THERMISTOR_HEATER_1 #define HEATER_1_TEMPTABLE TT_NAME(THERMISTOR_HEATER_1) #define HEATER_1_TEMPTABLE_LEN COUNT(HEATER_1_TEMPTABLE) -#elif defined(HEATER_1_USES_THERMISTOR) +#elif HEATER_1_USES_THERMISTOR #error "No heater 1 thermistor table specified" #else #define HEATER_1_TEMPTABLE nullptr @@ -226,7 +226,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t; #if THERMISTOR_HEATER_2 #define HEATER_2_TEMPTABLE TT_NAME(THERMISTOR_HEATER_2) #define HEATER_2_TEMPTABLE_LEN COUNT(HEATER_2_TEMPTABLE) -#elif defined(HEATER_2_USES_THERMISTOR) +#elif HEATER_2_USES_THERMISTOR #error "No heater 2 thermistor table specified" #else #define HEATER_2_TEMPTABLE nullptr @@ -236,7 +236,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t; #if THERMISTOR_HEATER_3 #define HEATER_3_TEMPTABLE TT_NAME(THERMISTOR_HEATER_3) #define HEATER_3_TEMPTABLE_LEN COUNT(HEATER_3_TEMPTABLE) -#elif defined(HEATER_3_USES_THERMISTOR) +#elif HEATER_3_USES_THERMISTOR #error "No heater 3 thermistor table specified" #else #define HEATER_3_TEMPTABLE nullptr @@ -246,7 +246,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t; #if THERMISTOR_HEATER_4 #define HEATER_4_TEMPTABLE TT_NAME(THERMISTOR_HEATER_4) #define HEATER_4_TEMPTABLE_LEN COUNT(HEATER_4_TEMPTABLE) -#elif defined(HEATER_4_USES_THERMISTOR) +#elif HEATER_4_USES_THERMISTOR #error "No heater 4 thermistor table specified" #else #define HEATER_4_TEMPTABLE nullptr @@ -256,7 +256,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t; #if THERMISTOR_HEATER_5 #define HEATER_5_TEMPTABLE TT_NAME(THERMISTOR_HEATER_5) #define HEATER_5_TEMPTABLE_LEN COUNT(HEATER_5_TEMPTABLE) -#elif defined(HEATER_5_USES_THERMISTOR) +#elif HEATER_5_USES_THERMISTOR #error "No heater 5 thermistor table specified" #else #define HEATER_5_TEMPTABLE nullptr @@ -266,7 +266,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t; #if THERMISTOR_HEATER_6 #define HEATER_6_TEMPTABLE TT_NAME(THERMISTOR_HEATER_6) #define HEATER_6_TEMPTABLE_LEN COUNT(HEATER_6_TEMPTABLE) -#elif defined(HEATER_6_USES_THERMISTOR) +#elif HEATER_6_USES_THERMISTOR #error "No heater 6 thermistor table specified" #else #define HEATER_6_TEMPTABLE nullptr @@ -276,7 +276,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t; #if THERMISTOR_HEATER_7 #define HEATER_7_TEMPTABLE TT_NAME(THERMISTOR_HEATER_7) #define HEATER_7_TEMPTABLE_LEN COUNT(HEATER_7_TEMPTABLE) -#elif defined(HEATER_7_USES_THERMISTOR) +#elif HEATER_7_USES_THERMISTOR #error "No heater 7 thermistor table specified" #else #define HEATER_7_TEMPTABLE nullptr @@ -286,7 +286,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t; #ifdef THERMISTORBED #define BED_TEMPTABLE TT_NAME(THERMISTORBED) #define BED_TEMPTABLE_LEN COUNT(BED_TEMPTABLE) -#elif defined(HEATER_BED_USES_THERMISTOR) +#elif HEATER_BED_USES_THERMISTOR #error "No bed thermistor table specified" #else #define BED_TEMPTABLE_LEN 0 @@ -295,7 +295,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t; #ifdef THERMISTORCHAMBER #define CHAMBER_TEMPTABLE TT_NAME(THERMISTORCHAMBER) #define CHAMBER_TEMPTABLE_LEN COUNT(CHAMBER_TEMPTABLE) -#elif defined(HEATER_CHAMBER_USES_THERMISTOR) +#elif HEATER_CHAMBER_USES_THERMISTOR #error "No chamber thermistor table specified" #else #define CHAMBER_TEMPTABLE_LEN 0 @@ -304,7 +304,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t; #ifdef THERMISTORPROBE #define PROBE_TEMPTABLE TT_NAME(THERMISTORPROBE) #define PROBE_TEMPTABLE_LEN COUNT(PROBE_TEMPTABLE) -#elif defined(HEATER_PROBE_USES_THERMISTOR) +#elif HEATER_PROBE_USES_THERMISTOR #error "No probe thermistor table specified" #else #define PROBE_TEMPTABLE_LEN 0 @@ -402,7 +402,7 @@ static_assert( #endif #ifndef HEATER_0_RAW_HI_TEMP - #if TT_REV(THERMISTOR_HEATER_0) || !defined(HEATER_0_USES_THERMISTOR) + #if TT_REV(THERMISTOR_HEATER_0) || !HEATER_0_USES_THERMISTOR #define HEATER_0_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE #define HEATER_0_RAW_LO_TEMP 0 #else @@ -411,7 +411,7 @@ static_assert( #endif #endif #ifndef HEATER_1_RAW_HI_TEMP - #if TT_REV(THERMISTOR_HEATER_1) || !defined(HEATER_1_USES_THERMISTOR) + #if TT_REV(THERMISTOR_HEATER_1) || !HEATER_1_USES_THERMISTOR #define HEATER_1_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE #define HEATER_1_RAW_LO_TEMP 0 #else @@ -420,7 +420,7 @@ static_assert( #endif #endif #ifndef HEATER_2_RAW_HI_TEMP - #if TT_REV(THERMISTOR_HEATER_2) || !defined(HEATER_2_USES_THERMISTOR) + #if TT_REV(THERMISTOR_HEATER_2) || !HEATER_2_USES_THERMISTOR #define HEATER_2_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE #define HEATER_2_RAW_LO_TEMP 0 #else @@ -429,7 +429,7 @@ static_assert( #endif #endif #ifndef HEATER_3_RAW_HI_TEMP - #if TT_REV(THERMISTOR_HEATER_3) || !defined(HEATER_3_USES_THERMISTOR) + #if TT_REV(THERMISTOR_HEATER_3) || !HEATER_3_USES_THERMISTOR #define HEATER_3_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE #define HEATER_3_RAW_LO_TEMP 0 #else @@ -438,7 +438,7 @@ static_assert( #endif #endif #ifndef HEATER_4_RAW_HI_TEMP - #if TT_REV(THERMISTOR_HEATER_4) || !defined(HEATER_4_USES_THERMISTOR) + #if TT_REV(THERMISTOR_HEATER_4) || !HEATER_4_USES_THERMISTOR #define HEATER_4_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE #define HEATER_4_RAW_LO_TEMP 0 #else @@ -447,7 +447,7 @@ static_assert( #endif #endif #ifndef HEATER_5_RAW_HI_TEMP - #if TT_REV(THERMISTOR_HEATER_5) || !defined(HEATER_5_USES_THERMISTOR) + #if TT_REV(THERMISTOR_HEATER_5) || !HEATER_5_USES_THERMISTOR #define HEATER_5_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE #define HEATER_5_RAW_LO_TEMP 0 #else @@ -456,7 +456,7 @@ static_assert( #endif #endif #ifndef HEATER_6_RAW_HI_TEMP - #if TT_REV(THERMISTOR_HEATER_6) || !defined(HEATER_6_USES_THERMISTOR) + #if TT_REV(THERMISTOR_HEATER_6) || !HEATER_6_USES_THERMISTOR #define HEATER_6_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE #define HEATER_6_RAW_LO_TEMP 0 #else @@ -465,7 +465,7 @@ static_assert( #endif #endif #ifndef HEATER_7_RAW_HI_TEMP - #if TT_REV(THERMISTOR_HEATER_7) || !defined(HEATER_7_USES_THERMISTOR) + #if TT_REV(THERMISTOR_HEATER_7) || !HEATER_7_USES_THERMISTOR #define HEATER_7_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE #define HEATER_7_RAW_LO_TEMP 0 #else @@ -474,7 +474,7 @@ static_assert( #endif #endif #ifndef HEATER_BED_RAW_HI_TEMP - #if TT_REV(THERMISTORBED) || !defined(HEATER_BED_USES_THERMISTOR) + #if TT_REV(THERMISTORBED) || !HEATER_BED_USES_THERMISTOR #define HEATER_BED_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE #define HEATER_BED_RAW_LO_TEMP 0 #else @@ -483,7 +483,7 @@ static_assert( #endif #endif #ifndef HEATER_CHAMBER_RAW_HI_TEMP - #if TT_REV(THERMISTORCHAMBER) || !defined(HEATER_CHAMBER_USES_THERMISTOR) + #if TT_REV(THERMISTORCHAMBER) || !HEATER_CHAMBER_USES_THERMISTOR #define HEATER_CHAMBER_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE #define HEATER_CHAMBER_RAW_LO_TEMP 0 #else @@ -492,7 +492,7 @@ static_assert( #endif #endif #ifndef HEATER_PROBE_RAW_HI_TEMP - #if TT_REV(THERMISTORPROBE) || !defined(HEATER_PROBE_USES_THERMISTOR) + #if TT_REV(THERMISTORPROBE) || !HEATER_PROBE_USES_THERMISTOR #define HEATER_PROBE_RAW_HI_TEMP MAX_RAW_THERMISTOR_VALUE #define HEATER_PROBE_RAW_LO_TEMP 0 #else