diff --git a/Marlin/src/gcode/temp/M104_M109.cpp b/Marlin/src/gcode/temp/M104_M109.cpp index 3a4f61bbea6f..db150d55181d 100644 --- a/Marlin/src/gcode/temp/M104_M109.cpp +++ b/Marlin/src/gcode/temp/M104_M109.cpp @@ -135,4 +135,4 @@ void GcodeSuite::M104_M109(const bool isM109) { (void)thermalManager.wait_for_hotend(target_extruder, no_wait_for_cooling); } -#endif // HOTEND +#endif // HAS_HOTEND diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 898a75e235e1..e2c4f25e4394 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -619,8 +619,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 @@ -652,9 +650,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 @@ -686,20 +681,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 - #if TEMP_SENSOR_0 == 0 - #define HOTENDS 0 - #else - #define HOTENDS EXTRUDERS - #endif -#endif +// Default E steppers / manual motion is one per extruder #ifndef E_STEPPERS #define E_STEPPERS EXTRUDERS #endif @@ -707,6 +689,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 @@ -1036,19 +1057,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) @@ -1060,21 +1068,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 880a8698b3e2..49877e6b51b6 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -237,29 +237,53 @@ #endif #undef _OR_HAS_DI -#if HOTENDS <= 7 +// Remove hotend-dependent settings +#if HOTENDS < 8 #undef E7_AUTO_FAN_PIN - #if HOTENDS <= 6 - #undef E6_AUTO_FAN_PIN - #if HOTENDS <= 5 - #undef E5_AUTO_FAN_PIN - #if HOTENDS <= 4 - #undef E4_AUTO_FAN_PIN - #if HOTENDS <= 3 - #undef E3_AUTO_FAN_PIN - #if HOTENDS <= 2 - #undef E2_AUTO_FAN_PIN - #if HOTENDS <= 1 - #undef E1_AUTO_FAN_PIN - #if HOTENDS == 0 - #undef E0_AUTO_FAN_PIN - #endif - #endif - #endif - #endif - #endif - #endif - #endif + #undef HEATER_7_MAXTEMP + #undef HEATER_7_MINTEMP +#endif +#if HOTENDS < 7 + #undef E6_AUTO_FAN_PIN + #undef HEATER_6_MAXTEMP + #undef HEATER_6_MINTEMP +#endif +#if HOTENDS < 6 + #undef E5_AUTO_FAN_PIN + #undef HEATER_5_MAXTEMP + #undef HEATER_5_MINTEMP +#endif +#if HOTENDS < 5 + #undef E4_AUTO_FAN_PIN + #undef HEATER_4_MAXTEMP + #undef HEATER_4_MINTEMP +#endif +#if HOTENDS < 4 + #undef E3_AUTO_FAN_PIN + #undef HEATER_3_MAXTEMP + #undef HEATER_3_MINTEMP +#endif +#if HOTENDS < 3 + #undef E2_AUTO_FAN_PIN + #undef HEATER_2_MAXTEMP + #undef HEATER_2_MINTEMP +#endif +#if HOTENDS < 2 + #undef E1_AUTO_FAN_PIN + #undef HEATER_1_MAXTEMP + #undef HEATER_1_MINTEMP +#endif +#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 PREVENT_COLD_EXTRUSION + #undef THERMAL_PROTECTION_HOTENDS + #undef THERMAL_PROTECTION_PERIOD + #undef WATCH_TEMP_PERIOD #endif /** @@ -331,15 +355,6 @@ #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 - #undef THERMAL_PROTECTION_HOTENDS - #undef THERMAL_PROTECTION_PERIOD - #undef WATCH_TEMP_PERIOD - #undef PREVENT_COLD_EXTRUSION - #undef PIDTEMP - #undef AUTOTEMP #endif #if TEMP_SENSOR_IS_MAX_TC(1) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index daeed6a9c004..c79fa3449af4 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2626,84 +2626,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_HOTEND && !ANY_PIN(TEMP_0, TEMP_0_CS) - #error "TEMP_0_PIN or TEMP_0_CS_PIN not defined for this board." -#elif HAS_HOTEND && !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." - #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 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 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."