🐛 Fix IDEX + DISABLE_INACTIVE_EXTRUDER (#22925)

This commit is contained in:
InsanityAutomation 2021-10-12 19:40:56 -04:00 committed by Scott Lahteine
parent f3be03da20
commit 5b1ef638ee
2 changed files with 11 additions and 10 deletions

View file

@ -1193,6 +1193,7 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) {
case DXC_MIRRORED_MODE: case DXC_MIRRORED_MODE:
case DXC_DUPLICATION_MODE: case DXC_DUPLICATION_MODE:
if (active_extruder == 0) { if (active_extruder == 0) {
set_duplication_enabled(false); // Clear stale duplication state
// Restore planner to parked head (T1) X position // Restore planner to parked head (T1) X position
float x0_pos = current_position.x; float x0_pos = current_position.x;
xyze_pos_t pos_now = current_position; xyze_pos_t pos_now = current_position;

View file

@ -2207,23 +2207,23 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
#if ENABLED(DISABLE_INACTIVE_EXTRUDER) // Enable only the selected extruder #if ENABLED(DISABLE_INACTIVE_EXTRUDER) // Enable only the selected extruder
// Count down all steppers that were recently moved
LOOP_L_N(i, E_STEPPERS) LOOP_L_N(i, E_STEPPERS)
if (g_uc_extruder_last_move[i]) g_uc_extruder_last_move[i]--; if (g_uc_extruder_last_move[i]) g_uc_extruder_last_move[i]--;
// Switching Extruder uses one E stepper motor per two nozzles
#define E_STEPPER_INDEX(E) TERN(SWITCHING_EXTRUDER, (E) / 2, E) #define E_STEPPER_INDEX(E) TERN(SWITCHING_EXTRUDER, (E) / 2, E)
// Enable all (i.e., both) E steppers for IDEX-style duplication, but only active E steppers for multi-nozzle (i.e., single wide X carriage) duplication
#define _IS_DUPE(N) TERN0(HAS_DUPLICATION_MODE, (extruder_duplication_enabled && TERN1(MULTI_NOZZLE_DUPLICATION, TEST(duplication_e_mask, N))))
#define ENABLE_ONE_E(N) do{ \ #define ENABLE_ONE_E(N) do{ \
if (E_STEPPER_INDEX(extruder) == N) { \ if (N == E_STEPPER_INDEX(extruder) || _IS_DUPE(N)) { /* N is 'extruder', or N is duplicating */ \
stepper.ENABLE_EXTRUDER(N); \ stepper.ENABLE_EXTRUDER(N); /* Enable the relevant E stepper... */ \
g_uc_extruder_last_move[N] = (BLOCK_BUFFER_SIZE) * 2; \ g_uc_extruder_last_move[N] = (BLOCK_BUFFER_SIZE) * 2; /* ...and reset its counter */ \
if ((N) == 0 && TERN0(HAS_DUPLICATION_MODE, extruder_duplication_enabled)) \
stepper.ENABLE_EXTRUDER(1); \
} \
else if (!g_uc_extruder_last_move[N]) { \
stepper.DISABLE_EXTRUDER(N); \
if ((N) == 0 && TERN0(HAS_DUPLICATION_MODE, extruder_duplication_enabled)) \
stepper.DISABLE_EXTRUDER(1); \
} \ } \
else if (!g_uc_extruder_last_move[N]) /* Counter expired since last E stepper enable */ \
stepper.DISABLE_EXTRUDER(N); /* Disable the E stepper */ \
}while(0); }while(0);
#else #else