Skip to content

Commit 3211102

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 9ba7f4b commit 3211102

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
@@ -582,7 +582,6 @@ public void writeJobCode(LaserJob job, ProgressListener pl) throws IOException {
582582

583583
for (JobPart p : job.getParts())
584584
{
585-
float focus;
586585
boolean engrave = false;
587586

588587
if ((p instanceof RasterPart) || (p instanceof Raster3dPart))
@@ -642,13 +641,27 @@ public void writeJobCode(LaserJob job, ProgressListener pl) throws IOException {
642641
{
643642
LaserProperty pr = cmd.getProperty();
644643
FloatMinMaxPowerSpeedFocusFrequencyProperty prop = (FloatMinMaxPowerSpeedFocusFrequencyProperty) pr;
644+
float focus = prop.getFocus();
645645
if (first_prop) {
646646
first_prop = false;
647647
currentMinPower = cmd_layer_percent("c631", part_number, currentMinPower, prop.getMinPower());
648648
currentMaxPower = cmd_layer_percent("c632", part_number, currentMaxPower, prop.getPower());
649649
// prop speed is in %, ruida speed is in mm/s (0..1000)
650650
currentSpeed = cmd_layer_absoluteMM("c904", part_number, currentSpeed, prop.getSpeed() * getMaxVectorCutSpeed() / 100);
651-
// focus - n/a
651+
652+
// negative focus is not applicable on the test device (uses 6442s)
653+
if (focus <= 0) {
654+
focus = 0;
655+
}
656+
657+
// configure axis velocity, affects move speed of Z axis
658+
stream.hex("c903").absoluteMM(5);
659+
// move Z axis to desired focus valueu
660+
// the value depends on the device
661+
// on an OMTech Polar, for instance, focus needs to be set to 17 - <thickness>
662+
// for instance, for a 3mm thick material, one needs to configure a focus of 14.0
663+
stream.hex("800B").absoluteMM(focus);
664+
652665
// frequency
653666
stream.hex("c660").byteint(part_number).hex("00").longint(prop.getFrequency());
654667
// color - red for now
@@ -681,6 +694,11 @@ public void writeJobCode(LaserJob job, ProgressListener pl) throws IOException {
681694
currentSpeed = -1;
682695
}
683696

697+
// configure axis velocity, affects move speed of Z axis
698+
stream.hex("c903").absoluteMM(5);
699+
// move Z axis back to 0
700+
stream.hex("800B").absoluteMM(0);
701+
684702
/* work interval */
685703
stream.hex("DA010620").longint(travel_distance).longint(travel_distance);
686704
/* 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)