From c8ed7950f40f9f454fc769b02d53f1086b17576c Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sat, 22 Apr 2023 21:09:17 +1200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Permit=20extrude=20without=20hot?= =?UTF-8?q?end=20(#25709)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/gcode/gcode.cpp | 2 +- Marlin/src/gcode/gcode.h | 2 +- Marlin/src/gcode/temp/M104_M109.cpp | 4 +- Marlin/src/inc/Conditionals_LCD.h | 83 +++++++------ Marlin/src/inc/Conditionals_adv.h | 178 +++++++++++++--------------- Marlin/src/inc/SanityCheck.h | 143 +++++++++++----------- Marlin/src/module/temperature.cpp | 2 +- 7 files changed, 201 insertions(+), 213 deletions(-) diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 0711d39204..9d1014e8bf 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -581,7 +581,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 102: M102(); break; // M102: Configure Bed Distance Sensor #endif - #if HAS_EXTRUDERS + #if HAS_HOTEND case 104: M104(); break; // M104: Set hot end temperature case 109: M109(); break; // M109: Wait for hotend temperature to reach target #endif diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 8493d7f291..d49c544623 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -716,7 +716,7 @@ private: static void M102_report(const bool forReplay=true); #endif - #if HAS_EXTRUDERS + #if HAS_HOTEND static void M104_M109(const bool isM109); FORCE_INLINE static void M104() { M104_M109(false); } FORCE_INLINE static void M109() { M104_M109(true); } diff --git a/Marlin/src/gcode/temp/M104_M109.cpp b/Marlin/src/gcode/temp/M104_M109.cpp index 331ceeb61d..db150d5518 100644 --- a/Marlin/src/gcode/temp/M104_M109.cpp +++ b/Marlin/src/gcode/temp/M104_M109.cpp @@ -28,7 +28,7 @@ #include "../../inc/MarlinConfigPre.h" -#if HAS_EXTRUDERS +#if HAS_HOTEND #include "../gcode.h" #include "../../module/temperature.h" @@ -135,4 +135,4 @@ void GcodeSuite::M104_M109(const bool isM109) { (void)thermalManager.wait_for_hotend(target_extruder, no_wait_for_cooling); } -#endif // EXTRUDERS +#endif // HAS_HOTEND diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 5cc1d07b09..32a2eda7c7 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -624,8 +624,6 @@ #undef MIXING_EXTRUDER #undef HOTEND_IDLE_TIMEOUT #undef DISABLE_E - #undef THERMAL_PROTECTION_HOTENDS - #undef PREVENT_COLD_EXTRUSION #undef PREVENT_LENGTHY_EXTRUDE #undef FILAMENT_RUNOUT_SENSOR #undef FILAMENT_RUNOUT_DISTANCE_MM @@ -657,9 +655,6 @@ #else #define E_STEPPERS 1 #endif - #if !HAS_SWITCHING_NOZZLE - #define HOTENDS E_STEPPERS - #endif #elif ENABLED(MIXING_EXTRUDER) // Multiple feeds are mixed proportionally @@ -691,16 +686,7 @@ #define SINGLENOZZLE #endif -#if EITHER(SINGLENOZZLE, MIXING_EXTRUDER) // One hotend, one thermistor, no XY offset - #undef HOTENDS - #define HOTENDS 1 - #undef HOTEND_OFFSET_X - #undef HOTEND_OFFSET_Y -#endif - -#ifndef HOTENDS - #define HOTENDS EXTRUDERS -#endif +// Default E steppers / manual motion is one per extruder #ifndef E_STEPPERS #define E_STEPPERS EXTRUDERS #endif @@ -708,6 +694,45 @@ #define E_MANUAL EXTRUDERS #endif +// Number of hotends... +#if EITHER(SINGLENOZZLE, MIXING_EXTRUDER) // Only one for singlenozzle or mixing extruder + #define HOTENDS 1 +#elif HAS_SWITCHING_EXTRUDER && !HAS_SWITCHING_NOZZLE // One for each pair of abstract "extruders" + #define HOTENDS E_STEPPERS +#elif TEMP_SENSOR_0 + #define HOTENDS EXTRUDERS // One per extruder if at least one heater exists +#else + #define HOTENDS 0 // A machine with no hotends at all can still extrude +#endif + +// More than one hotend... +#if HOTENDS > 1 + #define HAS_MULTI_HOTEND 1 + #define HAS_HOTEND_OFFSET 1 + #ifndef HOTEND_OFFSET_X + #define HOTEND_OFFSET_X { 0 } // X offsets for each extruder + #endif + #ifndef HOTEND_OFFSET_Y + #define HOTEND_OFFSET_Y { 0 } // Y offsets for each extruder + #endif + #ifndef HOTEND_OFFSET_Z + #define HOTEND_OFFSET_Z { 0 } // Z offsets for each extruder + #endif +#else + #undef HOTEND_OFFSET_X + #undef HOTEND_OFFSET_Y + #undef HOTEND_OFFSET_Z +#endif + +// At least one hotend... +#if HOTENDS + #define HAS_HOTEND 1 + #ifndef HOTEND_OVERSHOOT + #define HOTEND_OVERSHOOT 15 + #endif +#endif + +// Clean up E-stepper-based settings... #if E_STEPPERS <= 7 #undef INVERT_E7_DIR #undef E7_DRIVER_TYPE @@ -1037,19 +1062,6 @@ #define E_INDEX_N(E) 0 #endif -#if HOTENDS - #define HAS_HOTEND 1 - #ifndef HOTEND_OVERSHOOT - #define HOTEND_OVERSHOOT 15 - #endif - #if HOTENDS > 1 - #define HAS_MULTI_HOTEND 1 - #define HAS_HOTEND_OFFSET 1 - #endif -#else - #undef PID_PARAMS_PER_HOTEND -#endif - // Helper macros for extruder and hotend arrays #define _EXTRUDER_LOOP(E) for (int8_t E = 0; E < EXTRUDERS; E++) #define EXTRUDER_LOOP() _EXTRUDER_LOOP(e) @@ -1061,21 +1073,6 @@ #define ARRAY_BY_HOTENDS(V...) ARRAY_N(HOTENDS, V) #define ARRAY_BY_HOTENDS1(v1) ARRAY_N_1(HOTENDS, v1) -/** - * Default hotend offsets, if not defined - */ -#if HAS_HOTEND_OFFSET - #ifndef HOTEND_OFFSET_X - #define HOTEND_OFFSET_X { 0 } // X offsets for each extruder - #endif - #ifndef HOTEND_OFFSET_Y - #define HOTEND_OFFSET_Y { 0 } // Y offsets for each extruder - #endif - #ifndef HOTEND_OFFSET_Z - #define HOTEND_OFFSET_Z { 0 } // Z offsets for each extruder - #endif -#endif - /** * Disable unused SINGLENOZZLE sub-options */ diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 3a3daa84ac..c9c8fdf2d5 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -184,7 +184,6 @@ #if !HAS_EXTRUDERS #define NO_VOLUMETRICS #undef ADVANCED_PAUSE_FEATURE - #undef AUTOTEMP #undef DISABLE_IDLE_E #undef EXTRUDER_RUNOUT_PREVENT #undef FILAMENT_LOAD_UNLOAD_GCODES @@ -193,11 +192,8 @@ #undef LIN_ADVANCE #undef MANUAL_E_MOVES_RELATIVE #undef PID_EXTRUSION_SCALING - #undef PIDTEMP #undef SHOW_TEMP_ADC_VALUES #undef STEALTHCHOP_E - #undef THERMAL_PROTECTION_PERIOD - #undef WATCH_TEMP_PERIOD #endif #if ENABLED(DISABLE_X) && !defined(DISABLE_IDLE_X) @@ -237,22 +233,47 @@ #endif #undef _OR_HAS_DI -#if HOTENDS <= 7 +// Remove hotend-dependent settings +#if HOTENDS < 8 #undef E7_AUTO_FAN_PIN - #if HOTENDS <= 6 + #undef HEATER_7_MAXTEMP + #undef HEATER_7_MINTEMP + #if HOTENDS < 7 #undef E6_AUTO_FAN_PIN - #if HOTENDS <= 5 + #undef HEATER_6_MAXTEMP + #undef HEATER_6_MINTEMP + #if HOTENDS < 6 #undef E5_AUTO_FAN_PIN - #if HOTENDS <= 4 + #undef HEATER_5_MAXTEMP + #undef HEATER_5_MINTEMP + #if HOTENDS < 5 #undef E4_AUTO_FAN_PIN - #if HOTENDS <= 3 + #undef HEATER_4_MAXTEMP + #undef HEATER_4_MINTEMP + #if HOTENDS < 4 #undef E3_AUTO_FAN_PIN - #if HOTENDS <= 2 + #undef HEATER_3_MAXTEMP + #undef HEATER_3_MINTEMP + #if HOTENDS < 3 #undef E2_AUTO_FAN_PIN - #if HOTENDS <= 1 + #undef HEATER_2_MAXTEMP + #undef HEATER_2_MINTEMP + #if HOTENDS < 2 #undef E1_AUTO_FAN_PIN - #if HOTENDS == 0 + #undef HEATER_1_MAXTEMP + #undef HEATER_1_MINTEMP + #if HOTENDS < 1 + #undef AUTOTEMP #undef E0_AUTO_FAN_PIN + #undef HEATER_0_MAXTEMP + #undef HEATER_0_MINTEMP + #undef PID_PARAMS_PER_HOTEND + #undef PIDTEMP + #undef MPCTEMP + #undef PREVENT_COLD_EXTRUSION + #undef THERMAL_PROTECTION_HOTENDS + #undef THERMAL_PROTECTION_PERIOD + #undef WATCH_TEMP_PERIOD #endif #endif #endif @@ -325,15 +346,13 @@ #define TEMP_SENSOR_0_IS_AD8495 1 #elif TEMP_SENSOR_0 == -1 #define TEMP_SENSOR_0_IS_AD595 1 -#elif 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 #elif TEMP_SENSOR_0 > 0 #define TEMP_SENSOR_0_IS_THERMISTOR 1 -#else - #undef HEATER_0_MINTEMP - #undef HEATER_0_MAXTEMP + #if TEMP_SENSOR_0 == 1000 + #define TEMP_SENSOR_0_IS_CUSTOM 1 + #endif #endif #if TEMP_SENSOR_IS_MAX_TC(1) @@ -370,15 +389,13 @@ #define TEMP_SENSOR_1_IS_AD8495 1 #elif TEMP_SENSOR_1 == -1 #define TEMP_SENSOR_1_IS_AD595 1 -#elif 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 #elif TEMP_SENSOR_1 > 0 #define TEMP_SENSOR_1_IS_THERMISTOR 1 -#else - #undef HEATER_1_MINTEMP - #undef HEATER_1_MAXTEMP + #if TEMP_SENSOR_1 == 1000 + #define TEMP_SENSOR_1_IS_CUSTOM 1 + #endif #endif #if TEMP_SENSOR_IS_MAX_TC(2) @@ -415,70 +432,58 @@ #define TEMP_SENSOR_2_IS_AD8495 1 #elif TEMP_SENSOR_2 == -1 #define TEMP_SENSOR_2_IS_AD595 1 -#elif 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 #elif TEMP_SENSOR_2 > 0 #define TEMP_SENSOR_2_IS_THERMISTOR 1 -#else - #undef HEATER_2_MINTEMP - #undef HEATER_2_MAXTEMP + #if TEMP_SENSOR_2 == 1000 + #define TEMP_SENSOR_2_IS_CUSTOM 1 + #endif #endif -#if TEMP_SENSOR_3 == 1000 - #define TEMP_SENSOR_3_IS_CUSTOM 1 -#elif TEMP_SENSOR_3 == 998 || TEMP_SENSOR_3 == 999 +#if TEMP_SENSOR_3 == 998 || TEMP_SENSOR_3 == 999 #define TEMP_SENSOR_3_IS_DUMMY 1 #elif TEMP_SENSOR_3 > 0 #define TEMP_SENSOR_3_IS_THERMISTOR 1 -#elif !TEMP_SENSOR_3 - #undef HEATER_3_MINTEMP - #undef HEATER_3_MAXTEMP + #if TEMP_SENSOR_3 == 1000 + #define TEMP_SENSOR_3_IS_CUSTOM 1 + #endif #endif -#if TEMP_SENSOR_4 == 1000 - #define TEMP_SENSOR_4_IS_CUSTOM 1 -#elif TEMP_SENSOR_4 == 998 || TEMP_SENSOR_4 == 999 +#if TEMP_SENSOR_4 == 998 || TEMP_SENSOR_4 == 999 #define TEMP_SENSOR_4_IS_DUMMY 1 #elif TEMP_SENSOR_4 > 0 #define TEMP_SENSOR_4_IS_THERMISTOR 1 -#elif !TEMP_SENSOR_4 - #undef HEATER_4_MINTEMP - #undef HEATER_4_MAXTEMP + #if TEMP_SENSOR_4 == 1000 + #define TEMP_SENSOR_4_IS_CUSTOM 1 + #endif #endif -#if TEMP_SENSOR_5 == 1000 - #define TEMP_SENSOR_5_IS_CUSTOM 1 -#elif TEMP_SENSOR_5 == 998 || TEMP_SENSOR_5 == 999 +#if TEMP_SENSOR_5 == 998 || TEMP_SENSOR_5 == 999 #define TEMP_SENSOR_5_IS_DUMMY 1 #elif TEMP_SENSOR_5 > 0 #define TEMP_SENSOR_5_IS_THERMISTOR 1 -#elif !TEMP_SENSOR_5 - #undef HEATER_5_MINTEMP - #undef HEATER_5_MAXTEMP + #if TEMP_SENSOR_5 == 1000 + #define TEMP_SENSOR_5_IS_CUSTOM 1 + #endif #endif -#if TEMP_SENSOR_6 == 1000 - #define TEMP_SENSOR_6_IS_CUSTOM 1 -#elif TEMP_SENSOR_6 == 998 || TEMP_SENSOR_6 == 999 +#if TEMP_SENSOR_6 == 998 || TEMP_SENSOR_6 == 999 #define TEMP_SENSOR_6_IS_DUMMY 1 #elif TEMP_SENSOR_6 > 0 #define TEMP_SENSOR_6_IS_THERMISTOR 1 -#elif !TEMP_SENSOR_6 - #undef HEATER_6_MINTEMP - #undef HEATER_6_MAXTEMP + #if TEMP_SENSOR_6 == 1000 + #define TEMP_SENSOR_6_IS_CUSTOM 1 + #endif #endif -#if TEMP_SENSOR_7 == 1000 - #define TEMP_SENSOR_7_IS_CUSTOM 1 -#elif TEMP_SENSOR_7 == 998 || TEMP_SENSOR_7 == 999 +#if TEMP_SENSOR_7 == 998 || TEMP_SENSOR_7 == 999 #define TEMP_SENSOR_7_IS_DUMMY 1 #elif TEMP_SENSOR_7 > 0 #define TEMP_SENSOR_7_IS_THERMISTOR 1 -#elif !TEMP_SENSOR_7 - #undef HEATER_7_MINTEMP - #undef HEATER_7_MAXTEMP + #if TEMP_SENSOR_7 == 1000 + #define TEMP_SENSOR_7_IS_CUSTOM 1 + #endif #endif #if TEMP_SENSOR_IS_MAX_TC(REDUNDANT) @@ -542,12 +547,12 @@ #define TEMP_SENSOR_REDUNDANT_IS_AD8495 1 #elif TEMP_SENSOR_REDUNDANT == -1 #define TEMP_SENSOR_REDUNDANT_IS_AD595 1 +#elif TEMP_SENSOR_REDUNDANT == 998 || TEMP_SENSOR_REDUNDANT == 999 + #error "Dummy sensors are not supported for TEMP_SENSOR_REDUNDANT." #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 @@ -572,16 +577,13 @@ #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 == 998 || TEMP_SENSOR_3 == 999 + #define TEMP_SENSOR_3_IS_DUMMY 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 @@ -592,16 +594,13 @@ #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 == 998 || TEMP_SENSOR_4 == 999 + #define TEMP_SENSOR_4_IS_DUMMY 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 @@ -612,16 +611,13 @@ #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 == 998 || TEMP_SENSOR_5 == 999 + #define TEMP_SENSOR_5_IS_DUMMY 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 @@ -632,16 +628,13 @@ #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 == 998 || TEMP_SENSOR_6 == 999 + #define TEMP_SENSOR_6_IS_DUMMY 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 @@ -652,16 +645,13 @@ #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 == 998 || TEMP_SENSOR_7 == 999 + #define TEMP_SENSOR_7_IS_DUMMY 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 @@ -672,12 +662,12 @@ #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 == 998 || TEMP_SENSOR_BED == 999 + #define TEMP_SENSOR_BED_IS_DUMMY 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 @@ -694,12 +684,12 @@ #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 == 998 || TEMP_SENSOR_CHAMBER == 999 + #define TEMP_SENSOR_CHAMBER_IS_DUMMY 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 @@ -715,12 +705,12 @@ #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 == 998 || TEMP_SENSOR_COOLER == 999 + #define TEMP_SENSOR_COOLER_IS_DUMMY 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 @@ -736,12 +726,12 @@ #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 == 998 || TEMP_SENSOR_PROBE == 999 + #define TEMP_SENSOR_PROBE_IS_DUMMY 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 @@ -753,12 +743,12 @@ #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 == 998 || TEMP_SENSOR_BOARD == 999 + #define TEMP_SENSOR_BOARD_IS_DUMMY 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 diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index a7aec8e833..d431415559 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2628,84 +2628,85 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #endif /** - * Test Sensor & Heater pin combos. * Pins and Sensor IDs must be set for each heater */ -#if HAS_EXTRUDERS && !ANY_PIN(TEMP_0, TEMP_0_CS) - #error "TEMP_0_PIN or TEMP_0_CS_PIN not defined for this board." -#elif HAS_EXTRUDERS && !HAS_HEATER_0 - #error "HEATER_0_PIN not defined for this board." -#elif TEMP_SENSOR_IS_MAX_TC(0) && !PIN_EXISTS(TEMP_0_CS) - #error "TEMP_SENSOR_0 MAX thermocouple requires TEMP_0_CS_PIN." -#elif HAS_HOTEND && !HAS_TEMP_HOTEND && !TEMP_SENSOR_0_IS_DUMMY - #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 TEMP_SENSOR_IS_MAX_TC(1) && !PIN_EXISTS(TEMP_1_CS) - #error "TEMP_SENSOR_1 MAX thermocouple requires TEMP_1_CS_PIN." - #elif TEMP_SENSOR_1 == 0 - #error "TEMP_SENSOR_1 is required with 2 or more HOTENDS." - #elif !ANY_PIN(TEMP_1, TEMP_1_CS) && !TEMP_SENSOR_1_IS_DUMMY - #error "TEMP_1_PIN or TEMP_1_CS_PIN not defined for this board." +#if HAS_HOTEND + #if !HAS_HEATER_0 + #error "HEATER_0_PIN not defined for this board." + #elif TEMP_SENSOR_IS_MAX_TC(0) && !PIN_EXISTS(TEMP_0_CS) + #error "TEMP_SENSOR_0 MAX thermocouple requires TEMP_0_CS_PIN." + #elif TEMP_SENSOR_0 == 0 + #error "TEMP_SENSOR_0 is required with 1 or more HOTENDS." + #elif !ANY_PIN(TEMP_0, TEMP_0_CS) && !TEMP_SENSOR_0_IS_DUMMY + #error "TEMP_0_PIN or TEMP_0_CS_PIN not defined for this board." #endif - #if HOTENDS > 2 - #if TEMP_SENSOR_2 == 0 - #error "TEMP_SENSOR_2 is required with 3 or more HOTENDS." - #elif !HAS_HEATER_2 - #error "HEATER_2_PIN not defined for this board." - #elif !ANY_PIN(TEMP_2, TEMP_2_CS) && !TEMP_SENSOR_2_IS_DUMMY - #error "TEMP_2_PIN or TEMP_2_CS_PIN not defined for this board." + #if 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 TEMP_SENSOR_IS_MAX_TC(1) && !PIN_EXISTS(TEMP_1_CS) + #error "TEMP_SENSOR_1 MAX thermocouple requires TEMP_1_CS_PIN." + #elif TEMP_SENSOR_1 == 0 + #error "TEMP_SENSOR_1 is required with 2 or more HOTENDS." + #elif !ANY_PIN(TEMP_1, TEMP_1_CS) && !TEMP_SENSOR_1_IS_DUMMY + #error "TEMP_1_PIN or TEMP_1_CS_PIN not defined for this board." #endif - #if HOTENDS > 3 - #if TEMP_SENSOR_3 == 0 - #error "TEMP_SENSOR_3 is required with 4 or more HOTENDS." - #elif !HAS_HEATER_3 - #error "HEATER_3_PIN not defined for this board." - #elif !PIN_EXISTS(TEMP_3) && !TEMP_SENSOR_3_IS_DUMMY - #error "TEMP_3_PIN not defined for this board." + #if HOTENDS > 2 + #if TEMP_SENSOR_2 == 0 + #error "TEMP_SENSOR_2 is required with 3 or more HOTENDS." + #elif !HAS_HEATER_2 + #error "HEATER_2_PIN not defined for this board." + #elif !ANY_PIN(TEMP_2, TEMP_2_CS) && !TEMP_SENSOR_2_IS_DUMMY + #error "TEMP_2_PIN or TEMP_2_CS_PIN not defined for this board." #endif - #if HOTENDS > 4 - #if TEMP_SENSOR_4 == 0 - #error "TEMP_SENSOR_4 is required with 5 or more HOTENDS." - #elif !HAS_HEATER_4 - #error "HEATER_4_PIN not defined for this board." - #elif !PIN_EXISTS(TEMP_4) && !TEMP_SENSOR_4_IS_DUMMY - #error "TEMP_4_PIN not defined for this board." + #if HOTENDS > 3 + #if TEMP_SENSOR_3 == 0 + #error "TEMP_SENSOR_3 is required with 4 or more HOTENDS." + #elif !HAS_HEATER_3 + #error "HEATER_3_PIN not defined for this board." + #elif !PIN_EXISTS(TEMP_3) && !TEMP_SENSOR_3_IS_DUMMY + #error "TEMP_3_PIN not defined for this board." #endif - #if HOTENDS > 5 - #if TEMP_SENSOR_5 == 0 - #error "TEMP_SENSOR_5 is required with 6 HOTENDS." - #elif !HAS_HEATER_5 - #error "HEATER_5_PIN not defined for this board." - #elif !PIN_EXISTS(TEMP_5) && !TEMP_SENSOR_5_IS_DUMMY - #error "TEMP_5_PIN not defined for this board." + #if HOTENDS > 4 + #if TEMP_SENSOR_4 == 0 + #error "TEMP_SENSOR_4 is required with 5 or more HOTENDS." + #elif !HAS_HEATER_4 + #error "HEATER_4_PIN not defined for this board." + #elif !PIN_EXISTS(TEMP_4) && !TEMP_SENSOR_4_IS_DUMMY + #error "TEMP_4_PIN not defined for this board." #endif - #if HOTENDS > 6 - #if TEMP_SENSOR_6 == 0 - #error "TEMP_SENSOR_6 is required with 6 HOTENDS." - #elif !HAS_HEATER_6 - #error "HEATER_6_PIN not defined for this board." - #elif !PIN_EXISTS(TEMP_6) && !TEMP_SENSOR_6_IS_DUMMY - #error "TEMP_6_PIN not defined for this board." + #if HOTENDS > 5 + #if TEMP_SENSOR_5 == 0 + #error "TEMP_SENSOR_5 is required with 6 HOTENDS." + #elif !HAS_HEATER_5 + #error "HEATER_5_PIN not defined for this board." + #elif !PIN_EXISTS(TEMP_5) && !TEMP_SENSOR_5_IS_DUMMY + #error "TEMP_5_PIN not defined for this board." #endif - #if HOTENDS > 7 - #if TEMP_SENSOR_7 == 0 - #error "TEMP_SENSOR_7 is required with 7 HOTENDS." - #elif !HAS_HEATER_7 - #error "HEATER_7_PIN not defined for this board." - #elif !PIN_EXISTS(TEMP_7) && !TEMP_SENSOR_7_IS_DUMMY - #error "TEMP_7_PIN not defined for this board." + #if HOTENDS > 6 + #if TEMP_SENSOR_6 == 0 + #error "TEMP_SENSOR_6 is required with 6 HOTENDS." + #elif !HAS_HEATER_6 + #error "HEATER_6_PIN not defined for this board." + #elif !PIN_EXISTS(TEMP_6) && !TEMP_SENSOR_6_IS_DUMMY + #error "TEMP_6_PIN not defined for this board." #endif - #endif // HOTENDS > 7 - #endif // HOTENDS > 6 - #endif // HOTENDS > 5 - #endif // HOTENDS > 4 - #endif // HOTENDS > 3 - #endif // HOTENDS > 2 -#endif // HAS_MULTI_HOTEND + #if HOTENDS > 7 + #if TEMP_SENSOR_7 == 0 + #error "TEMP_SENSOR_7 is required with 7 HOTENDS." + #elif !HAS_HEATER_7 + #error "HEATER_7_PIN not defined for this board." + #elif !PIN_EXISTS(TEMP_7) && !TEMP_SENSOR_7_IS_DUMMY + #error "TEMP_7_PIN not defined for this board." + #endif + #endif // HOTENDS > 7 + #endif // HOTENDS > 6 + #endif // HOTENDS > 5 + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HAS_MULTI_HOTEND +#endif // HAS_HOTEND #if DO_TOOLCHANGE_FOR_PROBING && PROBING_TOOL >= EXTRUDERS #error "PROBING_TOOL must be a valid tool index." @@ -2836,8 +2837,8 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS #error "E0_STEP_PIN or E0_DIR_PIN not defined for this board." #elif ( !(defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && (!PINS_EXIST(E0_STEP, E0_DIR) || !HAS_E0_ENABLE)) #error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board." - #elif EXTRUDERS && TEMP_SENSOR_0 == 0 - #error "TEMP_SENSOR_0 is required if there are any extruders." + #elif HOTENDS && TEMP_SENSOR_0 == 0 + #error "TEMP_SENSOR_0 is required if there are any hotends." #endif #endif diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index ce46d3d43d..5bf809c955 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -2785,7 +2785,7 @@ void Temperature::init() { temp_range[NR].raw_max -= TEMPDIR(NR) * (OVERSAMPLENR); \ }while(0) - #define _MINMAX_TEST(N,M) (HOTENDS > N && TEMP_SENSOR(N) > 0 && TEMP_SENSOR(N) != 998 && TEMP_SENSOR(N) != 999 && defined(HEATER_##N##_##M##TEMP)) + #define _MINMAX_TEST(N,M) (HOTENDS > N && TEMP_SENSOR_##NR##_IS_THERMISTOR && defined(HEATER_##N##_##M##TEMP)) #if _MINMAX_TEST(0, MIN) _TEMP_MIN_E(0);