(Solved?) Feed override encoder reset

More
13 Sep 2021 20:20 #220499 by russell
Hi,
  I've connected a pair of rotary encoders to the inmux mpg encoder inputs on a mesa 7c80 and am using them to control the spindle and feed override via the halui pins which seems to work fine. The encoders also have a push switch and I would like to use these to reset the overrides back to 100% but I can't work out how. I'm using the Probe Basic GUI and there doesn't seem to be any way to trigger the reset via HAL and the INMUX encoder doesn't seem to have a reset signal.

I think the easiest way to implement the reset is to create a component to insert in to the signal chain between the INMUX encoder output and the HALUI input but wanted to check that I've not missed a more elegant solution?

Cheers
 Russell

Please Log in or Create an account to join the conversation.

More
14 Sep 2021 03:04 #220547 by PCW
Replied by PCW on topic Feed override encoder reset
well... actually the counter should have a reset, there's no hardware reset in the
firmware but an offset could be captured and applied in the driver. Are you running master?

Please Log in or Create an account to join the conversation.

More
14 Sep 2021 06:22 #220558 by russell
Replied by russell on topic Feed override encoder reset
Hi, Yes I am running master

Please Log in or Create an account to join the conversation.

More
14 Sep 2021 18:20 #220637 by russell
Replied by russell on topic Feed override encoder reset
I've added a reset function to the inmux driver which was fairly trivial todo, but unfortunately it turned out not to be sufficient to reset the overrides to 100%.

it looks like I need to set halui.feed-override.counts to 1 and then toggle halui.feed-override.direct-value I could do that by connecting the direct-value pin to the reset pin and changing inmux reset logic to set count to 1 instead of 0 but that doesn't feel right, so I think I'm going to create a Hal component I can also use that to handle the run/pause/stop button logic as well.

I have a diff for the inmux change if anyone wants it.

Regards
Russell

Please Log in or Create an account to join the conversation.

More
14 Sep 2021 19:56 #220644 by PCW
Replied by PCW on topic Feed override encoder reset
I guess instead of a fixed reset you could have a per channel S32 offset
pin (which defaults to 0) Then a reset could set the count to the offset value

Please Log in or Create an account to join the conversation.

More
15 Sep 2021 04:19 #220669 by cmorley
Replied by cmorley on topic Feed override encoder reset
I think you should add the ability to halui. that is where the current count of the encoders is kept.

Please Log in or Create an account to join the conversation.

More
15 Sep 2021 17:52 #220723 by russell
Replied by russell on topic Feed override encoder reset
Yes, I had the same thought this morning t and I've just added the following reset pins
halui.feed-override.reset
halui.rapid-overide.reset
haui.spindle.n.override.reset

Initial testing seems ok, but I'll wait until I've tested it properly at the weekend before raising a pull request

One thing I did notice some strange behaviour but it's the same with the GUI slider - its hard to get the value to go past 112% - I suspect its an artefact of the conversion from int to float.

Please Log in or Create an account to join the conversation.

More
17 Sep 2021 01:35 #220848 by cmorley
Replied by cmorley on topic Feed override encoder reset
i look forward to the pull request.

Please Log in or Create an account to join the conversation.

More
10 Oct 2021 02:07 #222707 by spumco
I got this working after a bit of fiddling.  I suspect it won't work for other GUI's but it works on Probe Basic.

I don't know how to submit a pull request (assuming that's a request for adding functions/bug-fixes to LCNC?), but one should probably still be submitted so this function is available for all GUI's.  Having a physical override reset button is super-handy.

QtPyVCP creates pin qtpyvcp.feed-override.reset which is visible in halshow.  Triggering that pin will set halui.feed-override.value to 1.  We can test  this in halshow by setting the pin TRUE after twiddling the slider a bit.  Slider will reset to 100% and pin value will change to 1.  Yay!

The trick is that the qtpyvcp pin isn't created until after Probe Basic loads, so we need to connect to the pin in the postgui hal file.

Step 1 - add encoder to main HAL file.  Some of this may have been done in pncconf already.
#---Set override initial state
setp halui.feed-override.direct-value false
setp halui.feed-override.scale .01 (edit for encoder sensitivity, 0.01 = 1% per encoder click)
setp halui.feed-override.count-enable true

#---Connect pins to signals
net fo-count   <= [HMOT](CARD0).7i73.0.1.enc0.count
net fo-count   => halui.feed-override.counts

#--Add encoder pushbutton switch
net fo-reset   <= [HMOT](CARD0).7i73.0.1.input-14

Step 2 - connect reset function to Probe Basic screen action pin in custom_postgui.hal file
net fo-reset   => qtpyvcp.feed-override.reset

Step 3 - ensure INI file calls up the post GUI file
[HAL]
HALUI = halui
HALFILE = yourmachinehere.hal
POSTGUI_HALFILE = custom_postgui.hal
...

NOTE 1 - works for feed, spindle, rapid, and max velocity overrides.
NOTE 2 - Maybe not obvious to beginners, but you'll have to change the input pins above to match your particular setup

Hope this helps.  Feel free to edit the thread title if it fails or is inappropriate.

-Ralph

Please Log in or Create an account to join the conversation.

More
10 Oct 2021 04:58 #222709 by cmorley
I'm glad you got something to work for you - there are many ways to skin a cat!

There really is no reason for a pull request in the way you did this.
Qtpyvcp is not part of linuxcnc so you would need to request them for the change in their GUI.
I assume you use qtpyvcp to set the override directly in code?
If that's true you might as well just do all the override work in qtpyvcp and forget about halui (IMHO)

I had envisioned a pin added to HALUI for resetting the overrides

Chris

Please Log in or Create an account to join the conversation.

Time to create page: 0.224 seconds
Powered by Kunena Forum