use of com.willwinder.universalgcodesender.model.Position in project Universal-G-Code-Sender by winder.
the class GrblUtilsTest method getStatusFromStringVersion1WithoutMachineCoordinateStatusString.
@Test
public void getStatusFromStringVersion1WithoutMachineCoordinateStatusString() {
String status = "<Idle|WPos:4.0,5.0,6.0|WCO:7.0,8.0,9.0|Ov:1,2,3|F:12345.6|FS:12345.7,65432.1|Pn:XYZPDHRS|A:SFMC>";
Capabilities version = new Capabilities();
version.addCapability(GrblCapabilitiesConstants.V1_FORMAT);
UnitUtils.Units unit = UnitUtils.Units.MM;
ControllerStatus controllerStatus = GrblUtils.getStatusFromStatusString(null, status, version, unit);
assertEquals(new Position(11, 13, 15, UnitUtils.Units.MM), controllerStatus.getMachineCoord());
assertEquals(new Position(4, 5, 6, UnitUtils.Units.MM), controllerStatus.getWorkCoord());
assertEquals(new Position(7, 8, 9, UnitUtils.Units.MM), controllerStatus.getWorkCoordinateOffset());
}
use of com.willwinder.universalgcodesender.model.Position in project Universal-G-Code-Sender by winder.
the class GrblUtilsTest method testGetMachinePositionFromStatusString.
/**
* Test of getMachinePositionFromStatusString method, of class GrblUtils.
*/
@Test
public void testGetMachinePositionFromStatusString() {
System.out.println("getMachinePositionFromStatusString");
String status = "<Idle,MPos:5.529,0.560,7.000,WPos:1.529,-5.440,-0.000>";
Capabilities version = new Capabilities();
version.addCapability(GrblCapabilitiesConstants.REAL_TIME);
Position expResult = new Position(5.529, 0.560, 7.000, UnitUtils.Units.UNKNOWN);
Position result = GrblUtils.getMachinePositionFromStatusString(status, version, UnitUtils.Units.UNKNOWN);
assertEquals(expResult, result);
}
use of com.willwinder.universalgcodesender.model.Position in project Universal-G-Code-Sender by winder.
the class GrblUtilsTest method getStatusFromStringVersion1WithCompleteStatusString.
@Test
public void getStatusFromStringVersion1WithCompleteStatusString() {
String status = "<Idle|MPos:1.1,2.2,3.3|WPos:4.4,5.5,6.6|WCO:7.7,8.8,9.9|Ov:1,2,3|F:12345.6|FS:12345.7,65432.1|Pn:XYZPDHRS|A:SFMC>";
Capabilities version = new Capabilities();
version.addCapability(GrblCapabilitiesConstants.V1_FORMAT);
UnitUtils.Units unit = UnitUtils.Units.MM;
ControllerStatus controllerStatus = GrblUtils.getStatusFromStatusString(null, status, version, unit);
assertEquals("Idle", controllerStatus.getState());
assertEquals(new Position(1.1, 2.2, 3.3, UnitUtils.Units.MM), controllerStatus.getMachineCoord());
assertEquals(new Position(4.4, 5.5, 6.6, UnitUtils.Units.MM), controllerStatus.getWorkCoord());
assertEquals(new Position(7.7, 8.8, 9.9, UnitUtils.Units.MM), controllerStatus.getWorkCoordinateOffset());
assertEquals(1, controllerStatus.getOverrides().feed);
assertEquals(2, controllerStatus.getOverrides().rapid);
assertEquals(3, controllerStatus.getOverrides().spindle);
assertEquals(Double.valueOf(12345.7), controllerStatus.getFeedSpeed());
assertEquals(Double.valueOf(65432.1), controllerStatus.getSpindleSpeed());
assertTrue(controllerStatus.getEnabledPins().CycleStart);
assertTrue(controllerStatus.getEnabledPins().Door);
assertTrue(controllerStatus.getEnabledPins().Hold);
assertTrue(controllerStatus.getEnabledPins().SoftReset);
assertTrue(controllerStatus.getEnabledPins().Probe);
assertTrue(controllerStatus.getEnabledPins().X);
assertTrue(controllerStatus.getEnabledPins().Y);
assertTrue(controllerStatus.getEnabledPins().Z);
assertTrue(controllerStatus.getAccessoryStates().Flood);
assertTrue(controllerStatus.getAccessoryStates().Mist);
assertTrue(controllerStatus.getAccessoryStates().SpindleCCW);
assertTrue(controllerStatus.getAccessoryStates().SpindleCW);
}
use of com.willwinder.universalgcodesender.model.Position in project Universal-G-Code-Sender by winder.
the class GrblUtilsTest method testGetWorkPositionFromStatusString.
/**
* Test of getWorkPositionFromStatusString method, of class GrblUtils.
*/
@Test
public void testGetWorkPositionFromStatusString() {
System.out.println("getWorkPositionFromStatusString");
String status = "<Idle,MPos:5.529,0.560,7.000,WPos:1.529,-5.440,-0.000>";
Capabilities version = new Capabilities();
version.addCapability(GrblCapabilitiesConstants.REAL_TIME);
Position expResult = new Position(1.529, -5.440, -0.000, UnitUtils.Units.UNKNOWN);
Position result = GrblUtils.getWorkPositionFromStatusString(status, version, UnitUtils.Units.UNKNOWN);
assertEquals(expResult, result);
}
use of com.willwinder.universalgcodesender.model.Position in project Universal-G-Code-Sender by winder.
the class GcodeParserTest method nonGcodeIgnoresImplicitGcode.
@Test
public void nonGcodeIgnoresImplicitGcode() throws Exception {
GcodeParser gcp = new GcodeParser();
gcp.addCommandProcessor(new CommentProcessor());
GcodeState initialState = new GcodeState();
initialState.currentPoint = new Position(0, 0, 1, MM);
initialState.currentMotionMode = Code.G0;
List<String> result = gcp.preprocessCommand("M05", initialState);
assertEquals(1, result.size());
assertEquals("M05", result.get(0));
}
Aggregations