Skip to content

Commit

Permalink
Add software focus capability to Ruida driver
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
TheAssassin committed Apr 15, 2024
1 parent 81df3d3 commit fbbe4b4
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/main/java/de/thomas_oster/liblasercut/drivers/Ruida.java
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit fbbe4b4

Please sign in to comment.