Custom user Button Touchoff in Axis
- snowgoer540
-
- Offline
- Moderator
-
Less
More
- Posts: 2398
- Thank you received: 787
07 Sep 2020 12:04 #181139
by snowgoer540
so I am guessing axis_remote --reload is not the proper way to send this command inside of the plasmax_axis? commands.reload doesnt appear to work either lol
Replied by snowgoer540 on topic Custom user Button Touchoff in Axis
All the code for this needs to be in plasmac_axis.py, you should be able to find in there where HAL pins are created and also the function that runs every cycle.Give me one quick nudge here please... where is the proper place to establish the "axisui.refresh" HAL pin? Hal connections file?
so I am guessing axis_remote --reload is not the proper way to send this command inside of the plasmax_axis? commands.reload doesnt appear to work either lol
Please Log in or Create an account to join the conversation.
- phillc54
-
- Offline
- Platinum Member
-
Less
More
- Posts: 5717
- Thank you received: 2093
07 Sep 2020 12:08 #181140
by phillc54
Replied by phillc54 on topic Custom user Button Touchoff in Axis
Close, commands.reload_file() does the trick. You can look in axis.py for all those commands.
Please Log in or Create an account to join the conversation.
- snowgoer540
-
- Offline
- Moderator
-
Less
More
- Posts: 2398
- Thank you received: 787
07 Sep 2020 12:23 - 07 Sep 2020 12:24 #181144
by snowgoer540
I must be doing something wrong.
I'm trying to take this in baby steps so I don't have too much go wrong at once.
doesn't seem to do anything. Edit: my ini file is setting that pin to 1, I confirmed that.
I did figure out that the rest of the needed commands are:
Then I just need to figure out how to increment...something...so that it does each every cycle.
Replied by snowgoer540 on topic Custom user Button Touchoff in Axis
Close, commands.reload_file() does the trick. You can look in axis.py for all those commands.
I must be doing something wrong.
I'm trying to take this in baby steps so I don't have too much go wrong at once.
if hal.get_value('axisui.refresh') == '1':
commands.reload_file()
doesn't seem to do anything. Edit: my ini file is setting that pin to 1, I confirmed that.
I did figure out that the rest of the needed commands are:
commands.clear_live_plot()
commands.set_view_z()
Then I just need to figure out how to increment...something...so that it does each every cycle.
Last edit: 07 Sep 2020 12:24 by snowgoer540.
Please Log in or Create an account to join the conversation.
- phillc54
-
- Offline
- Platinum Member
-
Less
More
- Posts: 5717
- Thank you received: 2093
07 Sep 2020 12:29 #181146
by phillc54
Replied by phillc54 on topic Custom user Button Touchoff in Axis
After the == remove the both the ' from the 1, that denotes text and it is an integer.
Yep, they are the correct commands
hal.set_p will set a HAL pin
Yep, they are the correct commands
hal.set_p will set a HAL pin
Please Log in or Create an account to join the conversation.
- snowgoer540
-
- Offline
- Moderator
-
Less
More
- Posts: 2398
- Thank you received: 787
07 Sep 2020 12:48 - 07 Sep 2020 13:30 #181148
by snowgoer540
I cant get it to do any one of these things... I think the snakes must be feeling particularly lazy today. I thought I had to use S32 pin to be able to use values other than 0 and 1. But when I do that, it doesnt change the value to 1. This must be like watching a toddler learn to crawl
Replied by snowgoer540 on topic Custom user Button Touchoff in Axis
After the == remove the both the ' from the 1, that denotes text and it is an integer.
Yep, they are the correct commands
hal.set_p will set a HAL pin
I cant get it to do any one of these things... I think the snakes must be feeling particularly lazy today. I thought I had to use S32 pin to be able to use values other than 0 and 1. But when I do that, it doesnt change the value to 1. This must be like watching a toddler learn to crawl

if hal.get_value('axisui.refresh') == 1:
commands.reload_file()
hal.set_p('axisui.refresh', '2')
if hal.get_value('axisui.refresh') == 2:
commands.clear_live_plot()
hal.set_p('axisui.refresh', '3')
if hal.get_value('axisui.refresh') == 3:
hal.set_p('axisui.refresh', '0')
commands.set_view_z()
Last edit: 07 Sep 2020 13:30 by snowgoer540.
Please Log in or Create an account to join the conversation.
- phillc54
-
- Offline
- Platinum Member
-
Less
More
- Posts: 5717
- Thank you received: 2093
07 Sep 2020 13:02 #181149
by phillc54
Replied by phillc54 on topic Custom user Button Touchoff in Axis
Change the second two from if to elif so it doesn't run them one after the other in the same cycle.
Do the hal.set_p lines before the commands lines.
You do need to start LinuxCNC each time you change this file.
That's all I can help with tonight, see ya tomorrow.
Do the hal.set_p lines before the commands lines.
You do need to start LinuxCNC each time you change this file.
That's all I can help with tonight, see ya tomorrow.
Please Log in or Create an account to join the conversation.
- snowgoer540
-
- Offline
- Moderator
-
Less
More
- Posts: 2398
- Thank you received: 787
07 Sep 2020 14:14 - 07 Sep 2020 14:14 #181153
by snowgoer540
Replied by snowgoer540 on topic Custom user Button Touchoff in Axis
Got it working! I've been sitting here for a few hours, but I learned a lot, and good news is I can move on with the day now
For instance, I learned that you cant use tabs, after beating my head against the wall for nearly an hour... tab does not equal 4 spaces lol
I would imagine Phill will push this (if he hasnt already), but to do this, you need to add the following code after line 816 (not 100% sure this is the best place to add it):
Then you need to add a pin in the add a pin area (before comp.ready()):
Lastly, your button code in your ini file becomes:
well, I can crawl a little further now than before...

I would imagine Phill will push this (if he hasnt already), but to do this, you need to add the following code after line 816 (not 100% sure this is the best place to add it):
if hal.get_value('axisui.refresh') == 1:
hal.set_p('axisui.refresh', '2')
commands.reload_file()
elif hal.get_value('axisui.refresh') == 2:
hal.set_p('axisui.refresh', '3')
commands.clear_live_plot()
elif hal.get_value('axisui.refresh') == 3:
commands.set_view_z()
hal.set_p('axisui.refresh', '0')
Then you need to add a pin in the add a pin area (before comp.ready()):
comp.newpin('refresh', hal.HAL_S32, hal.HAL_IO)
Lastly, your button code in your ini file becomes:
G10 L20 P0 X0 Y0 \ %halcmd setp axisui.refresh 1
well, I can crawl a little further now than before...
Last edit: 07 Sep 2020 14:14 by snowgoer540.
The following user(s) said Thank You: phillc54, EW_CNC
Please Log in or Create an account to join the conversation.
- phillc54
-
- Offline
- Platinum Member
-
Less
More
- Posts: 5717
- Thank you received: 2093
07 Sep 2020 23:45 - 07 Sep 2020 23:53 #181194
by phillc54
Can you set up whatever IDE/editor you are using to use spaces instead of tabs?
Edit: HAL_IN for the pin would be ok.
Replied by phillc54 on topic Custom user Button Touchoff in Axis
Great work, now all you need to do is add it into the user guide, create a new branch and submit a PR.Got it working! I've been sitting here for a few hours, but I learned a lot, and good news is I can move on with the day now
For instance, I learned that you cant use tabs, after beating my head against the wall for nearly an hour... tab does not equal 4 spaces lol
Can you set up whatever IDE/editor you are using to use spaces instead of tabs?
Edit: HAL_IN for the pin would be ok.
Last edit: 07 Sep 2020 23:53 by phillc54.
Please Log in or Create an account to join the conversation.
- snowgoer540
-
- Offline
- Moderator
-
Less
More
- Posts: 2398
- Thank you received: 787
08 Sep 2020 01:01 - 08 Sep 2020 01:11 #181200
by snowgoer540
Thanks, it is exciting when you get it to work finally...
I'm not sure, I will have to check, I was using Geany.
I wondered about IN vs IO, I looked it up and misread Table 1 here: linuxcnc.org/docs/html/hal/halmodule.html I thought the columns were related, I see now it's 3 rows...
I would actually be happy to add it to the user manual while I am editing. I'be made it down to line 258 haha, got a little bit to go.
I would need a noob guide to github to create a branch and make a pull request. This seems best done from Linux on the machine, but the last time I tried I couldnt figure it out.
Replied by snowgoer540 on topic Custom user Button Touchoff in Axis
Great work, now all you need to do is add it into the user guide, create a new branch and submit a PR.Got it working! I've been sitting here for a few hours, but I learned a lot, and good news is I can move on with the day now
For instance, I learned that you cant use tabs, after beating my head against the wall for nearly an hour... tab does not equal 4 spaces lol
Can you set up whatever IDE/editor you are using to use spaces instead of tabs?
Edit: HAL_IN for the pin would be ok.
Thanks, it is exciting when you get it to work finally...
I'm not sure, I will have to check, I was using Geany.
I wondered about IN vs IO, I looked it up and misread Table 1 here: linuxcnc.org/docs/html/hal/halmodule.html I thought the columns were related, I see now it's 3 rows...
I would actually be happy to add it to the user manual while I am editing. I'be made it down to line 258 haha, got a little bit to go.
I would need a noob guide to github to create a branch and make a pull request. This seems best done from Linux on the machine, but the last time I tried I couldnt figure it out.
Last edit: 08 Sep 2020 01:11 by snowgoer540.
Please Log in or Create an account to join the conversation.
- phillc54
-
- Offline
- Platinum Member
-
Less
More
- Posts: 5717
- Thank you received: 2093
08 Sep 2020 02:37 - 08 Sep 2020 02:49 #181204
by phillc54
Replied by phillc54 on topic Custom user Button Touchoff in Axis
You did well. If you want to do it the git way I can try to help you through.
The recent doc changes I made are below, pink are deletions and green are additions:
For the compressed backup:
github.com/LinuxCNC/linuxcnc/commit/9bb4...d5fdf0bb042ffa3ed7e1
For the final probe speed:
github.com/LinuxCNC/linuxcnc/commit/4dc4...d5fdf0bb042ffa3ed7e1
For the 2.8 release:
github.com/LinuxCNC/linuxcnc/commit/4db0...d5fdf0bb042ffa3ed7e1
Edit: these are the changes I ended up with.
The recent doc changes I made are below, pink are deletions and green are additions:
For the compressed backup:
github.com/LinuxCNC/linuxcnc/commit/9bb4...d5fdf0bb042ffa3ed7e1
For the final probe speed:
github.com/LinuxCNC/linuxcnc/commit/4dc4...d5fdf0bb042ffa3ed7e1
For the 2.8 release:
github.com/LinuxCNC/linuxcnc/commit/4db0...d5fdf0bb042ffa3ed7e1
Edit: these are the changes I ended up with.
Attachments:
Last edit: 08 Sep 2020 02:49 by phillc54.
Please Log in or Create an account to join the conversation.
Moderators: snowgoer540
Time to create page: 0.095 seconds