Skip to content
Snippets Groups Projects
Commit 9239a02b authored by Thomas Oster's avatar Thomas Oster
Browse files

should work now, because of purejavacomm update

parent f474a6bb
No related branches found
No related tags found
No related merge requests found
......@@ -126,7 +126,7 @@ public class Lasersaur extends LaserCutter {
public void setFlipXaxis(boolean flipXaxis) {
this.flipXaxis = flipXaxis;
}
protected String comPort = "/dev/ttyUSB0";
protected String comPort = "ttyUSB0";
/**
* Get the value of port
......@@ -373,32 +373,12 @@ public class Lasersaur extends LaserCutter {
checkJob(job);
job.applyStartPoint();
pl.taskChanged(this, "connecting");
CommPortIdentifier cpi = null;
//since the CommPortIdentifier.getPortIdentifier(String name) method
//is not working as expected, we have to manually find our port.
Enumeration en = CommPortIdentifier.getPortIdentifiers();
while (en.hasMoreElements())
{
Object o = en.nextElement();
if (o instanceof CommPortIdentifier && ((CommPortIdentifier) o).getName().equals(this.getComPort()))
{
cpi = (CommPortIdentifier) o;
break;
}
}
if (cpi == null)
{
throw new Exception("Error: No such COM-Port '"+this.getComPort()+"'");
}
CommPortIdentifier cpi = CommPortIdentifier.getPortIdentifier(this.getComPort());
CommPort tmp = cpi.open("VisiCut", 10000);
if (tmp == null)
{
throw new Exception("Error: Could not Open COM-Port '"+this.getComPort()+"'");
}
if (!(tmp instanceof SerialPort))
{
throw new Exception("Port '"+this.getComPort()+"' is not a serial port.");
}
SerialPort port = (SerialPort) tmp;
port.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
port.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment