button macros whilst executing gcode

If you have a question about the software please ask it here.

button macros whilst executing gcode

Postby stirling » Mon Jul 23, 2018 1:00 pm

Hi, new to UCCNC and just got up and running last week with a UC300ETH_5LPT and licensed software (V1.2047) so I may be missing something.

It appears that button macros are ignored whilst gcode is executing. Is this the case?

Thanks

Ian
UC300ETH_5LPT
Razordance DTHC
http://www.razordance.co.uk/THC.htm
stirling
 
Posts: 32
Joined: Mon Jul 23, 2018 12:54 pm

Re: button macros whilst executing gcode

Postby cncdrive » Mon Jul 23, 2018 3:16 pm

You could handle the custom buttons from macroloops, those always running in the background.
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

Re: button macros whilst executing gcode

Postby stirling » Mon Jul 23, 2018 5:32 pm

Hi Terry - thanks - how's it going with you? - been a while.

@cncdrive - can you explain a little please about the use of the macro pump to handle custom buttons? How would a macro pump be alerted that you've hit a user button?

Here's my need.

In my Mach3 plasma setup using my THC the operator can fine tune/adjust the Set Volts up or down whilst cutting. They can do this either by typing in a new value into a DRO or more conveniently by hitting up/down buttons to increase/decrease the Set Volts. Unfortunately in UCCNC not only can you not change the value in a DRO whilst gcode is running but you can't implement the up/down voltage buttons either.

Thanks
UC300ETH_5LPT
Razordance DTHC
http://www.razordance.co.uk/THC.htm
stirling
 
Posts: 32
Joined: Mon Jul 23, 2018 12:54 pm

Re: button macros whilst executing gcode

Postby cncdrive » Mon Jul 23, 2018 8:17 pm

20000 to 20999 DROs you can access even when running g-code.
The macro call buttons you really can't use while running g-code, what you could do is to write a macro loop which senses the presses of those buttons and doing things then just like if it was a buttonpress event.
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

Re: button macros whilst executing gcode

Postby stirling » Mon Jul 23, 2018 11:00 pm

cncdrive wrote:what you could do is to write a macro loop which senses the presses of those buttons and doing things then just like if it was a buttonpress event.


OK - that works fine. Thanks.

Just one small issue though: my user button is buttonnumber 20900 so that's what I monitor in the pump with:

if (AS3.Getbutton(20900))
{
//do stuff
}

However although that works just fine, I also get the error "File:/Profiles/Macro_RazordanceTHC\M20900.txt Could not read!" in the Status Message label. Presumably this is because there is not an actual macro associated with this button.

To prevent this error message I created a completely empty button macro M20900.txt but this seems a little kludgy - is there something I'm missing here?
UC300ETH_5LPT
Razordance DTHC
http://www.razordance.co.uk/THC.htm
stirling
 
Posts: 32
Joined: Mon Jul 23, 2018 12:54 pm

Re: button macros whilst executing gcode

Postby ger21 » Mon Jul 23, 2018 11:23 pm

Normally, the button would "do stuff", and the macroloop is just used to monitor the button press.

I guess they never thought that someone would want a button that didn't do anything. :D
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: button macros whilst executing gcode

Postby cncdrive » Tue Jul 24, 2018 1:05 am

Your example simple macro works fine here, I see no problem, it works, it just not doing anything, but if I change it like:

Code: Select all
if (AS3.Getbutton(20900))
{
MessageBox.Show("pressed");
}


Then is shows the messagebox when the button is pressed.
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

Re: button macros whilst executing gcode

Postby stirling » Tue Jul 24, 2018 8:22 am

cncdrive wrote:Your example simple macro works fine here, I see no problem, it works, it just not doing anything, but if I change it like:

Code: Select all
if (AS3.Getbutton(20900))
{
MessageBox.Show("pressed");
}


Then is shows the messagebox when the button is pressed.


OK, I maybe didn't explain things very well. Of course I have code in the macroloop, I just put //do stuff above to save typing - my bad. :geek:

Anyway using your example: here, if I just press the button whilst gcode is running yes it displays the message box. So far so good.

However if you press YOUR button when gcode is NOT running, yes it still displays the message box but it also generates an error in the status message box which says: "File:/Profiles/<your profile>\M20900.txt Could not read!"

HOWEVER, if you now create an EMPTY M20900.txt and press your button when no gcode is running - you don't get the error message any more. Why? because the system now has something to read i.e. M20900.txt even though its empty and therefore does nothing.

Is it the same on your system?

If so - I'm just asking if there's a more elegant way of suppressing the error message than creating an otherwise useless empty button macro.
UC300ETH_5LPT
Razordance DTHC
http://www.razordance.co.uk/THC.htm
stirling
 
Posts: 32
Joined: Mon Jul 23, 2018 12:54 pm

Re: button macros whilst executing gcode

Postby dezsoe » Tue Jul 24, 2018 8:34 am

You cannot suppress the error message, because UCCNC must run that macro. The only way you can work around is to write a plugin where you can handle the keypress even while code is running and you use a button code out of the 20000..21999 range to prevent UCCNC from searching for the macro file.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: button macros whilst executing gcode

Postby cncdrive » Tue Jul 24, 2018 9:32 am

I'm still not sure what you wanna achive nor do I understand it clearly what you doing?!
I mean I read your post about 20 times now and got even more confused about it.

Are you saying that if there is no M20900 macro file, if the file does not exist in other words then you get an error message and you want to get rid of that message?
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

Next

Return to Ask a question from support here

Who is online

Users browsing this forum: No registered users and 28 guests

cron