Skip to content

Commit 4efa2dd

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 4efa2dd

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

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

Lines changed: 20 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,11 @@ public void writeJobCode(LaserJob job, ProgressListener pl) throws IOException {
690703
currentSpeed = -1;
691704
}
692705

706+
// configure axis velocity, affects move speed of Z axis
707+
stream.hex("c903").absoluteMM(5);
708+
// move Z axis back to 0
709+
stream.hex("800B").absoluteMM(0);
710+
693711
/* work interval */
694712
stream.hex("DA010620").longint(travel_distance).longint(travel_distance);
695713
/* stop */

test-output/de.thomas_oster.liblasercut.drivers.Ruida.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +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�`
1+
қ��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�`

0 commit comments

Comments
 (0)