Skip to content

Commit e150aee

Browse files
committed
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.
1 parent 1312d60 commit e150aee

File tree

1 file changed

+18
-2
lines changed
  • src/main/java/de/thomas_oster/liblasercut/drivers

1 file changed

+18
-2
lines changed

src/main/java/de/thomas_oster/liblasercut/drivers/Ruida.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,6 @@ public void writeJobCode(LaserJob job, ProgressListener pl) throws IOException {
591591

592592
for (JobPart p : job.getParts())
593593
{
594-
float focus;
595594
boolean engrave = false;
596595

597596
if ((p instanceof RasterPart) || (p instanceof Raster3dPart))
@@ -651,13 +650,27 @@ public void writeJobCode(LaserJob job, ProgressListener pl) throws IOException {
651650
{
652651
LaserProperty pr = cmd.getProperty();
653652
FloatMinMaxPowerSpeedFocusFrequencyProperty prop = (FloatMinMaxPowerSpeedFocusFrequencyProperty) pr;
653+
float focus = prop.getFocus();
654654
if (first_prop) {
655655
first_prop = false;
656656
currentMinPower = cmd_layer_percent("c631", part_number, currentMinPower, prop.getMinPower());
657657
currentMaxPower = cmd_layer_percent("c632", part_number, currentMaxPower, prop.getPower());
658658
// prop speed is in %, ruida speed is in mm/s (0..1000)
659659
currentSpeed = cmd_layer_absoluteMM("c904", part_number, currentSpeed, prop.getSpeed() * getMaxVectorCutSpeed() / 100);
660-
// focus - n/a
660+
661+
// negative focus is not applicable on the test device (uses 6442s)
662+
if (focus <= 0) {
663+
focus = 0;
664+
}
665+
666+
// configure axis velocity, affects move speed of Z axis
667+
stream.hex("c903").absoluteMM(5);
668+
// move Z axis to desired focus valueu
669+
// the value depends on the device
670+
// on an OMTech Polar, for instance, focus needs to be set to 17 - <thickness>
671+
// for instance, for a 3mm thick material, one needs to configure a focus of 14.0
672+
stream.hex("800B").absoluteMM(focus);
673+
661674
// frequency
662675
stream.hex("c660").byteint(part_number).hex("00").longint(prop.getFrequency());
663676
// color - red for now
@@ -690,6 +703,9 @@ public void writeJobCode(LaserJob job, ProgressListener pl) throws IOException {
690703
currentSpeed = -1;
691704
}
692705

706+
// move Z axis back to 0
707+
stream.hex("800B").absoluteMM(0);
708+
693709
/* work interval */
694710
stream.hex("DA010620").longint(travel_distance).longint(travel_distance);
695711
/* stop */

0 commit comments

Comments
 (0)