|
@@ -7883,6 +7883,7 @@ inline void gcode_M999() {
|
7883
|
7883
|
inline void move_extruder_servo(uint8_t e) {
|
7884
|
7884
|
const int angles[2] = SWITCHING_EXTRUDER_SERVO_ANGLES;
|
7885
|
7885
|
MOVE_SERVO(SWITCHING_EXTRUDER_SERVO_NR, angles[e]);
|
|
7886
|
+ delay(500);
|
7886
|
7887
|
}
|
7887
|
7888
|
#endif
|
7888
|
7889
|
|
|
@@ -8029,25 +8030,15 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
|
8029
|
8030
|
|
8030
|
8031
|
#if ENABLED(SWITCHING_EXTRUDER)
|
8031
|
8032
|
// <0 if the new nozzle is higher, >0 if lower. A bigger raise when lower.
|
8032
|
|
- float z_diff = hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder],
|
8033
|
|
- z_raise = 0.3 + (z_diff > 0.0 ? z_diff : 0.0);
|
|
8033
|
+ const float z_diff = hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder],
|
|
8034
|
+ z_raise = 0.3 + (z_diff > 0.0 ? z_diff : 0.0);
|
8034
|
8035
|
|
8035
|
8036
|
// Always raise by some amount (destination copied from current_position earlier)
|
8036
|
|
- float save_Z = destination[Z_AXIS]; // save Z for later on
|
8037
|
|
- destination[Z_AXIS] += z_raise;
|
8038
|
|
- planner.buffer_line_kinematic(destination, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
|
|
8037
|
+ current_position[Z_AXIS] += z_raise;
|
|
8038
|
+ planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
|
8039
|
8039
|
stepper.synchronize();
|
8040
|
8040
|
|
8041
|
8041
|
move_extruder_servo(active_extruder);
|
8042
|
|
- delay(500);
|
8043
|
|
-
|
8044
|
|
- // Move back down, if needed
|
8045
|
|
- if (z_raise != z_diff) {
|
8046
|
|
- destination[Z_AXIS] = current_position[Z_AXIS] + z_diff;
|
8047
|
|
- planner.buffer_line_kinematic(destination, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
|
8048
|
|
- stepper.synchronize();
|
8049
|
|
- }
|
8050
|
|
- destination[Z_AXIS] = save_Z; // restore original Z position so the 'Move to the "old position"' is correct
|
8051
|
8042
|
#endif
|
8052
|
8043
|
|
8053
|
8044
|
/**
|
|
@@ -8098,12 +8089,12 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
|
8098
|
8089
|
#endif
|
8099
|
8090
|
|
8100
|
8091
|
// Adjustments to the current position
|
8101
|
|
- float xydiff[2] = { offset_vec.x, offset_vec.y };
|
|
8092
|
+ const float xydiff[2] = { offset_vec.x, offset_vec.y };
|
8102
|
8093
|
current_position[Z_AXIS] += offset_vec.z;
|
8103
|
8094
|
|
8104
|
8095
|
#else // !ABL_PLANAR
|
8105
|
8096
|
|
8106
|
|
- float xydiff[2] = {
|
|
8097
|
+ const float xydiff[2] = {
|
8107
|
8098
|
hotend_offset[X_AXIS][tmp_extruder] - hotend_offset[X_AXIS][active_extruder],
|
8108
|
8099
|
hotend_offset[Y_AXIS][tmp_extruder] - hotend_offset[Y_AXIS][active_extruder]
|
8109
|
8100
|
};
|
|
@@ -8170,6 +8161,15 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
|
8170
|
8161
|
prepare_move_to_destination();
|
8171
|
8162
|
}
|
8172
|
8163
|
|
|
8164
|
+ #if ENABLED(SWITCHING_EXTRUDER)
|
|
8165
|
+ // Move back down, if needed. (Including when the new tool is higher.)
|
|
8166
|
+ if (z_raise != z_diff) {
|
|
8167
|
+ destination[Z_AXIS] += z_diff;
|
|
8168
|
+ feedrate_mm_s = planner.max_feedrate_mm_s[Z_AXIS];
|
|
8169
|
+ prepare_move_to_destination();
|
|
8170
|
+ }
|
|
8171
|
+ #endif
|
|
8172
|
+
|
8173
|
8173
|
} // (tmp_extruder != active_extruder)
|
8174
|
8174
|
|
8175
|
8175
|
stepper.synchronize();
|