Remove dual x-carriage functionality that could/should be implemented in slicer

Also added a couple of missed merge lines in homeaxis() from previous
commit.
This commit is contained in:
Robert F-C 2013-07-20 13:07:50 +10:00
parent d7390e13d9
commit 39cd3dbdbe
2 changed files with 13 additions and 81 deletions

View file

@ -169,11 +169,6 @@
#define X2_STEP_PIN 25 #define X2_STEP_PIN 25
#define X2_DIR_PIN 23 #define X2_DIR_PIN 23
// The following settings control the behaviour of the automatic parking and unparking of inactive extruder
#define TOOLCHANGE_PARK_ZLIFT 0.1 // the distance to raise Z axis when parking an extruder
#define TOOLCHANGE_UNPARK_ZLIFT 1 // the distance to raise Z axis when unparking an extruder
#define TOOLCHANGE_UNPARK_SKIP_TRAVEL_MOVES // disable if slicer natively suports dual x-carriage mode.
// When enabled this avoids unnecessary & inadvertant moves from the last position of old extruder.
#endif // DUAL_X_CARRIAGE #endif // DUAL_X_CARRIAGE
//homing hits the endstop, then retracts by this distance, before it tries to slowly bump again: //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again:

View file

@ -703,9 +703,7 @@ static int x_home_dir(int extruder) {
return (extruder == 0) ? X_HOME_DIR : X2_HOME_DIR; return (extruder == 0) ? X_HOME_DIR : X2_HOME_DIR;
} }
static bool active_extruder_parked = false; static float inactive_x_carriage_pos = X2_MAX_POS;
static float raised_parked_position[NUM_AXIS];
static unsigned long delayed_move_time = 0;
#endif #endif
static void axis_is_at_home(int axis) { static void axis_is_at_home(int axis) {
@ -745,18 +743,18 @@ static void homeaxis(int axis) {
current_position[axis] = 0; current_position[axis] = 0;
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
destination[axis] = 1.5 * max_length(axis) * home_dir(axis); destination[axis] = 1.5 * max_length(axis) * axis_home_dir;
feedrate = homing_feedrate[axis]; feedrate = homing_feedrate[axis];
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
st_synchronize(); st_synchronize();
current_position[axis] = 0; current_position[axis] = 0;
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
destination[axis] = -home_retract_mm(axis) * home_dir(axis); destination[axis] = -home_retract_mm(axis) * axis_home_dir;
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
st_synchronize(); st_synchronize();
destination[axis] = 2*home_retract_mm(axis) * home_dir(axis); destination[axis] = 2*home_retract_mm(axis) * axis_home_dir;
feedrate = homing_feedrate[axis]/2 ; feedrate = homing_feedrate[axis]/2 ;
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
st_synchronize(); st_synchronize();
@ -896,7 +894,7 @@ void process_commands()
#else // NOT DELTA #else // NOT DELTA
home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2]))); home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2])));
#if Z_HOME_DIR > 0 // If homing away from BED do Z first #if Z_HOME_DIR > 0 // If homing away from BED do Z first
if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) { if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
@ -945,9 +943,8 @@ void process_commands()
int tmp_extruder = active_extruder; int tmp_extruder = active_extruder;
active_extruder = !active_extruder; active_extruder = !active_extruder;
HOMEAXIS(X); HOMEAXIS(X);
inactive_x_carriage_pos = current_position[X_AXIS];
active_extruder = tmp_extruder; active_extruder = tmp_extruder;
active_extruder_parked = false;
delayed_move_time = 0;
#endif #endif
HOMEAXIS(X); HOMEAXIS(X);
} }
@ -2061,34 +2058,18 @@ void process_commands()
// Save current position to return to after applying extruder offset // Save current position to return to after applying extruder offset
memcpy(destination, current_position, sizeof(destination)); memcpy(destination, current_position, sizeof(destination));
#ifdef DUAL_X_CARRIAGE #ifdef DUAL_X_CARRIAGE
if (Stopped == false && delayed_move_time == 0 && current_position[X_AXIS] != x_home_pos(active_extruder))
{
// Park old head: 1) raise 2) move to park position 3) lower
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT,
current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT,
current_position[E_AXIS], max_feedrate[X_AXIS], active_extruder);
plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS],
current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
st_synchronize();
}
// only apply Y extruder offset in dual x carriage mode (x offset is already used in determining home pos) // only apply Y extruder offset in dual x carriage mode (x offset is already used in determining home pos)
current_position[Y_AXIS] = current_position[Y_AXIS] - current_position[Y_AXIS] = current_position[Y_AXIS] -
extruder_offset[Y_AXIS][active_extruder] + extruder_offset[Y_AXIS][active_extruder] +
extruder_offset[Y_AXIS][tmp_extruder]; extruder_offset[Y_AXIS][tmp_extruder];
float tmp_x_pos = current_position[X_AXIS];
// Set the new active extruder and position
active_extruder = tmp_extruder; active_extruder = tmp_extruder;
axis_is_at_home(X_AXIS); //this function updates X min/max values.
// Inactive head always starts at its parked position. current_position[X_AXIS] = inactive_x_carriage_pos;
axis_is_at_home(X_AXIS); inactive_x_carriage_pos = tmp_x_pos;
// record raised toolhead position for use by unpark
memcpy(raised_parked_position, current_position, sizeof(raised_parked_position));
raised_parked_position[Z_AXIS] += TOOLCHANGE_UNPARK_ZLIFT;
active_extruder_parked = true;
delayed_move_time = 0;
#else #else
// Offset extruder (only by XY) // Offset extruder (only by XY)
int i; int i;
@ -2294,40 +2275,6 @@ void prepare_move()
active_extruder); active_extruder);
} }
#else #else
#if defined(DUAL_X_CARRIAGE)
if (active_extruder_parked)
{
if (current_position[E_AXIS] == destination[E_AXIS])
{
// this is a travel move
#ifdef TOOLCHANGE_UNPARK_SKIP_TRAVEL_MOVES
if (delayed_move_time != 0xFFFFFFFFUL)
{
// skip this move but still update current_position in main so that it can
// be used as starting position before extrusion (but not in planner)
memcpy(current_position, destination, sizeof(current_position));
if (destination[Z_AXIS] > raised_parked_position[Z_AXIS])
raised_parked_position[Z_AXIS] = destination[Z_AXIS];
delayed_move_time = millis();
return;
}
delayed_move_time = 0;
#else
// this will cause the unpark code below to execute the specified lift in moving to the initial (travel move) position.
memcpy(current_position, destination, sizeof(current_position));
#endif
}
// unpark extruder: 1) raise, 2) move into starting XY position, 3) lower
plan_buffer_line(raised_parked_position[X_AXIS], raised_parked_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS],
current_position[E_AXIS], min(max_feedrate[X_AXIS],max_feedrate[Y_AXIS]), active_extruder);
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS],
current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
active_extruder_parked = false;
}
#endif //DUAL_X_CARRIAGE
// Do not use feedmultiply for E or Z only moves // Do not use feedmultiply for E or Z only moves
if( (current_position[X_AXIS] == destination [X_AXIS]) && (current_position[Y_AXIS] == destination [Y_AXIS])) { if( (current_position[X_AXIS] == destination [X_AXIS]) && (current_position[Y_AXIS] == destination [Y_AXIS])) {
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
@ -2447,16 +2394,6 @@ void manage_inactivity()
WRITE(E0_ENABLE_PIN,oldstatus); WRITE(E0_ENABLE_PIN,oldstatus);
} }
#endif #endif
#if defined(DUAL_X_CARRIAGE) && defined(TOOLCHANGE_UNPARK_SKIP_TRAVEL_MOVES)
// handle delayed move timeout
if (delayed_move_time != 0 && (millis() - delayed_move_time) > 1000)
{
// travel moves have been received so enact them
delayed_move_time = 0xFFFFFFFFUL; // force moves to be done
memcpy(destination,current_position,sizeof(destination));
prepare_move();
}
#endif
check_axes_activity(); check_axes_activity();
} }