IDEX Improvements (#11848)
This commit is contained in:
@@ -1886,6 +1886,9 @@ void MarlinSettings::reset(PORTARG_SOLO) {
|
||||
"Offsets for the first hotend must be 0.0."
|
||||
);
|
||||
LOOP_XYZ(i) HOTEND_LOOP() hotend_offset[i][e] = tmp4[i][e];
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
hotend_offset[X_AXIS][1] = MAX(X2_HOME_POS, X2_MAX_POS);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//
|
||||
|
@@ -760,7 +760,7 @@ float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
|
||||
bool extruder_duplication_enabled = false, // Used in Dual X mode 2 & 3
|
||||
symmetric_duplication_mode = false; // Used in Dual X mode 2 & 3
|
||||
scaled_duplication_mode = false; // Used in Dual X mode 2 & 3
|
||||
#endif
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
@@ -818,8 +818,6 @@ float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
|
||||
#define RAISED_Y raised_parked_position[Y_AXIS]
|
||||
#define RAISED_Z raised_parked_position[Z_AXIS]
|
||||
|
||||
//SERIAL_ECHOLNPGM("dual_x_carriage_unpark()\n");
|
||||
|
||||
if ( planner.buffer_line(RAISED_X, RAISED_Y, RAISED_Z, CUR_E, planner.max_feedrate_mm_s[Z_AXIS], active_extruder))
|
||||
if (planner.buffer_line( CUR_X, CUR_Y, RAISED_Z, CUR_E, PLANNER_XY_FEEDRATE(), active_extruder))
|
||||
planner.buffer_line( CUR_X, CUR_Y, CUR_Z, CUR_E, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
|
||||
@@ -829,6 +827,7 @@ float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
|
||||
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("Clear active_extruder_parked");
|
||||
#endif
|
||||
break;
|
||||
case DXC_SCALED_DUPLICATION_MODE:
|
||||
case DXC_DUPLICATION_MODE:
|
||||
if (active_extruder == 0) {
|
||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
@@ -839,10 +838,12 @@ float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
|
||||
#endif
|
||||
// move duplicate extruder into correct duplication position.
|
||||
planner.set_position_mm(inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
||||
|
||||
if (!planner.buffer_line(
|
||||
current_position[X_AXIS] + duplicate_extruder_x_offset,
|
||||
current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS],
|
||||
planner.max_feedrate_mm_s[X_AXIS], 1)
|
||||
dual_x_carriage_mode == DXC_DUPLICATION_MODE ? duplicate_extruder_x_offset + current_position[X_AXIS] : inactive_extruder_x_pos,
|
||||
current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS],
|
||||
planner.max_feedrate_mm_s[X_AXIS], 1
|
||||
)
|
||||
) break;
|
||||
planner.synchronize();
|
||||
sync_plan_position();
|
||||
@@ -860,6 +861,7 @@ float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
|
||||
break;
|
||||
}
|
||||
}
|
||||
stepper.set_directions();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -906,9 +908,9 @@ void prepare_move_to_destination() {
|
||||
|
||||
if (
|
||||
#if UBL_SEGMENTED
|
||||
// ubl.prepare_segmented_line_to(destination, MMS_SCALED(feedrate_mm_s)) // This does not seem to work correctly on UBL.
|
||||
#if ENABLED(DELTA) // A Delta case and a Cartesian case can work
|
||||
ubl.prepare_segmented_line_to(destination, MMS_SCALED(feedrate_mm_s)) // around the problem until it is fixed.
|
||||
//ubl.prepare_segmented_line_to(destination, MMS_SCALED(feedrate_mm_s)) // This doesn't seem to work correctly on UBL.
|
||||
#if IS_KINEMATIC // Use Kinematic / Cartesian cases as a workaround for now.
|
||||
ubl.prepare_segmented_line_to(destination, MMS_SCALED(feedrate_mm_s))
|
||||
#else
|
||||
prepare_move_to_destination_cartesian()
|
||||
#endif
|
||||
@@ -1499,7 +1501,7 @@ void homeaxis(const AxisEnum axis) {
|
||||
soft_endstop_min[X_AXIS] = X2_MIN_POS;
|
||||
soft_endstop_max[X_AXIS] = dual_max_x;
|
||||
}
|
||||
else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) {
|
||||
else if (dxc_is_duplicating()) {
|
||||
// In Duplication Mode, T0 can move as far left as X_MIN_POS
|
||||
// but not so far to the right that T1 would move past the end
|
||||
soft_endstop_min[X_AXIS] = base_min_pos(X_AXIS);
|
||||
|
@@ -305,7 +305,7 @@ void homeaxis(const AxisEnum axis);
|
||||
*/
|
||||
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
|
||||
extern bool extruder_duplication_enabled, // Used in Dual X mode 2
|
||||
symmetric_duplication_mode; // Used in Dual X mode 2
|
||||
scaled_duplication_mode; // Used in Dual X mode 3
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -314,9 +314,10 @@ void homeaxis(const AxisEnum axis);
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
|
||||
enum DualXMode : char {
|
||||
DXC_FULL_CONTROL_MODE, // DUAL_X_CARRIAGE only
|
||||
DXC_AUTO_PARK_MODE, // DUAL_X_CARRIAGE only
|
||||
DXC_DUPLICATION_MODE
|
||||
DXC_FULL_CONTROL_MODE,
|
||||
DXC_AUTO_PARK_MODE,
|
||||
DXC_DUPLICATION_MODE,
|
||||
DXC_SCALED_DUPLICATION_MODE
|
||||
};
|
||||
|
||||
extern DualXMode dual_x_carriage_mode;
|
||||
@@ -327,6 +328,8 @@ void homeaxis(const AxisEnum axis);
|
||||
extern millis_t delayed_move_time; // used in mode 1
|
||||
extern int16_t duplicate_extruder_temp_offset; // used in mode 2 & 3
|
||||
|
||||
FORCE_INLINE bool dxc_is_duplicating() { return dual_x_carriage_mode >= DXC_DUPLICATION_MODE; }
|
||||
|
||||
float x_home_pos(const int extruder);
|
||||
|
||||
FORCE_INLINE int x_home_dir(const uint8_t extruder) { return extruder ? X2_HOME_DIR : X_HOME_DIR; }
|
||||
|
@@ -251,7 +251,7 @@ int8_t Stepper::count_direction[NUM_AXIS] = { 0, 0, 0, 0 };
|
||||
#define X_APPLY_DIR(v,ALWAYS) \
|
||||
if (extruder_duplication_enabled || ALWAYS) { \
|
||||
X_DIR_WRITE(v); \
|
||||
X2_DIR_WRITE(bool(v)); \
|
||||
X2_DIR_WRITE(v); \
|
||||
} \
|
||||
else { \
|
||||
if (movement_extruder()) X2_DIR_WRITE(v); else X_DIR_WRITE(v); \
|
||||
|
@@ -472,13 +472,10 @@ class Stepper {
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
// Set direction bits for all steppers
|
||||
static void set_directions();
|
||||
|
||||
// Allow reset_stepper_drivers to access private set_directions
|
||||
friend void reset_stepper_drivers();
|
||||
private:
|
||||
|
||||
// Set the current position in steps
|
||||
static void _set_position(const int32_t &a, const int32_t &b, const int32_t &c, const int32_t &e);
|
||||
|
@@ -562,9 +562,18 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
||||
#define REV_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; case 2: E2_DIR_WRITE( INVERT_E2_DIR); } }while(0)
|
||||
#elif E_STEPPERS > 1
|
||||
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
|
||||
#define E_STEP_WRITE(E,V) do{ if (extruder_duplication_enabled) { E0_STEP_WRITE(V); E1_STEP_WRITE(V); } else if (E == 0) { E0_STEP_WRITE(V); } else { E1_STEP_WRITE(V); } }while(0)
|
||||
#define NORM_E_DIR(E) do{ if (extruder_duplication_enabled) { E0_DIR_WRITE(!INVERT_E0_DIR); E1_DIR_WRITE(!INVERT_E1_DIR); } else if (E == 0) { E0_DIR_WRITE(!INVERT_E0_DIR); } else { E1_DIR_WRITE(!INVERT_E1_DIR); } }while(0)
|
||||
#define REV_E_DIR(E) do{ if (extruder_duplication_enabled) { E0_DIR_WRITE( INVERT_E0_DIR); E1_DIR_WRITE( INVERT_E1_DIR); } else if (E == 0) { E0_DIR_WRITE( INVERT_E0_DIR); } else { E1_DIR_WRITE( INVERT_E1_DIR); } }while(0)
|
||||
|
||||
#define E_STEP_WRITE(E,V) do{ if (extruder_duplication_enabled) { E0_STEP_WRITE(V); E1_STEP_WRITE(V); } \
|
||||
else if ((E) == 0) { E0_STEP_WRITE(V); } \
|
||||
else { E1_STEP_WRITE(V); } }while(0)
|
||||
|
||||
#define NORM_E_DIR(E) do{ if (extruder_duplication_enabled) { E0_DIR_WRITE(!INVERT_E0_DIR); E1_DIR_WRITE(!INVERT_E1_DIR); } \
|
||||
else if ((E) == 0) { E0_DIR_WRITE(!INVERT_E0_DIR); } \
|
||||
else { E1_DIR_WRITE(!INVERT_E1_DIR); } }while(0)
|
||||
|
||||
#define REV_E_DIR(E) do{ if (extruder_duplication_enabled) { E0_DIR_WRITE( INVERT_E0_DIR); E1_DIR_WRITE( INVERT_E1_DIR); } \
|
||||
else if ((E) == 0) { E0_DIR_WRITE( INVERT_E0_DIR); } \
|
||||
else { E1_DIR_WRITE( INVERT_E1_DIR); } }while(0)
|
||||
#else
|
||||
#define E_STEP_WRITE(E,V) do{ if (E == 0) { E0_STEP_WRITE(V); } else { E1_STEP_WRITE(V); } }while(0)
|
||||
#define NORM_E_DIR(E) do{ if (E == 0) { E0_DIR_WRITE(!INVERT_E0_DIR); } else { E1_DIR_WRITE(!INVERT_E1_DIR); } }while(0)
|
||||
|
@@ -366,6 +366,8 @@ inline void invalid_extruder_error(const uint8_t e) {
|
||||
switch (dual_x_carriage_mode) {
|
||||
case DXC_FULL_CONTROL_MODE: SERIAL_ECHOLNPGM("DXC_FULL_CONTROL_MODE"); break;
|
||||
case DXC_AUTO_PARK_MODE: SERIAL_ECHOLNPGM("DXC_AUTO_PARK_MODE"); break;
|
||||
case DXC_DUPLICATION_MODE: SERIAL_ECHOLNPGM("DXC_DUPLICATION_MODE"); break;
|
||||
case DXC_SCALED_DUPLICATION_MODE: SERIAL_ECHOLNPGM("DXC_SCALED_DUPLICATION_MODE"); break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -455,9 +457,8 @@ inline void invalid_extruder_error(const uint8_t e) {
|
||||
void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool no_move/*=false*/) {
|
||||
planner.synchronize();
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
// Only T0 allowed in DXC_DUPLICATION_MODE
|
||||
if (tmp_extruder != 0 && dual_x_carriage_mode == DXC_DUPLICATION_MODE)
|
||||
#if ENABLED(DUAL_X_CARRIAGE) // Only T0 allowed if the Printer is in DXC_DUPLICATION_MODE or DXC_SCALED_DUPLICATION_MODE
|
||||
if (tmp_extruder != 0 && dxc_is_duplicating())
|
||||
return invalid_extruder_error(tmp_extruder);
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user