Fix IDEX layer shift and DIR states (#19756)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
@@ -348,7 +348,7 @@ xyze_int8_t Stepper::count_direction{0};
|
||||
}
|
||||
|
||||
#if ENABLED(X_DUAL_STEPPER_DRIVERS)
|
||||
#define X_APPLY_DIR(v,Q) do{ X_DIR_WRITE(v); X2_DIR_WRITE((v) != INVERT_X2_VS_X_DIR); }while(0)
|
||||
#define X_APPLY_DIR(v,Q) do{ X_DIR_WRITE(v); X2_DIR_WRITE((v) ^ ENABLED(INVERT_X2_VS_X_DIR)); }while(0)
|
||||
#if ENABLED(X_DUAL_ENDSTOPS)
|
||||
#define X_APPLY_STEP(v,Q) DUAL_ENDSTOP_APPLY_STEP(X,v)
|
||||
#else
|
||||
@@ -356,7 +356,7 @@ xyze_int8_t Stepper::count_direction{0};
|
||||
#endif
|
||||
#elif ENABLED(DUAL_X_CARRIAGE)
|
||||
#define X_APPLY_DIR(v,ALWAYS) do{ \
|
||||
if (extruder_duplication_enabled || ALWAYS) { X_DIR_WRITE(v); X2_DIR_WRITE(mirrored_duplication_mode ? !(v) : v); } \
|
||||
if (extruder_duplication_enabled || ALWAYS) { X_DIR_WRITE(v); X2_DIR_WRITE((v) ^ idex_mirrored_mode); } \
|
||||
else if (last_moved_extruder) X2_DIR_WRITE(v); else X_DIR_WRITE(v); \
|
||||
}while(0)
|
||||
#define X_APPLY_STEP(v,ALWAYS) do{ \
|
||||
@@ -369,7 +369,7 @@ xyze_int8_t Stepper::count_direction{0};
|
||||
#endif
|
||||
|
||||
#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
|
||||
#define Y_APPLY_DIR(v,Q) do{ Y_DIR_WRITE(v); Y2_DIR_WRITE((v) != INVERT_Y2_VS_Y_DIR); }while(0)
|
||||
#define Y_APPLY_DIR(v,Q) do{ Y_DIR_WRITE(v); Y2_DIR_WRITE((v) ^ ENABLED(INVERT_Y2_VS_Y_DIR)); }while(0)
|
||||
#if ENABLED(Y_DUAL_ENDSTOPS)
|
||||
#define Y_APPLY_STEP(v,Q) DUAL_ENDSTOP_APPLY_STEP(Y,v)
|
||||
#else
|
||||
@@ -1605,10 +1605,9 @@ void Stepper::pulse_phase_isr() {
|
||||
PAGE_SEGMENT_UPDATE(Z, high >> 4);
|
||||
PAGE_SEGMENT_UPDATE(E, high & 0xF);
|
||||
|
||||
if (dm != last_direction_bits) {
|
||||
last_direction_bits = dm;
|
||||
set_directions();
|
||||
}
|
||||
if (dm != last_direction_bits)
|
||||
set_directions(dm);
|
||||
|
||||
} break;
|
||||
|
||||
default: break;
|
||||
@@ -2131,9 +2130,7 @@ uint32_t Stepper::block_phase_isr() {
|
||||
MIXER_STEPPER_SETUP();
|
||||
#endif
|
||||
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
stepper_extruder = current_block->extruder;
|
||||
#endif
|
||||
TERN_(HAS_MULTI_EXTRUDER, stepper_extruder = current_block->extruder);
|
||||
|
||||
// Initialize the trapezoid generator from the current block.
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
@@ -2151,17 +2148,14 @@ uint32_t Stepper::block_phase_isr() {
|
||||
else LA_isr_rate = LA_ADV_NEVER;
|
||||
#endif
|
||||
|
||||
if ( ENABLED(HAS_L64XX) // Always set direction for L64xx (Also enables the chips)
|
||||
if ( ENABLED(HAS_L64XX) // Always set direction for L64xx (Also enables the chips)
|
||||
|| ENABLED(DUAL_X_CARRIAGE) // TODO: Find out why this fixes "jittery" small circles
|
||||
|| current_block->direction_bits != last_direction_bits
|
||||
|| TERN(MIXING_EXTRUDER, false, stepper_extruder != last_moved_extruder)
|
||||
) {
|
||||
last_direction_bits = current_block->direction_bits;
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
last_moved_extruder = stepper_extruder;
|
||||
#endif
|
||||
|
||||
TERN_(HAS_MULTI_EXTRUDER, last_moved_extruder = stepper_extruder);
|
||||
TERN_(HAS_L64XX, L64XX_OK_to_power_up = true);
|
||||
set_directions();
|
||||
set_directions(current_block->direction_bits);
|
||||
}
|
||||
|
||||
#if ENABLED(LASER_POWER_INLINE)
|
||||
@@ -2583,12 +2577,9 @@ void Stepper::init() {
|
||||
#endif
|
||||
|
||||
// Init direction bits for first moves
|
||||
last_direction_bits = 0
|
||||
| (INVERT_X_DIR ? _BV(X_AXIS) : 0)
|
||||
| (INVERT_Y_DIR ? _BV(Y_AXIS) : 0)
|
||||
| (INVERT_Z_DIR ? _BV(Z_AXIS) : 0);
|
||||
|
||||
set_directions();
|
||||
set_directions((INVERT_X_DIR ? _BV(X_AXIS) : 0)
|
||||
| (INVERT_Y_DIR ? _BV(Y_AXIS) : 0)
|
||||
| (INVERT_Z_DIR ? _BV(Z_AXIS) : 0));
|
||||
|
||||
#if HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_PWM
|
||||
initialized = true;
|
||||
|
Reference in New Issue
Block a user