|
@@ -595,16 +595,17 @@ void restore_feedrate_and_scaling() {
|
595
|
595
|
// Software endstops are relative to the tool 0 workspace, so
|
596
|
596
|
// the movement limits must be shifted by the tool offset to
|
597
|
597
|
// retain the same physical limit when other tools are selected.
|
598
|
|
- if (old_tool_index != new_tool_index) {
|
599
|
|
- const float offs = hotend_offset[new_tool_index][axis] - hotend_offset[old_tool_index][axis];
|
600
|
|
- soft_endstop.min[axis] += offs;
|
601
|
|
- soft_endstop.max[axis] += offs;
|
602
|
|
- }
|
603
|
|
- else {
|
604
|
|
- const float offs = hotend_offset[active_extruder][axis];
|
|
598
|
+
|
|
599
|
+ if (new_tool_index == old_tool_index || axis == Z_AXIS) { // The Z axis is "special" and shouldn't be modified
|
|
600
|
+ const float offs = (axis == Z_AXIS) ? 0 : hotend_offset[active_extruder][axis];
|
605
|
601
|
soft_endstop.min[axis] = base_min_pos(axis) + offs;
|
606
|
602
|
soft_endstop.max[axis] = base_max_pos(axis) + offs;
|
607
|
603
|
}
|
|
604
|
+ else {
|
|
605
|
+ const float diff = hotend_offset[new_tool_index][axis] - hotend_offset[old_tool_index][axis];
|
|
606
|
+ soft_endstop.min[axis] += diff;
|
|
607
|
+ soft_endstop.max[axis] += diff;
|
|
608
|
+ }
|
608
|
609
|
|
609
|
610
|
#else
|
610
|
611
|
|