reading Pokeys pins

C Scripting questions and answers
gburk
Site Admin
Posts: 324
Joined: Mon Nov 26, 2018 2:57 am

Re: reading Pokeys pins

Post by gburk »

Art

Sorry I take that back, I went back and reran the g code it still rewinds but now on the first Press of the RUN button  the code then hits the m6,  it then rewinds the g code. but does the z move to .125 and then to 1"  then the tool change dialog pops up. and I am now back to the first line of g code

Now I have to hit the RUN button  z moves to .125 then the code runs to the same m6 call z moves to 1" again and the tool dialog pops up
but now the g code doesn't stop keeps running though all the pecking lines even with the tool change dialog waiting for a key press..

Hopefully this is a little clearer I stumble on words ???

And almost forgot the reason the pecking seems to stop is I have a sleep in the script made it easier to read the prints on the screen..


Gary
Last edited by gburk on Mon Jun 24, 2019 11:51 pm, edited 1 time in total.
ArtF
Global Moderator
Global Moderator
Posts: 4557
Joined: Sun Sep 05, 2010 5:14 pm
Contact:

Re: reading Pokeys pins

Post by ArtF »


Ill rerun my tests Gary, my pecking stops entirely, but the script has a
call to StopProgram() so mine stops and never restarts. Its possible
my scripts ara bit different than yours at this point, but Ill try a few runs to see
where that move to 1" is coming from, I only traced it till I saw it came from
a script.
  Ill narrow it down a bit more.

Art

ArtF
Global Moderator
Global Moderator
Posts: 4557
Joined: Sun Sep 05, 2010 5:14 pm
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

  A new version is online 3.62-debug , this is a much larger file as it
is compiled in debug mode.

  What I find here is the file stops as it should at the m6, as well as the
pecking stops it due to the programStop() in there. (At least on mine.)

  Now testing this is hard here, because while I have your scripts, my system
isnt set as your in many ways, and I use a debug version as I test your scripts on
a 56e connected by USB and for some reason my system wont run the 56e on usb
in release mode, only debug. (My compiler is using usb for arduino config
and I suspect its interfering in my testing. )

  I found I had autotoolchange unchecked here, so it was the manual tool
change script that was causing the Z to go to 1 after the dialog opened.
I checked auto and that stopped and the file simply stops.

SO I need to know if debug and release work the same, let me know what
this one does. Also, in testing I did see a failure immediately after load on
the first press of run the line numbers didnt track. Im looking into that
but I noticed after rewinding and restarting it worked as expected. So
theres a bug in there somewhere. Im still looking.

Art
gburk
Site Admin
Posts: 324
Joined: Mon Nov 26, 2018 2:57 am

Re: reading Pokeys pins

Post by gburk »

Art

Ran the debug version with the g code a couple time...

on the Run press it runs to m6 rewinds doesn't stop starts running again from first line and never stops running at any m6...

and I miss understood you on stopping in the pecking I thought it was stopping during pecking not when it was exiting the pecking script
yes I still have the programStop() in mine I also have it in the manual tool change but has no effect anymore with the g code the script runs hits the programStop() but doesn't stop just keeps running.

Not sure maybe that could be broken now?..

also noticed one difference in the debug ver when I booted auggie the blue script led was lit so i assume some script was running it didn't shut off till i hit stop

Will test some more..

Thanks gary



 
Last edited by gburk on Tue Jun 25, 2019 6:45 pm, edited 1 time in total.
gburk
Site Admin
Posts: 324
Joined: Mon Nov 26, 2018 2:57 am

Re: reading Pokeys pins

Post by gburk »

Art

I think I found the problem with the m6 its my ERROR in script, I was trying to have the g code continue to run after my tool change dialog was closed with the button press so I didn't have to hit the run button after the dialog box was closed so I had stuck a    //GlobalSet("Execute",1); in there when it exited the manual tool change script I REMed it out now it stops at the dialog box and M6, SORRY MY BAD

The G code still Rewinds on first M6, but if you stop the G code and rewind it, Then it runs fine so seems like happens only on first run of G code..

So no that I don't seem to be able to use    //GlobalSet("Execute",1); or I need to put in a different part of code, any suggestions as to how to make the g code continue after I close the dialog without having to press RUN also??

And the blue led only flashes in simulation mode not in engine, you may have it setup that way
I get there error in the error file
25:13:150  Simultion Mode Active
25:13:150  Changing Enabled state of one or more motors
25:13:150  Pokeys section inited.
25:19:649  error (3) parse error

Gary
ArtF
Global Moderator
Global Moderator
Posts: 4557
Joined: Sun Sep 05, 2010 5:14 pm
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

>> M6, SORRY MY BAD

  Never a big deal.. :)

>> //GlobalSet("Execute",1);

  Awesome, you figured out how to make it run anyway, I had forgotten
that command. OK, so basically you want that to happen after the dialog
is closed, or at least while its closing, so Id add it to the end of whatever scripts
are named with _close in their name tag. You just need to figure out what the
final thing your doing is, and put the  GlobalSet("Execute",1); at the
end of that. I think that should work.

  I'm still searching for why the startup error. Too many changes lately so
Im probably leaving some variable unset.. Ill grok it eventually.

Art
ArtF
Global Moderator
Global Moderator
Posts: 4557
Joined: Sun Sep 05, 2010 5:14 pm
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

Just a note, Ill release the proper release compilation on next update,
that will make the program much smaller, though space doesn't really
matter to most anymore in days of terabyte drives.

  Auggie is both experimental and free so it has no real development
pressure on it so dont feel bad about all the versions, each one typically
makes it run a bit better in the end. I appreciate all the testing you did
to find the problems you found. :)

Art
gburk
Site Admin
Posts: 324
Joined: Mon Nov 26, 2018 2:57 am

Re: reading Pokeys pins

Post by gburk »

ART

Thanks
>> M6, SORRY MY BAD

>>  Never a big deal.. Smiley

Felt bad and stupid that I had you trying to figure out something that wasn't there..

I thought I had the  GlobalSet("Execute",1); after the StopProgram but it wasn't stopping I will double check and get back to you...

Thanks gary
gburk
Site Admin
Posts: 324
Joined: Mon Nov 26, 2018 2:57 am

Re: reading Pokeys pins

Post by gburk »

Art

I'm fairly sure the is the script M6 Starts and Ends with but as it is the Stopprogram doesn't stop maybe you see something im messing up

global DoToolChange = function( tool )
{
    //XcurPos = (Engine.GetAxisPos(1));
    //YcurPos = (Engine.GetAxisPos(2));
    //ZcurPos = (Engine.GetAxisPos(3));
    currentPos = AxisCurrentPos();
    print("currentPos X = " +currentPos[0]);
    print("currentPos Y = " +currentPos[1]);
    print("currentPos Z = " +currentPos[2]);
    sleep(.5);
    GcodeReturnToPos = ("G01 X"+currentPos[0]+" Y"+currentPos[1]+" Z"+currentPos[2]+"F10");
    Engine.GCode("m9");
    Engine.GCode("m5");
    block("MotionStill");
    if (GlobalGet("AutoManualDRO") == 1)
    {
    DoAutoToolChange( tool );
    Engine.GCode(GcodeReturnToPos);  //Move axis to safe posistion's
    block("MotionStill");   
    return;
    }
      else
      {
        DoManualToolChange( tool );
        print("Change done");
        //Engine.GCode(GcodeReturnToPos);  //Move axis to safe posistion's
        //block("MotionStill");
      };
    print("Change now to Tool " + tool + "requested");
    Engine.StopProgram();
    GlobalSet("Execute",1);
};

all the scripts are just rough drafts, figured not worth polishing up till most of it runs though OK.. make sense

I tried moving the  Engine.StopProgram(); and GlobalSet("Execute",1); to different positions in the script but doesn't stop  running seems like as long as there's a  GlobalSet("Execute",1); in the script it over rides the  Engine.StopProgram();..


Gary
Last edited by gburk on Wed Jun 26, 2019 9:46 pm, edited 1 time in total.
ArtF
Global Moderator
Global Moderator
Posts: 4557
Joined: Sun Sep 05, 2010 5:14 pm
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

>>Engine.St opProgram ();
>> GlobalSet("Execute",1);

  You can think of GlobalSet("Execute",1) as the opposite of StopProgram();

  Your stopping it, but then telling it to press the Execute button. This starts it again
unless its in a state where it cant. You should use one or the other, but not both.

Using GlobalSet("xxx",1) with any button named "xxx" is the same as pressing the button.

Art
Post Reply