Skip to content

Commit c8ed795

Browse files
ellenspthinkyhead
andauthored
🔧 Permit extrude without hotend (MarlinFirmware#25709)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
1 parent 89ccede commit c8ed795

File tree

7 files changed

+202
-214
lines changed

7 files changed

+202
-214
lines changed

Marlin/src/gcode/gcode.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
581581
case 102: M102(); break; // M102: Configure Bed Distance Sensor
582582
#endif
583583

584-
#if HAS_EXTRUDERS
584+
#if HAS_HOTEND
585585
case 104: M104(); break; // M104: Set hot end temperature
586586
case 109: M109(); break; // M109: Wait for hotend temperature to reach target
587587
#endif

Marlin/src/gcode/gcode.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ class GcodeSuite {
716716
static void M102_report(const bool forReplay=true);
717717
#endif
718718

719-
#if HAS_EXTRUDERS
719+
#if HAS_HOTEND
720720
static void M104_M109(const bool isM109);
721721
FORCE_INLINE static void M104() { M104_M109(false); }
722722
FORCE_INLINE static void M109() { M104_M109(true); }

Marlin/src/gcode/temp/M104_M109.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
#include "../../inc/MarlinConfigPre.h"
3030

31-
#if HAS_EXTRUDERS
31+
#if HAS_HOTEND
3232

3333
#include "../gcode.h"
3434
#include "../../module/temperature.h"
@@ -135,4 +135,4 @@ void GcodeSuite::M104_M109(const bool isM109) {
135135
(void)thermalManager.wait_for_hotend(target_extruder, no_wait_for_cooling);
136136
}
137137

138-
#endif // EXTRUDERS
138+
#endif // HAS_HOTEND

Marlin/src/inc/Conditionals_LCD.h

+40-43
Original file line numberDiff line numberDiff line change
@@ -624,8 +624,6 @@
624624
#undef MIXING_EXTRUDER
625625
#undef HOTEND_IDLE_TIMEOUT
626626
#undef DISABLE_E
627-
#undef THERMAL_PROTECTION_HOTENDS
628-
#undef PREVENT_COLD_EXTRUSION
629627
#undef PREVENT_LENGTHY_EXTRUDE
630628
#undef FILAMENT_RUNOUT_SENSOR
631629
#undef FILAMENT_RUNOUT_DISTANCE_MM
@@ -657,9 +655,6 @@
657655
#else
658656
#define E_STEPPERS 1
659657
#endif
660-
#if !HAS_SWITCHING_NOZZLE
661-
#define HOTENDS E_STEPPERS
662-
#endif
663658

664659
#elif ENABLED(MIXING_EXTRUDER) // Multiple feeds are mixed proportionally
665660

@@ -691,23 +686,53 @@
691686
#define SINGLENOZZLE
692687
#endif
693688

694-
#if EITHER(SINGLENOZZLE, MIXING_EXTRUDER) // One hotend, one thermistor, no XY offset
695-
#undef HOTENDS
696-
#define HOTENDS 1
697-
#undef HOTEND_OFFSET_X
698-
#undef HOTEND_OFFSET_Y
699-
#endif
700-
701-
#ifndef HOTENDS
702-
#define HOTENDS EXTRUDERS
703-
#endif
689+
// Default E steppers / manual motion is one per extruder
704690
#ifndef E_STEPPERS
705691
#define E_STEPPERS EXTRUDERS
706692
#endif
707693
#ifndef E_MANUAL
708694
#define E_MANUAL EXTRUDERS
709695
#endif
710696

697+
// Number of hotends...
698+
#if EITHER(SINGLENOZZLE, MIXING_EXTRUDER) // Only one for singlenozzle or mixing extruder
699+
#define HOTENDS 1
700+
#elif HAS_SWITCHING_EXTRUDER && !HAS_SWITCHING_NOZZLE // One for each pair of abstract "extruders"
701+
#define HOTENDS E_STEPPERS
702+
#elif TEMP_SENSOR_0
703+
#define HOTENDS EXTRUDERS // One per extruder if at least one heater exists
704+
#else
705+
#define HOTENDS 0 // A machine with no hotends at all can still extrude
706+
#endif
707+
708+
// More than one hotend...
709+
#if HOTENDS > 1
710+
#define HAS_MULTI_HOTEND 1
711+
#define HAS_HOTEND_OFFSET 1
712+
#ifndef HOTEND_OFFSET_X
713+
#define HOTEND_OFFSET_X { 0 } // X offsets for each extruder
714+
#endif
715+
#ifndef HOTEND_OFFSET_Y
716+
#define HOTEND_OFFSET_Y { 0 } // Y offsets for each extruder
717+
#endif
718+
#ifndef HOTEND_OFFSET_Z
719+
#define HOTEND_OFFSET_Z { 0 } // Z offsets for each extruder
720+
#endif
721+
#else
722+
#undef HOTEND_OFFSET_X
723+
#undef HOTEND_OFFSET_Y
724+
#undef HOTEND_OFFSET_Z
725+
#endif
726+
727+
// At least one hotend...
728+
#if HOTENDS
729+
#define HAS_HOTEND 1
730+
#ifndef HOTEND_OVERSHOOT
731+
#define HOTEND_OVERSHOOT 15
732+
#endif
733+
#endif
734+
735+
// Clean up E-stepper-based settings...
711736
#if E_STEPPERS <= 7
712737
#undef INVERT_E7_DIR
713738
#undef E7_DRIVER_TYPE
@@ -1037,19 +1062,6 @@
10371062
#define E_INDEX_N(E) 0
10381063
#endif
10391064

1040-
#if HOTENDS
1041-
#define HAS_HOTEND 1
1042-
#ifndef HOTEND_OVERSHOOT
1043-
#define HOTEND_OVERSHOOT 15
1044-
#endif
1045-
#if HOTENDS > 1
1046-
#define HAS_MULTI_HOTEND 1
1047-
#define HAS_HOTEND_OFFSET 1
1048-
#endif
1049-
#else
1050-
#undef PID_PARAMS_PER_HOTEND
1051-
#endif
1052-
10531065
// Helper macros for extruder and hotend arrays
10541066
#define _EXTRUDER_LOOP(E) for (int8_t E = 0; E < EXTRUDERS; E++)
10551067
#define EXTRUDER_LOOP() _EXTRUDER_LOOP(e)
@@ -1061,21 +1073,6 @@
10611073
#define ARRAY_BY_HOTENDS(V...) ARRAY_N(HOTENDS, V)
10621074
#define ARRAY_BY_HOTENDS1(v1) ARRAY_N_1(HOTENDS, v1)
10631075

1064-
/**
1065-
* Default hotend offsets, if not defined
1066-
*/
1067-
#if HAS_HOTEND_OFFSET
1068-
#ifndef HOTEND_OFFSET_X
1069-
#define HOTEND_OFFSET_X { 0 } // X offsets for each extruder
1070-
#endif
1071-
#ifndef HOTEND_OFFSET_Y
1072-
#define HOTEND_OFFSET_Y { 0 } // Y offsets for each extruder
1073-
#endif
1074-
#ifndef HOTEND_OFFSET_Z
1075-
#define HOTEND_OFFSET_Z { 0 } // Z offsets for each extruder
1076-
#endif
1077-
#endif
1078-
10791076
/**
10801077
* Disable unused SINGLENOZZLE sub-options
10811078
*/

0 commit comments

Comments
 (0)