Skip to content

Commit fbbe4b4

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 81df3d3 commit fbbe4b4

File tree

1 file changed

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

1 file changed

+15
-2
lines changed

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

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

584584
for (JobPart p : job.getParts())
585585
{
586-
float focus;
587586
boolean engrave = false;
588587

589588
if ((p instanceof RasterPart) || (p instanceof Raster3dPart))
@@ -643,13 +642,23 @@ public void writeJobCode(LaserJob job, ProgressListener pl) throws IOException {
643642
{
644643
LaserProperty pr = cmd.getProperty();
645644
FloatMinMaxPowerSpeedFocusFrequencyProperty prop = (FloatMinMaxPowerSpeedFocusFrequencyProperty) pr;
645+
float focus = prop.getFocus();
646646
if (first_prop) {
647647
first_prop = false;
648648
currentMinPower = cmd_layer_percent("c631", part_number, currentMinPower, prop.getMinPower());
649649
currentMaxPower = cmd_layer_percent("c632", part_number, currentMaxPower, prop.getPower());
650650
// prop speed is in %, ruida speed is in mm/s (0..1000)
651651
currentSpeed = cmd_layer_absoluteMM("c904", part_number, currentSpeed, prop.getSpeed() * getMaxVectorCutSpeed() / 100);
652-
// focus - n/a
652+
653+
// negative focus is not applicable on the test device (uses 6442s)
654+
if (focus <= 0) {
655+
focus = 0;
656+
}
657+
658+
// configure axis velocity, affects move speed of Z axis
659+
stream.hex("c903").absoluteMM(5);
660+
stream.hex("800B").absoluteMM(focus);
661+
653662
// frequency
654663
stream.hex("c660").byteint(part_number).hex("00").longint(prop.getFrequency());
655664
// color - red for now
@@ -682,6 +691,10 @@ public void writeJobCode(LaserJob job, ProgressListener pl) throws IOException {
682691
currentSpeed = -1;
683692
}
684693

694+
// move Z axis back to 0
695+
// TODO: home before job
696+
stream.hex("800B").absoluteMM(0);
697+
685698
/* work interval */
686699
stream.hex("DA010620").longint(travel_distance).longint(travel_distance);
687700
/* stop */

0 commit comments

Comments
 (0)