|
@@ -703,9 +703,7 @@ static int x_home_dir(int extruder) {
|
703
|
703
|
return (extruder == 0) ? X_HOME_DIR : X2_HOME_DIR;
|
704
|
704
|
}
|
705
|
705
|
|
706
|
|
-static bool active_extruder_parked = false;
|
707
|
|
-static float raised_parked_position[NUM_AXIS];
|
708
|
|
-static unsigned long delayed_move_time = 0;
|
|
706
|
+static float inactive_x_carriage_pos = X2_MAX_POS;
|
709
|
707
|
#endif
|
710
|
708
|
|
711
|
709
|
static void axis_is_at_home(int axis) {
|
|
@@ -745,18 +743,18 @@ static void homeaxis(int axis) {
|
745
|
743
|
|
746
|
744
|
current_position[axis] = 0;
|
747
|
745
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
748
|
|
- destination[axis] = 1.5 * max_length(axis) * home_dir(axis);
|
|
746
|
+ destination[axis] = 1.5 * max_length(axis) * axis_home_dir;
|
749
|
747
|
feedrate = homing_feedrate[axis];
|
750
|
748
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
751
|
749
|
st_synchronize();
|
752
|
750
|
|
753
|
751
|
current_position[axis] = 0;
|
754
|
752
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
755
|
|
- destination[axis] = -home_retract_mm(axis) * home_dir(axis);
|
|
753
|
+ destination[axis] = -home_retract_mm(axis) * axis_home_dir;
|
756
|
754
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
757
|
755
|
st_synchronize();
|
758
|
756
|
|
759
|
|
- destination[axis] = 2*home_retract_mm(axis) * home_dir(axis);
|
|
757
|
+ destination[axis] = 2*home_retract_mm(axis) * axis_home_dir;
|
760
|
758
|
feedrate = homing_feedrate[axis]/2 ;
|
761
|
759
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
762
|
760
|
st_synchronize();
|
|
@@ -896,7 +894,7 @@ void process_commands()
|
896
|
894
|
|
897
|
895
|
#else // NOT DELTA
|
898
|
896
|
|
899
|
|
- home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2])));
|
|
897
|
+ home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2])));
|
900
|
898
|
|
901
|
899
|
#if Z_HOME_DIR > 0 // If homing away from BED do Z first
|
902
|
900
|
if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
|
|
@@ -945,9 +943,8 @@ void process_commands()
|
945
|
943
|
int tmp_extruder = active_extruder;
|
946
|
944
|
active_extruder = !active_extruder;
|
947
|
945
|
HOMEAXIS(X);
|
|
946
|
+ inactive_x_carriage_pos = current_position[X_AXIS];
|
948
|
947
|
active_extruder = tmp_extruder;
|
949
|
|
- active_extruder_parked = false;
|
950
|
|
- delayed_move_time = 0;
|
951
|
948
|
#endif
|
952
|
949
|
HOMEAXIS(X);
|
953
|
950
|
}
|
|
@@ -2061,34 +2058,18 @@ void process_commands()
|
2061
|
2058
|
// Save current position to return to after applying extruder offset
|
2062
|
2059
|
memcpy(destination, current_position, sizeof(destination));
|
2063
|
2060
|
#ifdef DUAL_X_CARRIAGE
|
2064
|
|
- if (Stopped == false && delayed_move_time == 0 && current_position[X_AXIS] != x_home_pos(active_extruder))
|
2065
|
|
- {
|
2066
|
|
- // Park old head: 1) raise 2) move to park position 3) lower
|
2067
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT,
|
2068
|
|
- current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
|
2069
|
|
- plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT,
|
2070
|
|
- current_position[E_AXIS], max_feedrate[X_AXIS], active_extruder);
|
2071
|
|
- plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS],
|
2072
|
|
- current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
|
2073
|
|
- st_synchronize();
|
2074
|
|
- }
|
2075
|
|
-
|
2076
|
2061
|
// only apply Y extruder offset in dual x carriage mode (x offset is already used in determining home pos)
|
2077
|
2062
|
current_position[Y_AXIS] = current_position[Y_AXIS] -
|
2078
|
2063
|
extruder_offset[Y_AXIS][active_extruder] +
|
2079
|
2064
|
extruder_offset[Y_AXIS][tmp_extruder];
|
2080
|
|
-
|
2081
|
|
- active_extruder = tmp_extruder;
|
2082
|
2065
|
|
2083
|
|
- // Inactive head always starts at its parked position.
|
2084
|
|
- axis_is_at_home(X_AXIS);
|
|
2066
|
+ float tmp_x_pos = current_position[X_AXIS];
|
2085
|
2067
|
|
2086
|
|
- // record raised toolhead position for use by unpark
|
2087
|
|
- memcpy(raised_parked_position, current_position, sizeof(raised_parked_position));
|
2088
|
|
- raised_parked_position[Z_AXIS] += TOOLCHANGE_UNPARK_ZLIFT;
|
2089
|
|
-
|
2090
|
|
- active_extruder_parked = true;
|
2091
|
|
- delayed_move_time = 0;
|
|
2068
|
+ // Set the new active extruder and position
|
|
2069
|
+ active_extruder = tmp_extruder;
|
|
2070
|
+ axis_is_at_home(X_AXIS); //this function updates X min/max values.
|
|
2071
|
+ current_position[X_AXIS] = inactive_x_carriage_pos;
|
|
2072
|
+ inactive_x_carriage_pos = tmp_x_pos;
|
2092
|
2073
|
#else
|
2093
|
2074
|
// Offset extruder (only by XY)
|
2094
|
2075
|
int i;
|
|
@@ -2294,40 +2275,6 @@ void prepare_move()
|
2294
|
2275
|
active_extruder);
|
2295
|
2276
|
}
|
2296
|
2277
|
#else
|
2297
|
|
-
|
2298
|
|
-#if defined(DUAL_X_CARRIAGE)
|
2299
|
|
- if (active_extruder_parked)
|
2300
|
|
- {
|
2301
|
|
- if (current_position[E_AXIS] == destination[E_AXIS])
|
2302
|
|
- {
|
2303
|
|
- // this is a travel move
|
2304
|
|
-#ifdef TOOLCHANGE_UNPARK_SKIP_TRAVEL_MOVES
|
2305
|
|
- if (delayed_move_time != 0xFFFFFFFFUL)
|
2306
|
|
- {
|
2307
|
|
- // skip this move but still update current_position in main so that it can
|
2308
|
|
- // be used as starting position before extrusion (but not in planner)
|
2309
|
|
- memcpy(current_position, destination, sizeof(current_position));
|
2310
|
|
- if (destination[Z_AXIS] > raised_parked_position[Z_AXIS])
|
2311
|
|
- raised_parked_position[Z_AXIS] = destination[Z_AXIS];
|
2312
|
|
- delayed_move_time = millis();
|
2313
|
|
- return;
|
2314
|
|
- }
|
2315
|
|
- delayed_move_time = 0;
|
2316
|
|
-#else
|
2317
|
|
- // this will cause the unpark code below to execute the specified lift in moving to the initial (travel move) position.
|
2318
|
|
- memcpy(current_position, destination, sizeof(current_position));
|
2319
|
|
-#endif
|
2320
|
|
- }
|
2321
|
|
- // unpark extruder: 1) raise, 2) move into starting XY position, 3) lower
|
2322
|
|
- 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);
|
2323
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS],
|
2324
|
|
- current_position[E_AXIS], min(max_feedrate[X_AXIS],max_feedrate[Y_AXIS]), active_extruder);
|
2325
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS],
|
2326
|
|
- current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
|
2327
|
|
- active_extruder_parked = false;
|
2328
|
|
- }
|
2329
|
|
-#endif //DUAL_X_CARRIAGE
|
2330
|
|
-
|
2331
|
2278
|
// Do not use feedmultiply for E or Z only moves
|
2332
|
2279
|
if( (current_position[X_AXIS] == destination [X_AXIS]) && (current_position[Y_AXIS] == destination [Y_AXIS])) {
|
2333
|
2280
|
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()
|
2447
|
2394
|
WRITE(E0_ENABLE_PIN,oldstatus);
|
2448
|
2395
|
}
|
2449
|
2396
|
#endif
|
2450
|
|
- #if defined(DUAL_X_CARRIAGE) && defined(TOOLCHANGE_UNPARK_SKIP_TRAVEL_MOVES)
|
2451
|
|
- // handle delayed move timeout
|
2452
|
|
- if (delayed_move_time != 0 && (millis() - delayed_move_time) > 1000)
|
2453
|
|
- {
|
2454
|
|
- // travel moves have been received so enact them
|
2455
|
|
- delayed_move_time = 0xFFFFFFFFUL; // force moves to be done
|
2456
|
|
- memcpy(destination,current_position,sizeof(destination));
|
2457
|
|
- prepare_move();
|
2458
|
|
- }
|
2459
|
|
- #endif
|
2460
|
2397
|
check_axes_activity();
|
2461
|
2398
|
}
|
2462
|
2399
|
|