Skip to content

Commit

Permalink
Fixed X travel distance in XYZ probing (#2292)
Browse files Browse the repository at this point in the history
When starting the probe of Y it would move it too far on the X axis using the distance setting. This was wrong, it should be moved to the origin X (0).
  • Loading branch information
breiler committed Aug 20, 2023
1 parent eea92e9 commit 5917269
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ This file is part of Universal Gcode Sender (UGS).

import com.google.common.base.Preconditions;
import com.willwinder.ugs.nbp.lib.lookup.CentralLookup;
import com.willwinder.ugs.platform.probe.renderable.ProbePreviewManager;
import com.willwinder.universalgcodesender.Utils;
import com.willwinder.universalgcodesender.gcode.util.GcodeUtils;
import com.willwinder.universalgcodesender.listeners.ControllerState;
Expand All @@ -32,7 +31,6 @@ This file is part of Universal Gcode Sender (UGS).
import com.willwinder.universalgcodesender.model.WorkCoordinateSystem;
import com.willwinder.universalgcodesender.model.events.ControllerStateEvent;
import com.willwinder.universalgcodesender.model.events.ProbeEvent;
import org.openide.util.Lookup;
import org.openide.util.lookup.ServiceProvider;

import java.util.ArrayList;
Expand Down Expand Up @@ -292,7 +290,7 @@ private void performXYZProbeInternal(int stepNumber) throws IllegalStateExceptio
case 4: {
gcode(g0Abs + " X" + -params.xSpacing);
gcode(g0Abs + " Y" + -params.ySpacing);
gcode(g0Abs + " X" + params.xSpacing);
gcode(g0Abs + " X0");

// Y
probe('Y', params.feedRate, params.ySpacing, params.units);
Expand Down Expand Up @@ -441,7 +439,7 @@ private void updateWCS(WorkCoordinateSystem wcs, Double x, Double y, Double z) t
sb.append("Z").append(Utils.formatter.format(z));
}

gcode(String.format(WCS_PATTERN, wcs.getPValue(), sb.toString()));
gcode(String.format(WCS_PATTERN, wcs.getPValue(), sb));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ public void testProbeServiceXYZ() throws Exception {
ps.UGSEvent(new ControllerStateEvent(ControllerState.IDLE, ControllerState.RUN));

InOrder order = inOrder(backend);

order.verify(backend, times(1)).sendGcodeCommand(true, "G10 L20 P2 X0Y0Z0");

// Probe Z axis
Expand All @@ -172,7 +171,7 @@ public void testProbeServiceXYZ() throws Exception {
order.verify(backend, times(1)).probe("X", pc.feedRateSlow, pc.xSpacing, pc.units);
order.verify(backend, times(1)).sendGcodeCommand(true, "G90 G21 G0 X" + -pc.xSpacing);
order.verify(backend, times(1)).sendGcodeCommand(true, "G90 G21 G0 Y" + -pc.ySpacing);
order.verify(backend, times(1)).sendGcodeCommand(true, "G90 G21 G0 X" + pc.xSpacing);
order.verify(backend, times(1)).sendGcodeCommand(true, "G90 G21 G0 X0");

// probe Y axis
order.verify(backend, times(1)).probe("Y", pc.feedRate, pc.ySpacing, pc.units);
Expand Down

0 comments on commit 5917269

Please sign in to comment.