From c47e07d129106b513c0787555139e9fe82527138 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 3 Dec 2016 00:27:10 -0600 Subject: [PATCH] Fix Dual X software endstops --- Marlin/Marlin_main.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 7fbc4f6c2..4e7a1b8f3 100755 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1349,25 +1349,33 @@ void update_software_endstops(AxisEnum axis) { float offs = LOGICAL_POSITION(0, axis); #if ENABLED(DUAL_X_CARRIAGE) + bool did_update = false; if (axis == X_AXIS) { + + // In Dual X mode hotend_offset[X] is T1's home position float dual_max_x = max(hotend_offset[X_AXIS][1], X2_MAX_POS); + if (active_extruder != 0) { + // T1 can move from X2_MIN_POS to X2_MAX_POS or X2 home position (whichever is larger) soft_endstop_min[X_AXIS] = X2_MIN_POS + offs; soft_endstop_max[X_AXIS] = dual_max_x + offs; - return; } else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) { + // 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) + offs; soft_endstop_max[X_AXIS] = min(base_max_pos(X_AXIS), dual_max_x - duplicate_extruder_x_offset) + offs; - return; + } + else { + // In other modes, T0 can move from X_MIN_POS to X_MAX_POS + soft_endstop_min[axis] = base_min_pos(axis) + offs; + soft_endstop_max[axis] = base_max_pos(axis) + offs; } } - else - #endif - { + #else soft_endstop_min[axis] = base_min_pos(axis) + offs; soft_endstop_max[axis] = base_max_pos(axis) + offs; - } + #endif #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) {