Page 1 of 2

plugin - debug issue

PostPosted: Fri Sep 16, 2016 8:43 am
by shad
Hello!
I am try to Debug my plugin from VS2013. When I try to connect to the UCCNC.exe - VS closes and UCCNC halt. May be any body had this issue?
Also maybe there is a easy way to have callback function to the plugin for TextField ValueChanged event? Or I need to check textfield on the every plugin loop?
Thank you!

Re: plugin - debug issue

PostPosted: Fri Sep 16, 2016 11:09 am
by cncdrive
Hi,

The UCCNC.exe can't be debugged because we don't allow that and this because of the crack protection the exe has.
If it was includable and debuggable then we could not protect the software from tampering, cracking etc.

Currently there is no event for the Textfield ValueChanged, however we thinking on extending the events and functions range of the plugin interface,
but currently only polling the Textfield is the only possiblility just like as you have mentioned.

Re: plugin - debug issue

PostPosted: Sat Sep 17, 2016 1:07 am
by shad
Thank you Balazs!
I am understand you. I will use try-catch for debugging, no problem.
Also my plugin need to control the state of the Spindle (for plasma - TorchON) output and ability to set ArcOK (Arc On pin but may be Arc ON signal state, because user can use any pins for this) input for start XY motion (THC function).
May be UCCNC have easy way for this?
Thank you!

--Andrew

Re: plugin - debug issue

PostPosted: Sat Sep 17, 2016 6:15 am
by shad
Hmm..
I am make my toggle button on the screen by 2100 number.
Try to switch toggle button on the screen from plugin.
Code: Select all
if(UC.Getbutton(2100)) UC.Switchbutton(true, false, 2100);
else   UC.Switchbutton(true, true, 2100);

I see that the Buttonpress_event triggered, But the button state is not changes. May be I am do something wrong?

Re: plugin - debug issue

PostPosted: Sat Sep 17, 2016 6:57 am
by shad
If I am set in the screeneditor state of the button ison to True - button triggered on.
Then I am save screen, and out from screen editor mode. Click on the button - button state changes to Off.
Click again - no changes.....no triggering to On

Re: plugin - debug issue

PostPosted: Sat Sep 17, 2016 2:08 pm
by cncdrive
The UC.Getbutton function returns true while the button is being pressed and false when it is not being pressed by the user on the screen.
The purpose of this function is that in macros you can make a wait for a button press.
So, this function does not return the state of the toggle type buttons.
For that there is the UC.Getbuttonstate which returns the state of the toggle type button (on or off).
The bad thing is that I've checked the plugin interface and it seems in the current release this function is missing.
I'm not sure if it was accidentally removed or what have happened to it .. could not look after it in details yet.
So, the function is there in the macro interface only, but missing from the plugin interface.
I will place the function to the plugin interface now, so you can use it in the next release. (Should happen in about a week.)

Meanwhile I advice you to just run the button press event in "open loop", I mean the custom buttons start up always with off (false) state,
so if you will only control the on/off state from your plugin then you can follow the exact state of the button without the checking for it's state, just declare a boolean variable in your plugin which holds the state.
I know it is not the most elegant solution, but can be a workaround until the next relelase will fix the missing function issue.

Re: plugin - debug issue

PostPosted: Sat Sep 17, 2016 4:12 pm
by shad
Thank you Balazs!
I am find solution - just use my internal flags for switch button state. It's works correctly.
What you think, may be there is a way for control from plugin Spindle output signal state (for plasma -it's will be TorchON) and ability to set from plugin ArcOK input state for start XY motion (Arc On pin or may be Arc ON signal state, because user can use any pins for this) .
Thank you!

Re: plugin - debug issue

PostPosted: Sat Sep 17, 2016 4:59 pm
by cncdrive
Yes, you can switch the M3 with the Callbutton code, just call the code of the M3 toggle or M3 on or M3 off to change the state of the spindle/torch.
the button codes are listed in the UCCNC/Documentation/ folder, there are some .html documents, one of them is the buttoncodes list.

Also there are button codes for the THC inputs emulation, maybe the emulation is not the best word for it, but you can call button codes to activate the inputs for the THC.
How it works in reality is that the emulation signal and the physical input signal's active states are in OR connection.
Please note that the THC emulation functions is only available in the latest 1.2022 version of the UCCNC, in earlier versions there was no such functions available.

Re: plugin - debug issue

PostPosted: Sat Sep 17, 2016 10:45 pm
by shad
About M3 code - I am just to need to control the state of the Spindle output inside plugin.
For example, user start program and when M3 issue, spindle ON command set. This is the command to torch on, but for my system this is the command to start cutting sequence and I need to know when this command issue. It's will be great to make ability to check and set all I/O signals (not pins, connected to this signals).
Thank you!

Re: plugin - debug issue

PostPosted: Sat Sep 17, 2016 11:01 pm
by cncdrive
You mean you need to know when the M3 is active?
You can check that in your plugin because the M3 just like every other functions has a LED code,
you can read the LED in your plugin to see if the M3 is active or not.
The LED codes are listed at the same place in the UCCNC/Documentation folder.

And as said you can call the M3 on, M3 off or M3 toggle button codes to control the M3 signal and with that you control the pin assigned to the M3 relay pin and also the spindle PWM pin assigned or step/dir pin assigned, depending on how the spindle is configured.