Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruida software focus #219

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions src/main/java/de/thomas_oster/liblasercut/drivers/Ruida.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
/* for serial/usb i/o */
import java.util.concurrent.TimeUnit;

import de.thomas_oster.liblasercut.properties.FloatMinMaxPowerSpeedFrequencyProperty;
import de.thomas_oster.liblasercut.properties.FloatMinMaxPowerSpeedFocusFrequencyProperty;
import de.thomas_oster.liblasercut.properties.LaserProperty;
import purejavacomm.CommPort;
import purejavacomm.CommPortIdentifier;
Expand Down Expand Up @@ -178,19 +178,19 @@ public Ruida clone() {
@Override
public LaserProperty getLaserPropertyForVectorPart()
{
return new FloatMinMaxPowerSpeedFrequencyProperty();
return new FloatMinMaxPowerSpeedFocusFrequencyProperty();
}

@Override
public LaserProperty getLaserPropertyForRasterPart()
{
return new FloatMinMaxPowerSpeedFrequencyProperty();
return new FloatMinMaxPowerSpeedFocusFrequencyProperty();
}

@Override
public LaserProperty getLaserPropertyForRaster3dPart()
{
return new FloatMinMaxPowerSpeedFrequencyProperty();
return new FloatMinMaxPowerSpeedFocusFrequencyProperty();
}

@Override
Expand Down Expand Up @@ -582,7 +582,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 @@ -641,14 +640,28 @@ public void writeJobCode(LaserJob job, ProgressListener pl) throws IOException {
case SETPROPERTY:
{
LaserProperty pr = cmd.getProperty();
FloatMinMaxPowerSpeedFrequencyProperty prop = (FloatMinMaxPowerSpeedFrequencyProperty) pr;
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 - <thickness>
// 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
Expand Down Expand Up @@ -681,6 +694,11 @@ public void writeJobCode(LaserJob job, ProgressListener pl) throws IOException {
currentSpeed = -1;
}

// configure axis velocity, affects move speed of Z axis
stream.hex("c903").absoluteMM(5);
// move Z axis back to 0
stream.hex("800B").absoluteMM(0);

/* work interval */
stream.hex("DA010620").longint(travel_distance).longint(travel_distance);
/* stop */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@
* Add 'min power' to FloatPowerSpeedFrequencyProperty
*/

public class FloatMinMaxPowerSpeedFrequencyProperty extends FloatPowerSpeedFrequencyProperty {
public class FloatMinMaxPowerSpeedFocusFrequencyProperty extends FloatPowerSpeedFocusFrequencyProperty {

private float min_power = 10.0f;
private static final String MIN_POWER = "min power";

public FloatMinMaxPowerSpeedFrequencyProperty()
public FloatMinMaxPowerSpeedFocusFrequencyProperty()
{
super();
}

public FloatMinMaxPowerSpeedFrequencyProperty(LaserProperty o)
public FloatMinMaxPowerSpeedFocusFrequencyProperty(LaserProperty o)
{
for (String k : o.getPropertyKeys())
{
Expand All @@ -48,7 +48,7 @@ public FloatMinMaxPowerSpeedFrequencyProperty(LaserProperty o)
}
}
}

/**
* Get the value of min power
*
Expand Down Expand Up @@ -128,9 +128,9 @@ public void setProperty(String name, Object value)
}

@Override
public FloatMinMaxPowerSpeedFrequencyProperty clone()
public FloatMinMaxPowerSpeedFocusFrequencyProperty clone()
{
FloatMinMaxPowerSpeedFrequencyProperty result = new FloatMinMaxPowerSpeedFrequencyProperty();
FloatMinMaxPowerSpeedFocusFrequencyProperty result = new FloatMinMaxPowerSpeedFocusFrequencyProperty();
Object p;
for (String s:this.getPropertyKeys())
{
Expand All @@ -147,10 +147,10 @@ public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof FloatMinMaxPowerSpeedFrequencyProperty)) {
if (!(obj instanceof FloatMinMaxPowerSpeedFocusFrequencyProperty)) {
return false;
}
final FloatMinMaxPowerSpeedFrequencyProperty other = (FloatMinMaxPowerSpeedFrequencyProperty) obj;
final FloatMinMaxPowerSpeedFocusFrequencyProperty other = (FloatMinMaxPowerSpeedFocusFrequencyProperty) obj;
if (this.min_power != other.min_power) {
return false;
}
Expand All @@ -167,7 +167,7 @@ public int hashCode() {

public String toString()
{
return "FloatMinMaxPowerSpeedFrequencyProperty(min power="+getMinPower()+", max power="+getPower()+", speed="+getSpeed()+", frequency="+getFrequency()+")";
return "FloatMinMaxPowerSpeedFocusFrequencyProperty(min power="+getMinPower()+", max power="+getPower()+", speed="+getSpeed()+", focus="+getFocus()+", frequency="+getFrequency()+")";
}

}
2 changes: 1 addition & 1 deletion test-output/de.thomas_oster.liblasercut.drivers.Ruida.out
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Ò›úâ‹p ým{ý‰z‹‰Ò‰p‰‰‰‰‰‰‰‰‰‰p ‰‰‰ õ‰‰‰‰‰p‰‰鉉 …ùpÙ‰‰‰ õ‰‰‰‰‰pY‰‰鉉 …ùp‰ ‰ ‰‰‰‰‰‰‰‰‰‰p‰Ä«‹pÛ‰‰‰‰ õ‰‰‰‰‰p[‰‰‰鉉 …ùpi‰‰‰‰ õ‰‰‰‰‰p뉉‰鉉 …ùÐ9‰wwл‰wwB‰‰‰5ÉÐ鉉‰‰‰ ý‰‰‰íÄI‰‰Ä ‰Ä‹‰Ä B‹‰‰5ÉÐ wwЋwwÄ Ä™‰‚‰‰‰ õ‰‰‰ õ¢‰‰ ϱ‰‰ …ù¢‰‰ …ù‰‰‰‰‰‚‰‰鉉‰‰‰¢‰‰[/‰‰‰/Ñ¢‰‰Û}‰‰ —é"‰{"w±m"‰;/Ñ¢‰‰[/‰‰‹m‘¢‰‰鉉 …ùpÛ ‰‰‰‰‰‰‡_p[ ‰‰‰U‰‰‰™]pi ‰‰‰‰‰‰‡_pë ‰‰‰U‰‰‰™]Ð9 wwл wwB ‰‰5ÉÐé ‰‰‰‰ ýď ‰‰‰‰íÄI ‹Ä Ä‹ Ä B‹‰‰5ÉÐ wwЋwwÄ Ä™‰‚‰‰‰‰‰‰‡_¢‰‰‰q‰‰‰‡_¢‰‰‰W‰‰‰‡_¢‰‰‰›‰‰‰‡_¢‰‰‰£‰‰‰‡_¢‰‰‰U‰‰‰‡_‚‰‰‰U‰‰‰ƒ¢‰‰‰£‰‰‰ƒ¢‰‰‰M‰‰‰ƒ¢‰‰‰W‰‰‰ƒ¢‰‰‰¥‰‰‰ƒ¢‰‰‰‰‰‰ƒ‚‰‰‰‰‰‰5¢‰‰‰U‰‰‰5‚‰‰‰U‰‰‰ù¢‰‰‰q‰‰‰ù¢‰‰‰‰‰‰ù‚‰‰‰‰‰‰™«¢‰‰‰U‰‰‰™«‚‰‰‰U‰‰‰™]¢‰‰‰q‰‰‰™]¢‰‰‰‰‰‰™]pÛ‹‰‰‰™]‰‰‰—Op[‹‰‰‰—‰‰‰©Mpi‹‰‰‰™]‰‰‰—Op닉‰‰—‰‰‰©MÐ9‹wwл‹wwB‹‰‰5ÉÐ鋉‰‰‰ ý‰‰‰íÄI‹‹Ä Ä‹‹Ä B‹‰‰5ÉÐ wwЋwwÄ Ä™‰‚‰‰‰3‰‰‰—O¢‰‰‰›©‰‰‰—O‚‰‰‰›[‰‰‰—O¢‰‰‰剉‰—O‚‰‰‰剉‰—󢉉‰‰‰‰—󂉉‰›©‰‰‰—󢉉‰e‰‰‰—󂉉‰™]‰‰‰%ЋWw¢‰‰‰‰‰‰%‚‰‰‰3‰‰‰%¢‰‰‰—‰‰‰%‚‰‰‰—‰‰‰éЋɉ¢‰‰‰3‰‰‰邉‰‰™]‰‰‰©MЋww¢‰‰‰3‰‰‰©MÔ ©‰‰‰‹e‰‰‰‹ep‰`
Ò›úâ‹p ým{ý‰z‹‰Ò‰p‰‰‰‰‰‰‰‰‰‰p ‰‰‰ õ‰‰‰‰‰p‰‰鉉 …ùpÙ‰‰‰ õ‰‰‰‰‰pY‰‰鉉 …ùp‰ ‰ ‰‰‰‰‰‰‰‰‰‰p‰Ä«‹pÛ‰‰‰‰ õ‰‰‰‰‰p[‰‰‰鉉 …ùpi‰‰‰‰ õ‰‰‰‰‰p뉉‰鉉 …ùÐ9‰wwл‰wwB‰‰‰5ÉB ‰‰‰/Š‰‰‰‰‰Ð鉉‰‰‰ ý‰‰‰íÄI‰‰Ä ‰Ä‹‰Ä B‹‰‰5ÉÐ wwЋwwÄ Ä™‰‚‰‰‰ õ‰‰‰ õ¢‰‰ ϱ‰‰ …ù¢‰‰ …ù‰‰‰‰‰‚‰‰鉉‰‰‰¢‰‰[/‰‰‰/Ñ¢‰‰Û}‰‰ —é"‰{"w±m"‰;/Ñ¢‰‰[/‰‰‹m‘¢‰‰鉉 …ùpÛ ‰‰‰‰‰‰‡_p[ ‰‰‰U‰‰‰™]pi ‰‰‰‰‰‰‡_pë ‰‰‰U‰‰‰™]Ð9 wwл wwB ‰‰5ÉB ‰‰‰/Š‰‰‰‰‰Ðé ‰‰‰‰ ýď ‰‰‰‰íÄI ‹Ä Ä‹ Ä B‹‰‰5ÉÐ wwЋwwÄ Ä™‰‚‰‰‰‰‰‰‡_¢‰‰‰q‰‰‰‡_¢‰‰‰W‰‰‰‡_¢‰‰‰›‰‰‰‡_¢‰‰‰£‰‰‰‡_¢‰‰‰U‰‰‰‡_‚‰‰‰U‰‰‰ƒ¢‰‰‰£‰‰‰ƒ¢‰‰‰M‰‰‰ƒ¢‰‰‰W‰‰‰ƒ¢‰‰‰¥‰‰‰ƒ¢‰‰‰‰‰‰ƒ‚‰‰‰‰‰‰5¢‰‰‰U‰‰‰5‚‰‰‰U‰‰‰ù¢‰‰‰q‰‰‰ù¢‰‰‰‰‰‰ù‚‰‰‰‰‰‰™«¢‰‰‰U‰‰‰™«‚‰‰‰U‰‰‰™]¢‰‰‰q‰‰‰™]¢‰‰‰‰‰‰™]pÛ‹‰‰‰™]‰‰‰—Op[‹‰‰‰—‰‰‰©Mpi‹‰‰‰™]‰‰‰—Op닉‰‰—‰‰‰©MÐ9‹wwл‹wwB‹‰‰5ÉB ‰‰‰/Š‰‰‰‰‰Ð鋉‰‰‰ ý‰‰‰íÄI‹‹Ä Ä‹‹Ä B‹‰‰5ÉÐ wwЋwwÄ Ä™‰‚‰‰‰3‰‰‰—O¢‰‰‰›©‰‰‰—O‚‰‰‰›[‰‰‰—O¢‰‰‰剉‰—O‚‰‰‰剉‰—󢉉‰‰‰‰—󂉉‰›©‰‰‰—󢉉‰e‰‰‰—󂉉‰™]‰‰‰%ЋWw¢‰‰‰‰‰‰%‚‰‰‰3‰‰‰%¢‰‰‰—‰‰‰%‚‰‰‰—‰‰‰éЋɉ¢‰‰‰3‰‰‰邉‰‰™]‰‰‰©MЋww¢‰‰‰3‰‰‰©MB ‰‰‰/Š‰‰‰‰‰Ô ©‰‰‰‹e‰‰‰‹ep‰`
Expand Down
Loading