From fbbe4b4cb032571700a46fa4633e501004840023 Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Mon, 15 Apr 2024 02:34:47 +0200 Subject: [PATCH] Add software focus capability to Ruida driver This feature is not configurable at the moment; we could make it configurable if needed. Tested on an OMTech Polar with a Ruida 6442s controller. --- .../thomas_oster/liblasercut/drivers/Ruida.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) 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 bb08111c..5e0eea84 100644 --- a/src/main/java/de/thomas_oster/liblasercut/drivers/Ruida.java +++ b/src/main/java/de/thomas_oster/liblasercut/drivers/Ruida.java @@ -583,7 +583,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)) @@ -643,13 +642,23 @@ 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); + stream.hex("800B").absoluteMM(focus); + // frequency stream.hex("c660").byteint(part_number).hex("00").longint(prop.getFrequency()); // color - red for now @@ -682,6 +691,10 @@ public void writeJobCode(LaserJob job, ProgressListener pl) throws IOException { currentSpeed = -1; } + // move Z axis back to 0 + // TODO: home before job + stream.hex("800B").absoluteMM(0); + /* work interval */ stream.hex("DA010620").longint(travel_distance).longint(travel_distance); /* stop */