Results 1 to 7 of 7

Thread: EasyLase II slow jmlaser.dll VB6 issue ?

  1. #1
    Join Date
    Jan 2010
    Location
    Paris
    Posts
    43

    Unhappy My first app for EasyLase : slow jmlaser.dll VB6 issue ?

    Hello PL users,

    I just received an EasyLase II and I want to create a fun "realtime parametric show generator"

    Sorry for my English level...

    At this time the programe create only a moving SIN wave (Equation is hard coded) but I plan to add automatic equation maker and/or input box parser for X, Y and R, G, B, .ILD recording, resizable window...

    But I'm stuck with a strange issue... I get very very slow EasyLaseWriteFrame function call from jmlaser.dll...

    This is very strange because it work very well and fast with the same EasyLaseWriteFrame function from EzAudDac.dll

    But EasyLaseWriteFrameNR (No Repeat frame) function call from new jmlaser.dll work fast but add me a blanking dot at center on each frame

    I compiled 6 version :

    3 Synchronous version for each DLL :

    * jmlaser.dll for EasyLase II (EasyLaseWriteFrame freeze the main loop for a lot of time)
    * EasyLase.dll for EasyLase normal (I cannot test it with my hardware, I need your help please...)
    * EzAudDac.dll working with my non-DC-moded soundcard...

    3 Asynchronous test version (dont wait the easylase ready, unusable too many frame skipping, benchmark/test only)

    * The Asynchronous test version for jmlaser.dll / EasyLase II is slow AS the Synchronous version -> conclusion, the new EasyLaseWriteFrame freeze the main loop for a lot of time in VB6

    I would be happy that you can test... Source code and VB6 runtime is included in archive...

    Pascal

    Edit : english:s
    Attached Thumbnails Attached Thumbnails Screenshot..png  

    Attached Files Attached Files
    Last edited by Serveurperso; 03-12-2010 at 03:20. Reason: english:s
    Connect your Raspberry PI to teleoperate, make and share securely any type of robots
    Low latency "game-like" remote piloting (100% free no-ads) you are welcome to test our robots!
    https://www.vigibot.com

  2. #2
    Join Date
    Oct 2006
    Location
    Cleveland, Ohio
    Posts
    2,342

    Default

    Hi Pascal, it's cool you're writing some homebrew code for laser use so for that reason I'll try to help you out.

    In testing with EasyLase 1:

    Test_EasyLase_Asynchronous: WriteFrame Function does not cause a delay, so frames are sent to the DAC much too often. This causes the output to get corrupted - dangerous! can damage scanners.
    Test_EasyLase_Synchronous: Works OK, no extra points.
    Test_jmlaser_Asynchronous: same update speed as Synchronous! The WriteFrame function must be waiting for output to finish before returning.
    Test_jmlaser_Synchronous: works same as EasyLase_Synchronous, no problem.

    So I did not see any extra blanking dots at the center of each frame, this must be a feature of the EasyLase II.
    Note: you should add retrace points from one end of the sine to the other to preserve scanners.

    So, good luck with your project, but I have to wonder why you chose the easylase II to work with?

  3. #3
    Join Date
    Jan 2010
    Location
    Paris
    Posts
    43

    Default Thanks DrLava

    Hi DrLava,

    Thanks for all. I answer inside the text because of limited english...

    In testing with EasyLase 1:

    Test_EasyLase_Asynchronous: WriteFrame Function does not cause a delay, so frames are sent to the DAC much too often. This causes the output to get corrupted - dangerous! can damage scanners.

    > Yes ! it's normal, Same as your EzAudDac.dll, only for testing, I must work Synchronous.



    Test_EasyLase_Synchronous: Works OK, no extra points.

    > Yes, very good, Same as your EzAudDac.dll, it's the normal program working... Extra point is only with function EasyLaseWriteFrameNR from the API, I have not compiled and uploaded a bin here with this function.



    Test_jmlaser_Asynchronous: same update speed as Synchronous! The WriteFrame function must be waiting for output to finish before returning.

    > This is the retro-compatibility test : new DLL with old hardware, here is a problem with VB6 and/or JM code ! WriteFrame must be Asynchronous and too fast (frame skip).


    Test_jmlaser_Synchronous: works same as EasyLase_Synchronous, no problem.

    > Normal because it only add a working waiting code.



    So I did not see any extra blanking dots at the center of each frame, this must be a feature of the EasyLase II.
    Note: you should add retrace points from one end of the sine to the other to preserve scanners.

    > Extra point is only with function EasyLaseWriteFrameNR from the API, I have not compiled and uploaded a bin here with this function.
    > With EasyLaseWriteFrameNR, I dont understand why the last point is displays intermittently.
    > I dont understand "you should add retrace points from one end of the sine to the other to preserve scanners." -> I must reduce speed of the galvos at last point to avoid high inertial peak ?

    So, good luck with your project, but I have to wonder why you chose the easylase II to work with?
    > Joachim say to me : same compatibility and best performance... My primary use of this is the freeware development, for fun...

    Thanks,
    Pascal

    Edit : Joachim just send me the new API documentation. now I can use all new entry from the new jmlaser.dll DLL. If work it's good else I must go to Delphi ?... At this time I know only Visual Basic for DLL programming... My test on Visual Basic .NET dont work with jmlaser.dll
    Connect your Raspberry PI to teleoperate, make and share securely any type of robots
    Low latency "game-like" remote piloting (100% free no-ads) you are welcome to test our robots!
    https://www.vigibot.com

  4. #4
    Join Date
    Jan 2010
    Location
    Paris
    Posts
    43

    Default Delphi...

    This is my first Delphi code but I get the same problem


    Code:
    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;
    
    type
      TForm1 = class(TForm)
        Button1: TButton;
        Label1: TLabel;
        procedure FormCreate(Sender: TObject);
        procedure FormDestroy(Sender: TObject);
        procedure Button1Click(Sender: TObject);
      private
        { Déclarations privées }
      public
        { Déclarations publiques }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    var
      CardNumber: integer;
      DataBuffer: array of byte;
      DataCounter: integer;
      Speed: word;
    
      function EasyLaseGetCardNum: integer; stdcall; external 'easylase.dll';
      function EasyLaseStop(var CardNumber: integer): boolean; stdcall; external 'easylase.dll';
      function EasyLaseGetStatus(var CardNumber: integer): integer; stdcall; external 'easylase.dll';
      function EasyLaseWriteFrame(var CardNumber: integer; DataBuffer: pointer; DataCounter: integer; Speed: word): boolean; stdcall; external 'easylase.dll';
      function EasyLaseWriteFrameNR(var CardNumber: integer; DataBuffer: pointer; DataCounter: integer; Speed: word; RepNum: word): boolean; stdcall; external 'easylase.dll';
      function EasyLaseClose: boolean; stdcall; external 'easylase.dll';
      function EasyLaseGetLastError(var CardNumber: integer): integer; stdcall; external 'easylase.dll';
    
    procedure TForm1.FormCreate(Sender: TObject);
    begin
    
      CardNumber := EasyLaseGetCardNum - 1;
    
    end;
    
    procedure EasyLaseData(X, Y: word; R, G, B, I: byte);
    begin
    
      SetLength(DataBuffer, DataCounter + 8);
      DataBuffer[DataCounter] := lo(X);
      DataBuffer[DataCounter + 1] := hi(X);
      DataBuffer[DataCounter + 2] := lo(Y);
      DataBuffer[DataCounter + 3] := hi(Y);
      DataBuffer[DataCounter + 4] := R;
      DataBuffer[DataCounter + 5] := G;
      DataBuffer[DataCounter + 6] := B;
      DataBuffer[DataCounter + 7] := I;
      DataCounter := DataCounter + 8;
    
    end;
    
    procedure TForm1.Button1Click(Sender: TObject);
    var
      T: cardinal;
      N: single;
      X, Y: single;
      XData, YData: word;
      R, G, B, I: byte;
    
    begin
    
      Button1.Enabled := False;
    
      T := 0;
      repeat
    
        SetLength(DataBuffer, 0);
        DataCounter := 0;
        Speed := 1000;
    
        N := -PI;
        while N < PI do begin
          X := sin(N + T / 20) / 1.5;
          Y := cos(N + T / 20) / 1.5;
          R := 255;
          G := 255;
          B := 255;
          I := 255;
          XData := trunc(2048 + X * 2047);
          YData := trunc(2048 + Y * 2047);
          EasyLaseData(XData, YData, R, G, B, I);
          N := N + 2 * PI / 20
        end;
    
        repeat
          Application.ProcessMessages;
        until EasyLaseGetStatus(CardNumber) <> 2;
    
        T := T + 1;
    
      until EasyLaseWriteFrame(CardNumber, DataBuffer, DataCounter, Speed) = False;
      //until EasyLaseWriteFrameNR(CardNumber, DataBuffer, DataCounter, Speed, 0) = False;
    
    end;
    
    procedure TForm1.FormDestroy(Sender: TObject);
    begin
    
      EasyLaseClose;
    
    end;
    
    end.
    Connect your Raspberry PI to teleoperate, make and share securely any type of robots
    Low latency "game-like" remote piloting (100% free no-ads) you are welcome to test our robots!
    https://www.vigibot.com

  5. #5
    Join Date
    Jan 2010
    Location
    Paris
    Posts
    43

    Laser Warning Workaround OK !

    Now I totaly understand this problem, it's not a VB6 problem, it's not my code the problem, it's only a never tested bug/feature on jmlaser.dll and old API set of function.

    It's only at very low number of points in the frame (10 to 50 points), and only at low speed (500/1000 to 5000 PPS) It's identical with EasyLase 1 and EasyLase 2 hardware, but only present with the new jmlaser.dll.


    EasyLaseWriteFrameNR -> blank and return to center on each frame. I must repeat five to ten each points and increase the speed to get workaround.

    EasyLaseWriteFrame -> very long code sleeping (probably a bug) I must repeat five to ten each points and increase the speed to get workaround.

    ------

    EasyLaseWriteFrame even at High point number and High speed -> never discard frames as the old EasyLase.dll, make alway sleeping time in the loop, work alway in synchronous -> Non Documented feature. No impact on LFI Player / HE Laserscan / Mamba / LDS / Fiesta / LazyMAME / laseroids / lasertenis / OLA....
    But may surprise a totaly new developer (as me), and make its program not compatible with the old EasyLase.dll API. it's not a very important problem but JM can document this...

    Pascal

    Edit : New version : no bug (same points rep @ more PPS), window resizable, VB6 native code, dragable beam source

    Click image for larger version. 

Name:	Screen..png 
Views:	18 
Size:	23.9 KB 
ID:	15613
    EasyLase..zip
    Last edited by Serveurperso; 04-02-2010 at 08:46.
    Connect your Raspberry PI to teleoperate, make and share securely any type of robots
    Low latency "game-like" remote piloting (100% free no-ads) you are welcome to test our robots!
    https://www.vigibot.com

  6. #6
    Join Date
    Jul 2008
    Posts
    770

    Default

    Hi Pascal!

    Thanks for sharing your work (including source code)! I use VB6 as well, and it's good to know that there are others using it for laser display applications; I've learned much from looking at your code. Good work!

    I noticed your exe's are compiled to p-code, do you have access to the VB6 native compiler? (it does math so much faster)

    Consider obtaining a modified USB audio DAC, I think you would enjoy what it has to offer.

    Dean

  7. #7
    Join Date
    Jan 2010
    Location
    Paris
    Posts
    43

    Default

    Hi Dean,

    Thanks now it's in "Native code" (I forgot)

    For Math performance, the best is some pre-calculation SIN / COS etc. function in array, all in Integer

    Now I need to integrate the "EVAL" math parser, user editable X= Y= R= V= B= ?

    Pascal
    Connect your Raspberry PI to teleoperate, make and share securely any type of robots
    Low latency "game-like" remote piloting (100% free no-ads) you are welcome to test our robots!
    https://www.vigibot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •