My laser engraver from 0 knowledge to 32.461% .... probably

Discussions and file drops for Auggie
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4586
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: My laser engraver from 0 knowledge to 32.461% .... probably

Post by ArtF »


  Bobby:


  When a valid input pin toggles its value.. say Pin 6 on the Main Pokeys,
a signal is sent to the scripting facility of "MotionPin6". This means a script
waiting on such a signal will start running when it sees that toggle of value.

  You'd need to write a script that listens for that signal to do your operation.
You'd use the block command to pause a script, blocking  on that pin. Im forgetting
many of these operations as I rarely change scripts anymore.. but you need a
script similar to this and to call it in an mdi line or something to start the process.

ex script:

global MyRewindService = function()
{
  while(1)
    {
      print("Waiting for Pin6 to rewind");
      block("MotionPin6"); //this will wait for pin6 to toggle

      //do a Gcode call here to do a rewind.. I thinks like..
      print("Pin6 has been pressed");
      Engine.Gcode("M30");
     
    }
};
//and start the service
MyRewindService();
 

    The above script would be added to the end of your Gcode script in the
library, it will then start up as the system does and make pin6 a rewind button.
  Though you may want to test the pin6 value to see if its a 1 or zero.. I think
thats something like Motion.GetDigPin(6) .. you should see example of how
to use those calls in the various posts here or in the library in various scripts.

Art



BobbyW
Old Timer
Posts: 117
Joined: Sun Sep 08, 2019 12:27 pm

Re: My laser engraver from 0 knowledge to 32.461% .... probably

Post by BobbyW »

ArtF wrote:
  Bobby:

       Engine.Gcode("M30");

Art
Thanks Art
For rewind button , i found the other way
to automated rewind. Shame to me i didn't know
exist a " rewind " command in GCODE.
So i put it at the end on my extension footer , every time i generate GCODE
the code will rewind itself .

Code: Select all

'header': """%
M5 ( LOCK LASER)
(Header)
""",
'footer': """(Footer)
M5 (LOCK)
G00 X0 Y0 (Move head out of way)
M2 (END)
M30 (rewind)
%"""
}
And that solve the rewind.
For RUN , STOP i look in the panel and i saw
the variable used by that buttons .
I think need something like when pin_X is toggled.

Code: Select all

GlobalSet("Execute");
Thanks
Bobby
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4586
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: My laser engraver from 0 knowledge to 32.461% .... probably

Post by ArtF »

probably more like GlobalSet("Execute",1);
BobbyW
Old Timer
Posts: 117
Joined: Sun Sep 08, 2019 12:27 pm

Re: My laser engraver from 0 knowledge to 32.461% .... probably

Post by BobbyW »

ArtF wrote: probably more like GlobalSet("Execute",1);
Hi Art
Yes , you right . I didn't know the function have a argument.
It works , but with two issues .
One " Engine.Gcode("M30"); " M30 is not recognized .
and second , Doesn't matter how fast i press the button
the comand will always double execute.
I assume "toggle" is not perfect solution ,
because i assume the service will detect my press 0 to 1 and after i release
the button the service detect 1 to 0 normaly .
Maybe if i wait only from 0 to 1 the pin change ?
Usualy when a pin_X can be in/out type is necesary
pull up/down with 1-10k .
Thanks
Bobby
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4586
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: My laser engraver from 0 knowledge to 32.461% .... probably

Post by ArtF »

Bobby:

  Yes, to stop it form toggling, you'd have to modify your script to check to
see that the current level is on that pin.  Ill try to get time to refresh my memory and
tell you the exact calls.. but its somethign like..

global MyRewindS ervice = function()
{
  while(1)
    {
      print("Waiting for Pin6 to rewind");
      block("MotionPin 6"); //this will wait for pin6 to toggle
      if( Motion.GetPinDig( 6 ) == 1) //this would make the rewind only occur if the switch toggles to 1..could be zero..
      {
      //do a Gcode call here to do a rewind.. I thinks like..
      print("Pin6 has been pressed");
        GlobalSet( "Rewind" , 1);
      }
     
    }
};

  I think the above will work.. You can also use GlobalSet with the name of any button
so to press the Rewind button on the screen, note the buttons variable name in the editor..
"Rewind" in this case, and in your script just use GlobalSet( "Rewind" , 1);

In this way any macro script or file can press buttons even in the Gcode.
If you add the line

{ GlobalSet( "Rewind", 1) }

to the end of a Gcode file, its the same as an M30, or pressing the rewind button.
You can put anything in a Gcode file in {} and it becomes a script.

Art
BobbyW
Old Timer
Posts: 117
Joined: Sun Sep 08, 2019 12:27 pm

Re: My laser engraver from 0 knowledge to 32.461% .... probably

Post by BobbyW »

ArtF wrote:
      if( Motion.GetPinDig( 6 ) == 1) //this would make the rewind only occur if the switch toggles to 1..could be zero..
   
Art
Hi Art .
Well the corect call was

Code: Select all

 //   if(IOPin8.GetState() == 1) 
 //     if(MotionPin8.GetState() == 1)
       if (Pokeys1.GetPinDig(8) == 1)
or better like , normaly should got if is true

Code: Select all

if (Pokeys1.GetPinDig(8))
Working fine with both codes.
I look arown from Gary probing scripts to see how he get the pin state.
I seen all variables but where are located all functions ?
Like that i will know how to call them.
Delay , count , reg exist in Auggie or i need to create a function
to call after ?

Thanks
Bobby
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: My laser engraver from 0 knowledge to 32.461% .... probably

Post by gburk »

this is how i check the probe pin its in the library

Code: Select all

// Library PokeyPins 
// Created  Thursday, December 06, 2018 
// Author  Gary       -- Do not edit above this line
  
 //  Enter Global vars below this line. 
//  the librarian no matter where they are, but its easier 
//  to find and edit them in one spot.
   
   
   
 //The 6 lines previous to a function will appear as  
 //comments to help users to understand the parameters   
 //required for use by each function, so try to   
 //always add as clear a set of instructions in these  
 //lines as an aid to fellow travellers. 
 
//myblock = block( "MotionPin19" , "IOPin9", "MotionPin11");
 
//if( myblock == "MotionPin9" ) { .......do whateer" };
                                            
global  MonitorPin19 = function()
{
  //Pokeys1.SetPinDig( 19 , 0 ); // turn off pin 19, ( assumed to be digital output) 
 
  while(1)
  {
    //print("Pin 19 Check");
    GlobalSet("ProbeLED",0);
    block( "MotionPin19");  //or you cold use IOPin9
 
   //
   //  when you reach here, its because pin9 has changed..
    pinstate = Pokeys1.GetPinDig(19);  
    //print("Pin 19 Changed");
    GlobalSet("ProbeLED",1);
    block( "MotionPin19");
    //yield();
         //do what you need to do. Take not that if you change pin9, youll get called again..
         //so make sure you dont get into a loop where your change makes this gets called which then changes it..etc.. .
  }; 
};
MonitorPin19();
Gary
BobbyW
Old Timer
Posts: 117
Joined: Sun Sep 08, 2019 12:27 pm

Re: My laser engraver from 0 knowledge to 32.461% .... probably

Post by BobbyW »

Hi.
Thanks Gary , i look on you library how you acces and create the functions.
I finish all my buttons , for start , stop , continue. rewind wasn't necesary
i program the extension to generate at the end the GCODE the rewind.
But now i run in other issue.
I want to put the buzzer allarm on X Y Z limit switches.
I mean , if the X will touch the limit switch , the alarm will toggle sound
until is released. That should not be hard but mess me up.
I saw in "Diags" pannel the LimitPArray and LimitMArray
and i saw is two variable for all + and - limit.
I want to send that signal " like the led blink in the Diags pannel, to OC1 as example :
Pokeys1.SetOC(1, LimitPArray);
That result in error , because call a non "int" type .
Assuming Limits have only 2 state , what it is and how to acces it .
I try to see if i understand wrong but i saw the script is not to much different than C .
I put below maybe i chose the wrong file.
Thanks
Bobby

Attachments

[The extension pdf has been deactivated and can no longer be displayed.]

BobbyW
Old Timer
Posts: 117
Joined: Sun Sep 08, 2019 12:27 pm

Re: My laser engraver from 0 knowledge to 32.461% .... probably

Post by BobbyW »

I'm back  :)
Other important question . The scripts running in my system or in pokeys MCU .
Because today i mess up Auggie and all scripts was broken after "out of memory"
I have only 16G RAm but , i think i food the system with script trying to understand
all functions and variables here .
Single way to restart auggie was to edit manualy my last attempt :(

Code: Select all

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
global limit_err = 0;

global My_limit_service = function()
{
while(1)
  {
  limit_err = Led("LimitMArray");
    if(limit_err == 1)
      {
      print(" limit get touched");
      Pokeys1.SetOC(2, 1); 
      sleep(2);
      Pokeys1.SetOC(2, 0); 
      sleep(1);
      }
  }
};
// start the service
My_limit_service();




/*global limit_err = Led("LimitMArray"); 
// functie pentru alarma
global limit_err_buz = function()
{
//      Pokeys1.SetOC(1, 0);
  if (limit_err.GetState() == true)
    {
      Pokeys1.SetOC(1, 0);
//      yield();
    }
  else
    {
      Pokeys1.SetOC(1, 1);
//      yield();
    }
return;
};
limit_err_buz();
*/
First one flood my system i think.
Thanks
Bobby
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4586
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: My laser engraver from 0 knowledge to 32.461% .... probably

Post by ArtF »

Hi Bobby:


  Scripts run in Auggie. So its important not to slow down your system too much.
This script syntax...

while(1)
  {
  limit_err = Led("LimitMArray");
    if(limit_err == 1)
      {
      print(" limit get touched");
      Pokeys1.SetOC(2, 1);
      sleep(2);
      Pokeys1.SetOC(2, 0);
      sleep(1);
      }
  }

  is not a good way to do something. Sleep(1) I think is 1ms of sleep,
so this repeats a lot.. You should always use block to make a thread sleep
until its needed. Auggie can lock up your system as it grows in memory
due to script execution. Restarting will fix it of course.

  I think as I recall that LimitPArray is an array of int, so LimitPArray[0]
would be x..etc..

Art

gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: My laser engraver from 0 knowledge to 32.461% .... probably

Post by gburk »

hi art

  Not sure if its me or what's up i upgraded Auggie to the newest one on the home page, and seems like my probing is broken..

I do a probe and then get the message,  get current com invalid, after a G move, and probing scripts do not work correct... i went back to Auggie ver 3.65 and all works again..

thanks gary
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4586
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: My laser engraver from 0 knowledge to 32.461% .... probably

Post by ArtF »

Gary:

Cant recall any changes.. I will try to get an update out this week as I do have a new version
with larger image aug screens ready to go. If that screws up the same way Ill see if I can trace
down thats up..

Thx
art
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4586
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: My laser engraver from 0 knowledge to 32.461% .... probably

Post by ArtF »

Hi guys:

  Auggie is updated and online. It has a larger aug's image display, ( and a smaller loaded image display..)
Im not sure why the latest versions would screw up the probe routines.. Im not sure what bug fix or change
would have made that happen, but let me know if it still does it.

  Note:
Always keep a backup of your favorite version of Auggie as there is no way for me to backtrack most of the
changes I make over time unless I find it early. The best I can do is help troubleshoot the why of a bug
that gets introduced.

Thx
Art
BobbyW
Old Timer
Posts: 117
Joined: Sun Sep 08, 2019 12:27 pm

Re: My laser engraver from 0 knowledge to 32.461% .... probably

Post by BobbyW »

ArtF wrote: Hi guys:

  Auggie is updated and online. It has a larger aug's image display, ( and a smaller loaded image display..)

Thx
Art
Hi.
What i can say , man .... i love you ;)
I didn't download yet , i hury up to say THANK YOU
And during time i observed , in AUGS screen when you input any data
like image dimensions , step...... after you write the number if you
press enter , will exit . I always press enter after any input , of course can be avoided that.
I go to download  ;D ;D ;D.
Thanks again
Bobby
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: My laser engraver from 0 knowledge to 32.461% .... probably

Post by gburk »

Art

I installed the new version, probing seems to be working correct now, but still get the message,  get current com invalid , after each g code call in the script g0 g31 and so on, get it with all them, you want a copy of the log file. but the good thing is the probing seems to be working ok.

Gary
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest