Merge pull request #5148 from thinkyhead/rc_dual_tool_z_limit

Fix Z raise with DXC_AUTO_PARK_MODE
This commit is contained in:
Scott Lahteine 2016-11-02 21:52:44 -05:00 committed by GitHub
commit 3b6a43f7ad
20 changed files with 81 additions and 68 deletions

View file

@ -313,7 +313,7 @@
// once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
// This is the default power-up mode which can be later using M605. // This is the default power-up mode which can be later using M605.
#define DEFAULT_DUAL_X_CARRIAGE_MODE 0 #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE
// Default settings in "Auto-park Mode" // Default settings in "Auto-park Mode"
#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder

View file

@ -1303,11 +1303,7 @@ bool get_target_extruder_from_command(int code) {
#if ENABLED(DUAL_X_CARRIAGE) #if ENABLED(DUAL_X_CARRIAGE)
#define DXC_FULL_CONTROL_MODE 0 static DualXMode dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
#define DXC_AUTO_PARK_MODE 1
#define DXC_DUPLICATION_MODE 2
static int dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
static float x_home_pos(int extruder) { static float x_home_pos(int extruder) {
if (extruder == 0) if (extruder == 0)
@ -6950,8 +6946,11 @@ inline void gcode_M503() {
*/ */
inline void gcode_M605() { inline void gcode_M605() {
stepper.synchronize(); stepper.synchronize();
if (code_seen('S')) dual_x_carriage_mode = code_value_byte(); if (code_seen('S')) dual_x_carriage_mode = (DualXMode)code_value_byte();
switch (dual_x_carriage_mode) { switch (dual_x_carriage_mode) {
case DXC_FULL_CONTROL_MODE:
case DXC_AUTO_PARK_MODE:
break;
case DXC_DUPLICATION_MODE: case DXC_DUPLICATION_MODE:
if (code_seen('X')) duplicate_extruder_x_offset = max(code_value_axis_units(X_AXIS), X2_MIN_POS - x_home_pos(0)); if (code_seen('X')) duplicate_extruder_x_offset = max(code_value_axis_units(X_AXIS), X2_MIN_POS - x_home_pos(0));
if (code_seen('R')) duplicate_extruder_temp_offset = code_value_temp_diff(); if (code_seen('R')) duplicate_extruder_temp_offset = code_value_temp_diff();
@ -6966,9 +6965,6 @@ inline void gcode_M503() {
SERIAL_CHAR(','); SERIAL_CHAR(',');
SERIAL_ECHOLN(hotend_offset[Y_AXIS][1]); SERIAL_ECHOLN(hotend_offset[Y_AXIS][1]);
break; break;
case DXC_FULL_CONTROL_MODE:
case DXC_AUTO_PARK_MODE:
break;
default: default:
dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE; dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
break; break;
@ -7258,9 +7254,9 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPGM("Dual X Carriage Mode "); SERIAL_ECHOPGM("Dual X Carriage Mode ");
switch (dual_x_carriage_mode) { switch (dual_x_carriage_mode) {
case DXC_DUPLICATION_MODE: SERIAL_ECHOLNPGM("DXC_DUPLICATION_MODE"); break;
case DXC_AUTO_PARK_MODE: SERIAL_ECHOLNPGM("DXC_AUTO_PARK_MODE"); break;
case DXC_FULL_CONTROL_MODE: SERIAL_ECHOLNPGM("DXC_FULL_CONTROL_MODE"); break; 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;
} }
} }
#endif #endif
@ -7305,6 +7301,16 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
current_position[X_AXIS] = LOGICAL_X_POSITION(inactive_extruder_x_pos); current_position[X_AXIS] = LOGICAL_X_POSITION(inactive_extruder_x_pos);
inactive_extruder_x_pos = RAW_X_POSITION(destination[X_AXIS]); inactive_extruder_x_pos = RAW_X_POSITION(destination[X_AXIS]);
break; break;
case DXC_AUTO_PARK_MODE:
// 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;
#if ENABLED(max_software_endstops)
NOMORE(raised_parked_position[Z_AXIS], soft_endstop_max[Z_AXIS]);
#endif
active_extruder_parked = true;
delayed_move_time = 0;
break;
case DXC_DUPLICATION_MODE: case DXC_DUPLICATION_MODE:
active_extruder_parked = (active_extruder == 0); // this triggers the second extruder to move into the duplication position active_extruder_parked = (active_extruder == 0); // this triggers the second extruder to move into the duplication position
if (active_extruder_parked) if (active_extruder_parked)
@ -7314,13 +7320,6 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
inactive_extruder_x_pos = RAW_X_POSITION(destination[X_AXIS]); inactive_extruder_x_pos = RAW_X_POSITION(destination[X_AXIS]);
extruder_duplication_enabled = false; extruder_duplication_enabled = false;
break; break;
default:
// 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;
break;
} }
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
@ -8975,7 +8974,11 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
*/ */
inline bool prepare_move_to_destination_dualx() { inline bool prepare_move_to_destination_dualx() {
if (active_extruder_parked) { if (active_extruder_parked) {
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0) { switch (dual_x_carriage_mode) {
case DXC_FULL_CONTROL_MODE:
break;
case DXC_DUPLICATION_MODE:
if (active_extruder == 0) {
// move duplicate extruder into correct duplication position. // move duplicate extruder into correct duplication position.
planner.set_position_mm( planner.set_position_mm(
LOGICAL_X_POSITION(inactive_extruder_x_pos), LOGICAL_X_POSITION(inactive_extruder_x_pos),
@ -8990,7 +8993,8 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
extruder_duplication_enabled = true; extruder_duplication_enabled = true;
active_extruder_parked = false; active_extruder_parked = false;
} }
else if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE) { // handle unparking of head break;
case DXC_AUTO_PARK_MODE:
if (current_position[E_AXIS] == destination[E_AXIS]) { if (current_position[E_AXIS] == destination[E_AXIS]) {
// This is a travel move (with no extrusion) // This is a travel move (with no extrusion)
// Skip it, but keep track of the current position // Skip it, but keep track of the current position
@ -9008,6 +9012,7 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], PLANNER_XY_FEEDRATE(), active_extruder); planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], PLANNER_XY_FEEDRATE(), active_extruder);
planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], planner.max_feedrate_mm_s[Z_AXIS], active_extruder); planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
active_extruder_parked = false; active_extruder_parked = false;
break;
} }
} }
return true; return true;

View file

@ -194,4 +194,12 @@ enum LCDViewAction {
LCDVIEW_CALL_NO_REDRAW LCDVIEW_CALL_NO_REDRAW
}; };
#if ENABLED(DUAL_X_CARRIAGE)
enum DualXMode {
DXC_FULL_CONTROL_MODE,
DXC_AUTO_PARK_MODE,
DXC_DUPLICATION_MODE
};
#endif
#endif // __ENUM_H__ #endif // __ENUM_H__

View file

@ -313,7 +313,7 @@
// once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
// This is the default power-up mode which can be later using M605. // This is the default power-up mode which can be later using M605.
#define DEFAULT_DUAL_X_CARRIAGE_MODE 0 #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE
// Default settings in "Auto-park Mode" // Default settings in "Auto-park Mode"
#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder

View file

@ -313,7 +313,7 @@
// once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
// This is the default power-up mode which can be later using M605. // This is the default power-up mode which can be later using M605.
#define DEFAULT_DUAL_X_CARRIAGE_MODE 0 #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE
// Default settings in "Auto-park Mode" // Default settings in "Auto-park Mode"
#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder

View file

@ -313,7 +313,7 @@
// once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
// This is the default power-up mode which can be later using M605. // This is the default power-up mode which can be later using M605.
#define DEFAULT_DUAL_X_CARRIAGE_MODE 0 #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE
// Default settings in "Auto-park Mode" // Default settings in "Auto-park Mode"
#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder

View file

@ -313,7 +313,7 @@
// once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
// This is the default power-up mode which can be later using M605. // This is the default power-up mode which can be later using M605.
#define DEFAULT_DUAL_X_CARRIAGE_MODE 0 #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE
// Default settings in "Auto-park Mode" // Default settings in "Auto-park Mode"
#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder

View file

@ -319,7 +319,7 @@
// once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
// This is the default power-up mode which can be later using M605. // This is the default power-up mode which can be later using M605.
#define DEFAULT_DUAL_X_CARRIAGE_MODE 0 #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE
// Default settings in "Auto-park Mode" // Default settings in "Auto-park Mode"
#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder

View file

@ -313,7 +313,7 @@
// once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
// This is the default power-up mode which can be later using M605. // This is the default power-up mode which can be later using M605.
#define DEFAULT_DUAL_X_CARRIAGE_MODE 0 #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE
// Default settings in "Auto-park Mode" // Default settings in "Auto-park Mode"
#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder

View file

@ -313,7 +313,7 @@
// once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
// This is the default power-up mode which can be later using M605. // This is the default power-up mode which can be later using M605.
#define DEFAULT_DUAL_X_CARRIAGE_MODE 0 #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE
// Default settings in "Auto-park Mode" // Default settings in "Auto-park Mode"
#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder

View file

@ -313,7 +313,7 @@
// once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
// This is the default power-up mode which can be later using M605. // This is the default power-up mode which can be later using M605.
#define DEFAULT_DUAL_X_CARRIAGE_MODE 0 #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE
// Default settings in "Auto-park Mode" // Default settings in "Auto-park Mode"
#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder

View file

@ -321,7 +321,7 @@
// once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
// This is the default power-up mode which can be later using M605. // This is the default power-up mode which can be later using M605.
#define DEFAULT_DUAL_X_CARRIAGE_MODE 0 #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE
// Default settings in "Auto-park Mode" // Default settings in "Auto-park Mode"
#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder

View file

@ -313,7 +313,7 @@
// once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
// This is the default power-up mode which can be later using M605. // This is the default power-up mode which can be later using M605.
#define DEFAULT_DUAL_X_CARRIAGE_MODE 0 #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE
// Default settings in "Auto-park Mode" // Default settings in "Auto-park Mode"
#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder

View file

@ -313,7 +313,7 @@
// once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
// This is the default power-up mode which can be later using M605. // This is the default power-up mode which can be later using M605.
#define DEFAULT_DUAL_X_CARRIAGE_MODE 0 #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE
// Default settings in "Auto-park Mode" // Default settings in "Auto-park Mode"
#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder

View file

@ -313,7 +313,7 @@
// once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
// This is the default power-up mode which can be later using M605. // This is the default power-up mode which can be later using M605.
#define DEFAULT_DUAL_X_CARRIAGE_MODE 0 #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE
// Default settings in "Auto-park Mode" // Default settings in "Auto-park Mode"
#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder

View file

@ -313,7 +313,7 @@
// once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
// This is the default power-up mode which can be later using M605. // This is the default power-up mode which can be later using M605.
#define DEFAULT_DUAL_X_CARRIAGE_MODE 0 #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE
// Default settings in "Auto-park Mode" // Default settings in "Auto-park Mode"
#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder

View file

@ -318,7 +318,7 @@
// once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
// This is the default power-up mode which can be later using M605. // This is the default power-up mode which can be later using M605.
#define DEFAULT_DUAL_X_CARRIAGE_MODE 0 #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE
// Default settings in "Auto-park Mode" // Default settings in "Auto-park Mode"
#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder

View file

@ -313,7 +313,7 @@
// once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
// This is the default power-up mode which can be later using M605. // This is the default power-up mode which can be later using M605.
#define DEFAULT_DUAL_X_CARRIAGE_MODE 0 #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE
// Default settings in "Auto-park Mode" // Default settings in "Auto-park Mode"
#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder

View file

@ -313,7 +313,7 @@
// once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
// This is the default power-up mode which can be later using M605. // This is the default power-up mode which can be later using M605.
#define DEFAULT_DUAL_X_CARRIAGE_MODE 0 #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE
// Default settings in "Auto-park Mode" // Default settings in "Auto-park Mode"
#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder

View file

@ -313,7 +313,7 @@
// once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
// This is the default power-up mode which can be later using M605. // This is the default power-up mode which can be later using M605.
#define DEFAULT_DUAL_X_CARRIAGE_MODE 0 #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE
// Default settings in "Auto-park Mode" // Default settings in "Auto-park Mode"
#define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder #define TOOLCHANGE_PARK_ZLIFT 0.2 // the distance to raise Z axis when parking an extruder