diff --git a/src/main/java/de/thomas_oster/liblasercut/drivers/Ruida.java b/src/main/java/de/thomas_oster/liblasercut/drivers/Ruida.java index 14672b9b..b9956b2e 100644 --- a/src/main/java/de/thomas_oster/liblasercut/drivers/Ruida.java +++ b/src/main/java/de/thomas_oster/liblasercut/drivers/Ruida.java @@ -591,7 +591,6 @@ public void writeJobCode(LaserJob job, ProgressListener pl) throws IOException { for (JobPart p : job.getParts()) { - float focus; boolean engrave = false; if ((p instanceof RasterPart) || (p instanceof Raster3dPart)) @@ -651,13 +650,27 @@ public void writeJobCode(LaserJob job, ProgressListener pl) throws IOException { { LaserProperty pr = cmd.getProperty(); FloatMinMaxPowerSpeedFocusFrequencyProperty prop = (FloatMinMaxPowerSpeedFocusFrequencyProperty) pr; + float focus = prop.getFocus(); if (first_prop) { first_prop = false; currentMinPower = cmd_layer_percent("c631", part_number, currentMinPower, prop.getMinPower()); currentMaxPower = cmd_layer_percent("c632", part_number, currentMaxPower, prop.getPower()); // prop speed is in %, ruida speed is in mm/s (0..1000) currentSpeed = cmd_layer_absoluteMM("c904", part_number, currentSpeed, prop.getSpeed() * getMaxVectorCutSpeed() / 100); - // focus - n/a + + // negative focus is not applicable on the test device (uses 6442s) + if (focus <= 0) { + focus = 0; + } + + // configure axis velocity, affects move speed of Z axis + stream.hex("c903").absoluteMM(5); + // move Z axis to desired focus valueu + // the value depends on the device + // on an OMTech Polar, for instance, focus needs to be set to 17 - + // for instance, for a 3mm thick material, one needs to configure a focus of 14.0 + stream.hex("800B").absoluteMM(focus); + // frequency stream.hex("c660").byteint(part_number).hex("00").longint(prop.getFrequency()); // color - red for now @@ -690,6 +703,9 @@ public void writeJobCode(LaserJob job, ProgressListener pl) throws IOException { currentSpeed = -1; } + // move Z axis back to 0 + stream.hex("800B").absoluteMM(0); + /* work interval */ stream.hex("DA010620").longint(travel_distance).longint(travel_distance); /* stop */