Skip to content

Commit

Permalink
collect hotend together
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Apr 19, 2023
1 parent f7e797b commit 1320d5c
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 79 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/gcode/temp/M104_M109.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
87 changes: 40 additions & 47 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -686,27 +681,53 @@
#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
#ifndef E_MANUAL
#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
Expand Down Expand Up @@ -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)
Expand All @@ -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
*/
Expand Down
77 changes: 46 additions & 31 deletions Marlin/src/inc/Conditionals_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

/**
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1320d5c

Please sign in to comment.