Skip to content
Snippets Groups Projects
Commit 6abc69be authored by Michael Adams's avatar Michael Adams
Browse files

Add configurable option to blank laser during G0 rapid moves. Fixes issues in...

Add configurable option to blank laser during G0 rapid moves. Fixes issues in PR #38 for Smoothie boards
parent 4a455f69
No related branches found
No related tags found
No related merge requests found
......@@ -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 = "Blank laser during non-laser 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);
}
}
......
......@@ -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]);
}
......
......@@ -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]);
}
......
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