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

Merge pull request #39 from madleech/configurable-laser-blanking-during-rapids

Add configurable option to blank laser during G0 rapid moves.
parents 4a455f69 902de2d9
No related branches found
No related tags found
No related merge requests found
...@@ -64,6 +64,7 @@ public class GenericGcodeDriver extends LaserCutter { ...@@ -64,6 +64,7 @@ public class GenericGcodeDriver extends LaserCutter {
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"; protected static final String SETTING_SERIAL_TIMEOUT = "Milliseconds to wait for response";
protected static final String SETTING_BLANK_LASER_DURING_RAPIDS = "Force laser off during G0 moves";
protected static Locale FORMAT_LOCALE = Locale.US; protected static Locale FORMAT_LOCALE = Locale.US;
...@@ -294,6 +295,18 @@ public class GenericGcodeDriver extends LaserCutter { ...@@ -294,6 +295,18 @@ public class GenericGcodeDriver extends LaserCutter {
this.travel_speed = travel_speed; this.travel_speed = travel_speed;
} }
protected boolean blankLaserDuringRapids = false;
public boolean getBlankLaserDuringRapids()
{
return blankLaserDuringRapids;
}
public void setBlankLaserDuringRapids(boolean blankLaserDuringRapids)
{
this.blankLaserDuringRapids = blankLaserDuringRapids;
}
@Override @Override
/** /**
* We do not support Frequency atm, so we return power,speed and focus * We do not support Frequency atm, so we return power,speed and focus
...@@ -362,8 +375,15 @@ public class GenericGcodeDriver extends LaserCutter { ...@@ -362,8 +375,15 @@ public class GenericGcodeDriver extends LaserCutter {
x = isFlipXaxis() ? getBedWidth() - Util.px2mm(x, resolution) : Util.px2mm(x, resolution); x = isFlipXaxis() ? getBedWidth() - Util.px2mm(x, resolution) : Util.px2mm(x, resolution);
y = isFlipYaxis() ? getBedHeight() - Util.px2mm(y, resolution) : Util.px2mm(y, resolution); y = isFlipYaxis() ? getBedHeight() - Util.px2mm(y, resolution) : Util.px2mm(y, resolution);
currentSpeed = getTravel_speed(); currentSpeed = getTravel_speed();
currentPower = 0.0; if (blankLaserDuringRapids)
sendLine("G0 X%f Y%f S0 F%d", x, y, (int) (travel_speed)); {
currentPower = 0.0;
sendLine("G0 X%f Y%f F%d S0", x, y, (int) (travel_speed));
}
else
{
sendLine("G0 X%f Y%f F%d", x, y, (int) (travel_speed));
}
} }
protected void line(PrintStream out, double x, double y, double resolution) throws IOException { protected void line(PrintStream out, double x, double y, double resolution) throws IOException {
...@@ -790,6 +810,7 @@ public void saveJob(java.io.PrintStream fileOutputStream, LaserJob job) throws I ...@@ -790,6 +810,7 @@ public void saveJob(java.io.PrintStream fileOutputStream, LaserJob job) throws I
SETTING_LINEEND, SETTING_LINEEND,
SETTING_MAX_SPEED, SETTING_MAX_SPEED,
SETTING_TRAVEL_SPEED, SETTING_TRAVEL_SPEED,
SETTING_BLANK_LASER_DURING_RAPIDS,
SETTING_PRE_JOB_GCODE, SETTING_PRE_JOB_GCODE,
SETTING_POST_JOB_GCODE, SETTING_POST_JOB_GCODE,
SETTING_RESOLUTIONS, SETTING_RESOLUTIONS,
...@@ -844,6 +865,8 @@ public void saveJob(java.io.PrintStream fileOutputStream, LaserJob job) throws I ...@@ -844,6 +865,8 @@ public void saveJob(java.io.PrintStream fileOutputStream, LaserJob job) throws I
return this.isWaitForOKafterEachLine(); return this.isWaitForOKafterEachLine();
} else if (SETTING_SERIAL_TIMEOUT.equals(attribute)) { } else if (SETTING_SERIAL_TIMEOUT.equals(attribute)) {
return this.getSerialTimeout(); return this.getSerialTimeout();
} else if (SETTING_BLANK_LASER_DURING_RAPIDS.equals(attribute)) {
return this.getBlankLaserDuringRapids();
} }
return null; return null;
...@@ -891,6 +914,8 @@ public void saveJob(java.io.PrintStream fileOutputStream, LaserJob job) throws I ...@@ -891,6 +914,8 @@ public void saveJob(java.io.PrintStream fileOutputStream, LaserJob job) throws I
this.setWaitForOKafterEachLine((Boolean) value); this.setWaitForOKafterEachLine((Boolean) value);
} else if (SETTING_SERIAL_TIMEOUT.equals(attribute)) { } else if (SETTING_SERIAL_TIMEOUT.equals(attribute)) {
this.setSerialTimeout((Integer) value); this.setSerialTimeout((Integer) value);
} else if (SETTING_BLANK_LASER_DURING_RAPIDS.equals(attribute)) {
this.setBlankLaserDuringRapids((Boolean) value);
} }
} }
......
...@@ -42,6 +42,7 @@ public class Marlin extends GenericGcodeDriver { ...@@ -42,6 +42,7 @@ public class Marlin extends GenericGcodeDriver {
setPreJobGcode(getPreJobGcode()+",G28 XY,M5"); setPreJobGcode(getPreJobGcode()+",G28 XY,M5");
setPostJobGcode(getPostJobGcode()+",M5,G28 XY"); setPostJobGcode(getPostJobGcode()+",M5,G28 XY");
setSerialTimeout(35000); setSerialTimeout(35000);
setBlankLaserDuringRapids(false);
//Marlin has no way to upload over the network so remove the upload url text //Marlin has no way to upload over the network so remove the upload url text
setHttpUploadUrl(""); setHttpUploadUrl("");
...@@ -65,6 +66,7 @@ public class Marlin extends GenericGcodeDriver { ...@@ -65,6 +66,7 @@ public class Marlin extends GenericGcodeDriver {
result.remove(GenericGcodeDriver.SETTING_INIT_DELAY); result.remove(GenericGcodeDriver.SETTING_INIT_DELAY);
result.remove(GenericGcodeDriver.SETTING_HTTP_UPLOAD_URL); result.remove(GenericGcodeDriver.SETTING_HTTP_UPLOAD_URL);
result.remove(GenericGcodeDriver.SETTING_HOST); result.remove(GenericGcodeDriver.SETTING_HOST);
result.remove(GenericGcodeDriver.SETTING_BLANK_LASER_DURING_RAPIDS);
return result.toArray(new String[0]); return result.toArray(new String[0]);
} }
......
...@@ -40,6 +40,7 @@ public class SmoothieBoard extends GenericGcodeDriver { ...@@ -40,6 +40,7 @@ public class SmoothieBoard extends GenericGcodeDriver {
setInitDelay(0); setInitDelay(0);
setPreJobGcode(getPreJobGcode()+",M3"); setPreJobGcode(getPreJobGcode()+",M3");
setPostJobGcode(getPostJobGcode()+",M5"); setPostJobGcode(getPostJobGcode()+",M5");
setBlankLaserDuringRapids(false);
} }
@Override @Override
...@@ -77,6 +78,7 @@ public class SmoothieBoard extends GenericGcodeDriver { ...@@ -77,6 +78,7 @@ public class SmoothieBoard extends GenericGcodeDriver {
result.remove(GenericGcodeDriver.SETTING_BAUDRATE); result.remove(GenericGcodeDriver.SETTING_BAUDRATE);
result.remove(GenericGcodeDriver.SETTING_LINEEND); result.remove(GenericGcodeDriver.SETTING_LINEEND);
result.remove(GenericGcodeDriver.SETTING_INIT_DELAY); result.remove(GenericGcodeDriver.SETTING_INIT_DELAY);
result.remove(GenericGcodeDriver.SETTING_BLANK_LASER_DURING_RAPIDS);
return result.toArray(new String[0]); return result.toArray(new String[0]);
} }
......
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