Skip to content
Snippets Groups Projects
Commit b544a800 authored by quillford's avatar quillford
Browse files

setting for serial timeout

can be adjusted if user is finding they constantly get `java.io.IOException: Underlying input stream returned zero bytes `
parent 985a5f7f
No related branches found
No related tags found
No related merge requests found
...@@ -59,6 +59,7 @@ public class GenericGcodeDriver extends LaserCutter { ...@@ -59,6 +59,7 @@ public class GenericGcodeDriver extends LaserCutter {
protected static final String SETTING_IDENTIFICATION_STRING = "Board Identification String (startsWith)"; protected static final String SETTING_IDENTIFICATION_STRING = "Board Identification String (startsWith)";
protected static final String SETTING_WAIT_FOR_OK = "Wait for OK after each line (interactive mode)"; protected static final String SETTING_WAIT_FOR_OK = "Wait for OK after each line (interactive mode)";
protected static final String SETTING_INIT_DELAY = "Seconds to wait for board reset (Serial)"; protected static final String SETTING_INIT_DELAY = "Seconds to wait for board reset (Serial)";
protected static final String SETTING_SERIAL_TIMEOUT = "Milliseconds to wait for response";
private String lineend = "LF"; private String lineend = "LF";
...@@ -164,6 +165,18 @@ public class GenericGcodeDriver extends LaserCutter { ...@@ -164,6 +165,18 @@ public class GenericGcodeDriver extends LaserCutter {
this.postJobGcode = postJobGcode; this.postJobGcode = postJobGcode;
} }
protected int serialTimeout= 15000;
public int getSerialTimeout()
{
return serialTimeout;
}
public void setSerialTimeout(int serialTimeout)
{
this.serialTimeout = serialTimeout;
}
/** /**
* What is expected to be received after serial/telnet connection * What is expected to be received after serial/telnet connection
* Used e.g. for auto-detecting the serial port. * Used e.g. for auto-detecting the serial port.
...@@ -409,7 +422,7 @@ public class GenericGcodeDriver extends LaserCutter { ...@@ -409,7 +422,7 @@ public class GenericGcodeDriver extends LaserCutter {
port = i.open("VisiCut", 1000); port = i.open("VisiCut", 1000);
try try
{ {
port.enableReceiveTimeout(15000); port.enableReceiveTimeout(getSerialTimeout());
} }
catch (UnsupportedCommOperationException e) catch (UnsupportedCommOperationException e)
{ {
...@@ -662,7 +675,8 @@ public class GenericGcodeDriver extends LaserCutter { ...@@ -662,7 +675,8 @@ public class GenericGcodeDriver extends LaserCutter {
SETTING_PRE_JOB_GCODE, SETTING_PRE_JOB_GCODE,
SETTING_POST_JOB_GCODE, SETTING_POST_JOB_GCODE,
SETTING_RESOLUTIONS, SETTING_RESOLUTIONS,
SETTING_WAIT_FOR_OK SETTING_WAIT_FOR_OK,
SETTING_SERIAL_TIMEOUT
}; };
@Override @Override
...@@ -702,6 +716,8 @@ public class GenericGcodeDriver extends LaserCutter { ...@@ -702,6 +716,8 @@ public class GenericGcodeDriver extends LaserCutter {
return this.getSupportedResolutions(); return this.getSupportedResolutions();
} else if (SETTING_WAIT_FOR_OK.equals(attribute)) { } else if (SETTING_WAIT_FOR_OK.equals(attribute)) {
return this.isWaitForOKafterEachLine(); return this.isWaitForOKafterEachLine();
} else if (SETTING_SERIAL_TIMEOUT.equals(attribute)) {
return this.getSerialTimeout();
} }
return null; return null;
...@@ -739,6 +755,8 @@ public class GenericGcodeDriver extends LaserCutter { ...@@ -739,6 +755,8 @@ public class GenericGcodeDriver extends LaserCutter {
this.setSupportedResolutions((String) value); this.setSupportedResolutions((String) value);
} else if (SETTING_WAIT_FOR_OK.equals(attribute)) { } else if (SETTING_WAIT_FOR_OK.equals(attribute)) {
this.setWaitForOKafterEachLine((Boolean) value); this.setWaitForOKafterEachLine((Boolean) value);
} else if (SETTING_SERIAL_TIMEOUT.equals(attribute)) {
this.setSerialTimeout((Integer) value);
} }
} }
......
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