- Posts: 5712
- Thank you received: 0
Custom user Button Touchoff in Axis
linuxcnc.org/docs/2.8/html/gui/axis.html..._an_existing_command
Please Log in to join the conversation.
- snowgoer540
- Offline
- Platinum Member
-
- Posts: 2580
- Thank you received: 0
phillc54 wrote: Find the code in Axis you want to hack then have a look here:
linuxcnc.org/docs/2.8/html/gui/axis.html..._an_existing_command
Ok, so trying to figure this out here. Not really sure I know where things go, but I found
Anyways, I added:
And further down I added
but I really dont know how to call that from a click in the ini file. Just adding "rezoom" to the button code gives an error.
Forgive how green I look at the moment, I spent over an hour trying to figure this out this evening. A few nudges in the right direction would be helpful. :blush:
Please Log in to join the conversation.
We need to add a HAL pin then test the value of that pin on every Axis update.
We need to do three things to achieve our goal, reload the file, clear the live plot then set the view to Z. These can have timing issues if we try to do them in one hit because we update every 0.1~0.15 seconds which is not enough time to complete everything. So we need to run them sequentially, each time we do one function we increment the HAL pin then test again on the next cycle. We don't care if the HAL pin get set to an unused value as the sequence only begins if the value is one.
The button coded ended up:
Edit: refresh is probably a better name for the HAL pin as it doesn't actually touchoff
Video:
Please Log in to join the conversation.
- snowgoer540
- Offline
- Platinum Member
-
- Posts: 2580
- Thank you received: 0
This looks awesome! I can't wait to see the code to see how many weeks it would have taken me to do the same lol
Please Log in to join the conversation.
Please Log in to join the conversation.
- snowgoer540
- Offline
- Platinum Member
-
- Posts: 2580
- Thank you received: 0
Ok, so what I'm thinking at my kitchen table with my first cup of coffee is, you created a HAL pin, and set it to 0. Then plasmac_axis checks constantly to see if it changed states. When you press the button, it changes the HAL pin from a 0 to a 1. Then that kicks off a little routine, which increments at each read cycle of the system. Cycle 1 reloads the file. Cycle 2 clears the live plot. Cycle 3 re-zooms the preview, and sets both the HAL pin and the counter back to zero. Sound close?phillc54 wrote: If you want to keep practising then the first function you found is used along with two others with a similar beginning.
Please Log in to join the conversation.
Yep, that it...snowgoer540 wrote: Ok, so what I'm thinking at my kitchen table with my first cup of coffee is, you created a HAL pin, and set it to 0. Then plasmac_axis checks constantly to see if it changed states. When you press the button, it changes the HAL pin from a 0 to a 1. Then that kicks off a little routine, which increments at each read cycle of the system. Cycle 1 reloads the file. Cycle 2 clears the live plot. Cycle 3 re-zooms the preview, and sets both the HAL pin and the counter back to zero. Sound close?
Please Log in to join the conversation.
- snowgoer540
- Offline
- Platinum Member
-
- Posts: 2580
- Thank you received: 0
On my end, the logic of it is the easy part... now to figure out how to charm the Python snakes. :lol:phillc54 wrote: Yep, that it...
Please Log in to join the conversation.
- snowgoer540
- Offline
- Platinum Member
-
- Posts: 2580
- Thank you received: 0
Please Log in to join the conversation.
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.snowgoer540 wrote: Give me one quick nudge here please... where is the proper place to establish the "axisui.refresh" HAL pin? Hal connections file?
Please Log in to join the conversation.
