LED to indicate M3/M5 status

More
06 Aug 2024 17:08 #307110 by garthnoakes
Hi

Is there an example on the forum of how to do this? I guess it would just be based on the relevant HAL pin?

If M3 is active, I would like a large red icon, if M5 is active either a grey version of that or nothing

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

More
14 Aug 2024 13:32 #307713 by Todd Zuercher
If all you want is an LED indicator, then yes, simply, connecting the hal pin "spindle.0.on" to your your Glade Hal_Led's hal input pin in a post gui hal file would be all you would need to do.

If you are asking how to make the Hal_LED display a large red image that says "Spindle OFF", that is slightly more complicated.

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

More
14 Aug 2024 14:12 #307716 by Todd Zuercher
For the 2nd option. To display an image instead of Hal_LED's small colored circle or box, the simple answer is you can't. You must use a different widget to do this. You could use a GtkImage widget to display your images for spindle ON and OFF, then use your Python handler file to define what images are displayed and create the nessisary hal pin to select between them.

I've done something similar to this, but more complicated for the spindles on a machine I've set up. On that machine I have multiple spindles controled by Modbus, and I set up a series of GTK Images to display the status of each of them. It uses S32 hal pins to display one of about a dozen different images for each VFD, such as "Com Error", "Run", "Stop", "Accel", "Decel". "Fault"...

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

More
16 Aug 2024 18:48 #307953 by garthnoakes
Where I'm struggling is with the widgets - managed to get a label and led onto a fixed window - but I can't figure out how to move them. They seem to only resize

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

More
17 Aug 2024 18:07 #308013 by garthnoakes
Can you post the code to do this? I've tried various things but my LED pin is not seen (although it shows in HAL monitor as gladevcp.LED1)

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

More
19 Aug 2024 14:40 #308140 by Todd Zuercher
For positioning, I normally use a grid widget to give the rough position to an item within the main window. Then within its box, you can tell it to center, or be to the top,bottom, left or right.

When you try to connect glade halpin to a signal, you must do it in a hal file that is loaded after the gui is started (aka the post-gui-hal file.) If you try to use the pin name in one of your regular hal files that are loaded before the gui is functioning, you will get a hal pin not found error and Linuxcnc will close without opening.

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

More
19 Aug 2024 14:57 #308143 by garthnoakes
Thanks - I have it working using pyvcp, I connected the pin to both the LED and joystick in the postgui file.

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

Moderators: HansU
Time to create page: 0.081 seconds
Powered by Kunena Forum