diff --git a/src/com/t_oster/liblasercut/drivers/GenericGcodeDriver.java b/src/com/t_oster/liblasercut/drivers/GenericGcodeDriver.java index 7fe9b39efd470bbec955bba85a05501bb28ec2f4..eb3acd80af6c8f0412e8395bd52c9d657db863a2 100644 --- a/src/com/t_oster/liblasercut/drivers/GenericGcodeDriver.java +++ b/src/com/t_oster/liblasercut/drivers/GenericGcodeDriver.java @@ -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_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_BLANK_LASER_DURING_RAPIDS = "Force laser off during G0 moves"; protected static Locale FORMAT_LOCALE = Locale.US; @@ -294,6 +295,18 @@ public class GenericGcodeDriver extends LaserCutter { this.travel_speed = travel_speed; } + protected boolean blankLaserDuringRapids = false; + + public boolean getBlankLaserDuringRapids() + { + return blankLaserDuringRapids; + } + + public void setBlankLaserDuringRapids(boolean blankLaserDuringRapids) + { + this.blankLaserDuringRapids = blankLaserDuringRapids; + } + @Override /** * We do not support Frequency atm, so we return power,speed and focus @@ -362,8 +375,15 @@ public class GenericGcodeDriver extends LaserCutter { x = isFlipXaxis() ? getBedWidth() - Util.px2mm(x, resolution) : Util.px2mm(x, resolution); y = isFlipYaxis() ? getBedHeight() - Util.px2mm(y, resolution) : Util.px2mm(y, resolution); currentSpeed = getTravel_speed(); - currentPower = 0.0; - sendLine("G0 X%f Y%f S0 F%d", x, y, (int) (travel_speed)); + if (blankLaserDuringRapids) + { + 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 { @@ -790,6 +810,7 @@ public void saveJob(java.io.PrintStream fileOutputStream, LaserJob job) throws I SETTING_LINEEND, SETTING_MAX_SPEED, SETTING_TRAVEL_SPEED, + SETTING_BLANK_LASER_DURING_RAPIDS, SETTING_PRE_JOB_GCODE, SETTING_POST_JOB_GCODE, SETTING_RESOLUTIONS, @@ -844,6 +865,8 @@ public void saveJob(java.io.PrintStream fileOutputStream, LaserJob job) throws I return this.isWaitForOKafterEachLine(); } else if (SETTING_SERIAL_TIMEOUT.equals(attribute)) { return this.getSerialTimeout(); + } else if (SETTING_BLANK_LASER_DURING_RAPIDS.equals(attribute)) { + return this.getBlankLaserDuringRapids(); } return null; @@ -891,6 +914,8 @@ public void saveJob(java.io.PrintStream fileOutputStream, LaserJob job) throws I this.setWaitForOKafterEachLine((Boolean) value); } else if (SETTING_SERIAL_TIMEOUT.equals(attribute)) { this.setSerialTimeout((Integer) value); + } else if (SETTING_BLANK_LASER_DURING_RAPIDS.equals(attribute)) { + this.setBlankLaserDuringRapids((Boolean) value); } } diff --git a/src/com/t_oster/liblasercut/drivers/Marlin.java b/src/com/t_oster/liblasercut/drivers/Marlin.java index 6c2a6dc532357b2bf51a2860e684c8a91b2d3d82..00b90e75e8baf538519ce7b76e6c1bc79b562257 100644 --- a/src/com/t_oster/liblasercut/drivers/Marlin.java +++ b/src/com/t_oster/liblasercut/drivers/Marlin.java @@ -42,6 +42,7 @@ public class Marlin extends GenericGcodeDriver { setPreJobGcode(getPreJobGcode()+",G28 XY,M5"); setPostJobGcode(getPostJobGcode()+",M5,G28 XY"); setSerialTimeout(35000); + setBlankLaserDuringRapids(false); //Marlin has no way to upload over the network so remove the upload url text setHttpUploadUrl(""); @@ -65,6 +66,7 @@ public class Marlin extends GenericGcodeDriver { result.remove(GenericGcodeDriver.SETTING_INIT_DELAY); result.remove(GenericGcodeDriver.SETTING_HTTP_UPLOAD_URL); result.remove(GenericGcodeDriver.SETTING_HOST); + result.remove(GenericGcodeDriver.SETTING_BLANK_LASER_DURING_RAPIDS); return result.toArray(new String[0]); } diff --git a/src/com/t_oster/liblasercut/drivers/SmoothieBoard.java b/src/com/t_oster/liblasercut/drivers/SmoothieBoard.java index 6eef4cbcaa268fe6d8fedb2275b3c388e02af9de..5609e320cb32226d2f13c7cb163675f77ba6c696 100644 --- a/src/com/t_oster/liblasercut/drivers/SmoothieBoard.java +++ b/src/com/t_oster/liblasercut/drivers/SmoothieBoard.java @@ -40,6 +40,7 @@ public class SmoothieBoard extends GenericGcodeDriver { setInitDelay(0); setPreJobGcode(getPreJobGcode()+",M3"); setPostJobGcode(getPostJobGcode()+",M5"); + setBlankLaserDuringRapids(false); } @Override @@ -77,6 +78,7 @@ public class SmoothieBoard extends GenericGcodeDriver { result.remove(GenericGcodeDriver.SETTING_BAUDRATE); result.remove(GenericGcodeDriver.SETTING_LINEEND); result.remove(GenericGcodeDriver.SETTING_INIT_DELAY); + result.remove(GenericGcodeDriver.SETTING_BLANK_LASER_DURING_RAPIDS); return result.toArray(new String[0]); }