@@ -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,23 @@ 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+                 stream .hex ("800B" ).absoluteMM (focus );
669+ 
661670                // frequency 
662671                stream .hex ("c660" ).byteint (part_number ).hex ("00" ).longint (prop .getFrequency ());
663672                // color - red for now 
@@ -690,6 +699,10 @@ public void writeJobCode(LaserJob job, ProgressListener pl) throws IOException {
690699      currentSpeed  = -1 ;
691700    }
692701
702+     // move Z axis back to 0 
703+     // TODO: home before job 
704+     stream .hex ("800B" ).absoluteMM (0 );
705+ 
693706    /* work interval */ 
694707    stream .hex ("DA010620" ).longint (travel_distance ).longint (travel_distance );
695708    /* stop */ 
0 commit comments