Custom User Button External Command Issue

More
5 years 6 months ago #206534 by AgentWD40
My first question is if I were to make a executable python script that I want a user button to call where *should* I put this script? I have my own ~/bin directory in my home folder that I've added to my $PATH through .bashrc, should/can I add this directory to linuxcnc's path?? If so how?

Second, I'm trying to string together a gcode and then a call to an external command like this:
BUTTON_7_NAME = CLICK\ME
BUTTON_7_CODE = G0 X5 Y5 \ %howdy

howdy is simple "hello world" executable python script that I've placed in /usr/local/bin for now.

When I click this button LinuxCNC throws the error:
HAL PIN ERROR:
Invalid code for user button #7
External command "%howdy" does not exist

BUT if i call the external command by itself:
BUTTON_7_CODE = %howdy
It finds the command and executes the script just fine.

Please Log in to join the conversation.

More
5 years 6 months ago #206536 by snowgoer540
For #2, I am curious, what happens if you try something like this:
Code:
BUTTON_n_CODE = g0x5y5 \ %halmeter

If that doesn't work, my guess is that there is an unintended feature holding this up. :) There was recently some code added that checks for invalid user buttons, and it's possible it needs some massaging in order to allow this scenario.

Per the user guide, it should be valid. Just trying to determine if it doesn't like your script, or the problem is in the user button check.

Please Log in to join the conversation.

More
5 years 6 months ago #206540 by AgentWD40
I'll give it a shot tonight. A problem with the button code validation sounds like a prime suspect since afterall I am able to execute the script from the button when the command is by itself.

Please Log in to join the conversation.

More
5 years 6 months ago #206562 by snowgoer540

AgentWD40 wrote: I'll give it a shot tonight. A problem with the button code validation sounds like a prime suspect since afterall I am able to execute the script from the button when the command is by itself.


No need, I had some time after work. I reckon it's an issue with the code. I'm sure it'll get sorted out.

Please Log in to join the conversation.

More
5 years 6 months ago #206571 by AgentWD40
For my own edification can someone point me to the relevant source file on github? Or even the actual QTPlasmaC gui source files? I cant get my head around navigating to where anything is... If I could just find the actual source I may be able to suggest fixes.

Please Log in to join the conversation.

More
5 years 6 months ago #206595 by AgentWD40
@snowgoer540 @phillc54
I think I found the bug.
Line #2231 of qtplasmac_handler.py
Code:
cmd = command.lstrip('%').strip().split(' ', 1)[0]

should be
Code:
cmd = command.strip().lstrip('%').split(' ', 1)[0]

github.com/LinuxCNC/linuxcnc/blob/a316f2...mac_handler.py#L2231

Please Log in to join the conversation.

More
5 years 6 months ago #206596 by snowgoer540
Yea, I saw the same. I reckon Phill is working on it. It seems Clive is having a similar issue as well with his laser code. So probably a few more changes to come.

Thanks for the report!

I noticed a few other things about conversational while I was messing around with this tonight. So, some changes should be coming shortly.

Please Log in to join the conversation.

More
5 years 6 months ago #206597 by AgentWD40
Oh, and the same change needs to be made on line #2381 of the same file.

(repeated code *tisk* *tisk* *tisk* haha :laugh: )

Please Log in to join the conversation.

More
5 years 6 months ago #206609 by phillc54

AgentWD40 wrote: Oh, and the same change needs to be made on line #2381 of the same file.

(repeated code *tisk* *tisk* *tisk* haha :laugh: )


Actually, redundant code...

Fix has been pushed along with some others. There are still some issues like accepting negative values when it shouldn't. I'll get around to them after my next pay rise.

Please Log in to join the conversation.

More
5 years 6 months ago #206668 by AgentWD40
It looks like the fix is broke :(

Line #2377: Instead of calling Popen, ACTION.SET_MANUAL_MODE() is called instead.

phillc54 wrote: I'll get around to them after my next pay rise.


Do you have a patreon, gofundme... onlyfans page or whatever where we can donate for your efforts?

Please Log in to join the conversation.

Time to create page: 0.073 seconds
Powered by Kunena Forum