🩹 Fix Extensible MMU for >8 colors (#25772)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
@@ -676,28 +676,9 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
|
|||||||
&& ELAPSED(ms, gcode.previous_move_ms + SEC_TO_MS(EXTRUDER_RUNOUT_SECONDS))
|
&& ELAPSED(ms, gcode.previous_move_ms + SEC_TO_MS(EXTRUDER_RUNOUT_SECONDS))
|
||||||
&& !planner.has_blocks_queued()
|
&& !planner.has_blocks_queued()
|
||||||
) {
|
) {
|
||||||
#if HAS_SWITCHING_EXTRUDER
|
const int8_t e_stepper = TERN(HAS_SWITCHING_EXTRUDER, active_extruder >> 1, active_extruder);
|
||||||
bool oldstatus;
|
const bool e_off = !stepper.AXIS_IS_ENABLED(E_AXIS, e_stepper);
|
||||||
switch (active_extruder) {
|
if (e_off) stepper.ENABLE_EXTRUDER(e_stepper);
|
||||||
default: oldstatus = stepper.AXIS_IS_ENABLED(E_AXIS, 0); stepper.ENABLE_EXTRUDER(0); break;
|
|
||||||
#if E_STEPPERS > 1
|
|
||||||
case 2: case 3: oldstatus = stepper.AXIS_IS_ENABLED(E_AXIS, 1); stepper.ENABLE_EXTRUDER(1); break;
|
|
||||||
#if E_STEPPERS > 2
|
|
||||||
case 4: case 5: oldstatus = stepper.AXIS_IS_ENABLED(E_AXIS, 2); stepper.ENABLE_EXTRUDER(2); break;
|
|
||||||
#if E_STEPPERS > 3
|
|
||||||
case 6: case 7: oldstatus = stepper.AXIS_IS_ENABLED(E_AXIS, 3); stepper.ENABLE_EXTRUDER(3); break;
|
|
||||||
#endif // E_STEPPERS > 3
|
|
||||||
#endif // E_STEPPERS > 2
|
|
||||||
#endif // E_STEPPERS > 1
|
|
||||||
}
|
|
||||||
#else // !HAS_SWITCHING_EXTRUDER
|
|
||||||
bool oldstatus;
|
|
||||||
switch (active_extruder) {
|
|
||||||
default:
|
|
||||||
#define _CASE_EN(N) case N: oldstatus = stepper.AXIS_IS_ENABLED(E_AXIS, N); stepper.ENABLE_EXTRUDER(N); break;
|
|
||||||
REPEAT(E_STEPPERS, _CASE_EN);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const float olde = current_position.e;
|
const float olde = current_position.e;
|
||||||
current_position.e += EXTRUDER_RUNOUT_EXTRUDE;
|
current_position.e += EXTRUDER_RUNOUT_EXTRUDE;
|
||||||
@@ -706,22 +687,7 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
|
|||||||
planner.set_e_position_mm(olde);
|
planner.set_e_position_mm(olde);
|
||||||
planner.synchronize();
|
planner.synchronize();
|
||||||
|
|
||||||
#if HAS_SWITCHING_EXTRUDER
|
if (e_off) stepper.DISABLE_EXTRUDER(e_stepper);
|
||||||
switch (active_extruder) {
|
|
||||||
default: if (oldstatus) stepper.ENABLE_EXTRUDER(0); else stepper.DISABLE_EXTRUDER(0); break;
|
|
||||||
#if E_STEPPERS > 1
|
|
||||||
case 2: case 3: if (oldstatus) stepper.ENABLE_EXTRUDER(1); else stepper.DISABLE_EXTRUDER(1); break;
|
|
||||||
#if E_STEPPERS > 2
|
|
||||||
case 4: case 5: if (oldstatus) stepper.ENABLE_EXTRUDER(2); else stepper.DISABLE_EXTRUDER(2); break;
|
|
||||||
#endif // E_STEPPERS > 2
|
|
||||||
#endif // E_STEPPERS > 1
|
|
||||||
}
|
|
||||||
#else // !HAS_SWITCHING_EXTRUDER
|
|
||||||
switch (active_extruder) {
|
|
||||||
#define _CASE_RESTORE(N) case N: if (oldstatus) stepper.ENABLE_EXTRUDER(N); else stepper.DISABLE_EXTRUDER(N); break;
|
|
||||||
REPEAT(E_STEPPERS, _CASE_RESTORE);
|
|
||||||
}
|
|
||||||
#endif // !HAS_SWITCHING_EXTRUDER
|
|
||||||
|
|
||||||
gcode.reset_stepper_timeout(ms);
|
gcode.reset_stepper_timeout(ms);
|
||||||
}
|
}
|
||||||
|
@@ -71,7 +71,7 @@ void do_enable(const stepper_flags_t to_enable) {
|
|||||||
|
|
||||||
if (!shall_enable) return; // All specified axes already enabled?
|
if (!shall_enable) return; // All specified axes already enabled?
|
||||||
|
|
||||||
ena_mask_t also_enabled = 0; // Track steppers enabled due to overlap
|
ena_mask_t also_enabled = 0; // Track steppers enabled due to overlap
|
||||||
|
|
||||||
// Enable all flagged axes
|
// Enable all flagged axes
|
||||||
LOOP_NUM_AXES(a) {
|
LOOP_NUM_AXES(a) {
|
||||||
|
@@ -255,8 +255,19 @@
|
|||||||
// This does not account for the possibility of multi-stepping.
|
// This does not account for the possibility of multi-stepping.
|
||||||
#define MIN_STEP_ISR_FREQUENCY (MAX_STEP_ISR_FREQUENCY_1X >> 1)
|
#define MIN_STEP_ISR_FREQUENCY (MAX_STEP_ISR_FREQUENCY_1X >> 1)
|
||||||
|
|
||||||
|
// TODO: Review and ensure proper handling for special E axes with commands like M17/M18, stepper timeout, etc.
|
||||||
|
#if ENABLED(MIXING_EXTRUDER)
|
||||||
|
#define E_STATES EXTRUDERS // All steppers are set together for each mixer. (Currently limited to 1.)
|
||||||
|
#elif HAS_SWITCHING_EXTRUDER
|
||||||
|
#define E_STATES E_STEPPERS // One stepper for every two EXTRUDERS. The last extruder can be non-switching.
|
||||||
|
#elif HAS_PRUSA_MMU2
|
||||||
|
#define E_STATES E_STEPPERS // One E stepper shared with all EXTRUDERS, so setting any only sets one.
|
||||||
|
#else
|
||||||
|
#define E_STATES E_STEPPERS // One stepper for each extruder, so each can be disabled individually.
|
||||||
|
#endif
|
||||||
|
|
||||||
// Number of axes that could be enabled/disabled. Dual/multiple steppers are combined.
|
// Number of axes that could be enabled/disabled. Dual/multiple steppers are combined.
|
||||||
#define ENABLE_COUNT (NUM_AXES + E_STEPPERS)
|
#define ENABLE_COUNT (NUM_AXES + E_STATES)
|
||||||
typedef bits_t(ENABLE_COUNT) ena_mask_t;
|
typedef bits_t(ENABLE_COUNT) ena_mask_t;
|
||||||
|
|
||||||
// Axis flags type, for enabled state or other simple state
|
// Axis flags type, for enabled state or other simple state
|
||||||
@@ -265,8 +276,8 @@ typedef struct {
|
|||||||
ena_mask_t bits;
|
ena_mask_t bits;
|
||||||
struct {
|
struct {
|
||||||
bool NUM_AXIS_LIST(X:1, Y:1, Z:1, I:1, J:1, K:1, U:1, V:1, W:1);
|
bool NUM_AXIS_LIST(X:1, Y:1, Z:1, I:1, J:1, K:1, U:1, V:1, W:1);
|
||||||
#if HAS_EXTRUDERS
|
#if E_STATES
|
||||||
bool LIST_N(EXTRUDERS, E0:1, E1:1, E2:1, E3:1, E4:1, E5:1, E6:1, E7:1);
|
bool LIST_N(E_STATES, E0:1, E1:1, E2:1, E3:1, E4:1, E5:1, E6:1, E7:1);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user