Page 1 of 1

Differenz of API between macroloop and plugin API

PostPosted: Wed Jul 24, 2019 2:29 pm
by hekav
Hello

I'm in progress of porting my self made MPG from Mach3 to UCCNC.
I started writing some macroloops and they are working fine. I realized for certain
functions I need a plugin.

Now i have the problem that i cannot access button states form the Jog Window:

Here a example:
In the macro i coded

Code: Select all
// x achse selected
if (AS3jog.Getbuttonstate(220)){
  LEDS |=   MASK_X;
}else{
  LEDS &=  ~MASK_X;

and it works fine

in the plugin loop i coded
Code: Select all
// x achse selected
if (UC.Getbuttonstate(220))
     {
         LEDS |= MASK_X;
     }
     else
      {
         LEDS &= ~MASK_X;
       }


UC.Getbuttonstate(220) always returns false if the button is pressed or not

My questions:
how can I access this button state from the jog window in a plugin?
Is there a document of the differences between macro interface and plugin interface.

Helmut

Re: Differenz of API between macroloop and plugin API

PostPosted: Wed Jul 24, 2019 10:26 pm
by Dan911
Use...
UC.Getbutton(220)

Re: Differenz of API between macroloop and plugin API

PostPosted: Thu Jul 25, 2019 6:42 pm
by hekav
hello,

thanks for the info.

since the button is a toggle button I need its STATE, not the info when it is pressed.
This is what the function Getbuttonstate() is for and it works in a macro. Way not in a plugin? Is this a bug?

The Documentation says;
Getbutton() Function: bool Getbutton( int buttonumber ) Description: This function returns true if the button is being pressed on the screen OR via an input trigger and returns false if the button is released. Example: while(!AS3.Getbutton(128)); //Waits for the cycle start button press on the main screen.


If an other function change the state of the button I would not recognize it .

Helmut

Re: Differenz of API between macroloop and plugin API

PostPosted: Fri Jul 26, 2019 12:59 am
by Dan911
hekav wrote:hello,

thanks for the info.

since the button is a toggle button I need its STATE, not the info when it is pressed.


Both these "Functions" are get/set button bools and are going to return neither true or false, I find it fun to explore. Your right.... best to follow manual
and sorry for bad info.

Dan

Re: Differenz of API between macroloop and plugin API

PostPosted: Fri Jul 26, 2019 5:44 am
by dezsoe
Use LED 155 to get if the X is selected for MPG. All the bi-state buttons on the jog screen have their LEDs to check.