Gmoccapy - A new screen for linuxcnc

More
8 years 9 months ago - 8 years 9 months ago #104455 by dhanger
Hi. This is dhanger's son, Caleb. Last March he posted (page 130 of this thread) about trying to get a button into gmoccapy to control his spindle brake. I am trying to help him with this endeavor as I am pretty expert with Linux (which he doesn't use at all beyond LinuxCNC) and also have a much deeper background in programming.

Mostly hoping that newbynobi can chime in on this; your help would be most appreciated!

I have created a glade file called spindle_brake_button.glade which contains "window1" (I read that GladeVCP expects the exact name "window1") and within that window I made a single HAL toggle button, named spindle_brake_button and labeled "Spindle Brake". His main config files for his machine are dm4400.ini and dm4400.hal. After backing these up, I added the EMBED lines into dm4400.ini as follows:
Code:
EMBED_TAB_NAME = spindle_brake_button EMBED_TAB_LOCATION = custom_box_4 EMBED_TAB_COMMAND = gladevcp -x {XID} -H spindle_brake_button.hal spindle_brake_button.glade

When I start LinuxCNC using the dm4400 configuration, the button loads and displays to the right of the other spindle controls, so that much is working perfectly. What I'm not sure how to do is correctly connect the new button to the spindle brake itself in the spindle_brake_button.hal file. I see in dm4400.hal the following lines relevant to the spindle brake:
Code:
net spindle-brake <= motion.spindle-brake
...
Code:
net spindle-brake => parport.0.pin-08-out

I have tried numerous different contents for spindle_brake_button.hal. At first, I had put the button into the window with no "container" since all we needed was the one button. So it was just window1 containing spindle_brake_button. In that setup, I tried all of the following for spindle_brake_button.hal:
Code:
net spindle_brake_button spindle_brake_button => gmoccapy.spindle_brake
Code:
net spindle_brake_button spindle_brake_button => spindle_brake
Code:
net spindle_brake_button => gmoccapy.spindle_brake

All of these attempts result in the button *not* being displayed in the interface when loaded. I thought, "Well, maybe it *needs* the button to be inside another container within the window." So I added a vertical box with only one slot, called vbox1, and placed the button inside of *that*. Then I tried all the following for spindle_brake_button.hal:
Code:
net spindle_brake_button vbox1.spindle_brake_button => gmoccapy.spindle_brake
Code:
net spindle_brake_button vbox1.spindle_brake_button => spindle_brake
Code:
net vbox1.spindle_brake_button => gmoccapy.spindle_brake

All of these attempts resulted in the same thing -- the button no longer displays at all in the interface. If spindle_brake_button.hal is empty, or has a commented line, the button loads fine, but of course does nothing.

Can anyone (especially newbynobi) give me any pointers? Many thanks to any/all!

Cheers,
Caleb
Last edit: 8 years 9 months ago by dhanger.

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

More
8 years 9 months ago #104465 by newbynobi
Hallo Calip,

all what you have done is basicly correct, but you do use wrong hal pin names.
Go to settings page and open halshow when the button is displayed. Look in there the exact name of the hal pin it should be something like spindle_brake_button.hal_button

The hal entry would be then similar to
net spindle-brake. spindle_brake_button.hal_button

If you start the gui from a terminal, you will see the errors.
This is not gmoccapy relatet, but you need to get basic knowledge about hal connections

Norbert

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

More
8 years 9 months ago #104492 by dhanger
Thanks for the quick reply, Norbert!

Okay, I looked in halshow and I found:
Code:
spindle_brake_button.spindle_brake_button

So, I edited my spindle_brake_button.hal to read:
Code:
net spindle_brake spindle_brake_button.spindle_brake_button

As such, the button is loaded and displayed. I'll have to wait until tomorrow to test it, because my dad's down for the night and I don't know how to work the machine. :)

I also noted that in halshow alongside the first, there is also the following (note the presence of "-not"):
Code:
spindle_brake_button.spindle_brake_button-not

I'm guessing that I can use this instead, if the polarity of the button's control of the brake is backwards?

Thanks again for the feedback!

Cheers,
Caleb

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

More
8 years 9 months ago - 8 years 9 months ago #104527 by dhanger
Caleb here again. Well, we tested it out and made some progress. It wasn't working at first, but I realized that I was mistakenly calling "spindle-brake" as "spindle_brake" (using an underscore instead of a dash). I fixed that and then we got the following error:
Code:
spindle_brake_button.hal:1: Signal 'spindle-brake' can not add OUT pin 'spindle_brake_button.spindle_brake_button', it already has OUT pin 'motion.spindle-brake'

We found the relevant line in dm4400.hal:
Code:
net spindle-brake <= motion.spindle-brake

We didn't know whether this was doing anything important or useful, so we commented it out. Then, the button loaded and worked, which we were delighted to see. I did have to reverse the polarity, which was as simple as using that "spindle_brake_button-not".

However, there used to be an *automatic* triggering of the spindle brake in certain situations (my dad could elaborate on this a lot better than I can), which is now gone. Seems pretty certain that we lost that functionality by commenting out the line about "motion.spindle-brake" from dm4400.hal, above. But we haven't gotten the new button to work without removing/commenting that line, as linuxcnc complains of conflict, also above. The hope now is to be able to have the new button work for manually toggling the spindle brake *and* keep the automatic triggering of the spindle brake in the situation(s) where it's needed...
Last edit: 8 years 9 months ago by dhanger.

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

More
8 years 9 months ago #104531 by dhanger
Hi Norbert-

This is Dan, Caleb's dad, the machine owner. Caleb refers to the 'automatic' spindle operation -- what he means is that because I have the spindle brake connected already to LinuxCNC it knows to automatically release the brake when a spindle motion command is given, and to apply the brake upon spindle stop. Somehow our alterations of the .hal file have removed that functionality in favor of manually toggling the brake with the new glade switch he is trying to add to the GUI.

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

More
8 years 9 months ago #104533 by Patrik T
It seems you have both functions working separately. To get the combined behavior you want you can use the logic hal components AND2, OR2. I read there was a programmer there, he'll fix this in a jiffy.

Google "LinuxCNC man and2"

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

Moderators: newbynobi, HansU
Time to create page: 0.137 seconds
Powered by Kunena Forum