How to use QT to control pins and signals in Linuxcnc via shared memory?

More
08 Mar 2022 00:44 #236621 by 961377074@qq.com
1.Now I have a signal called qqq
u@u-desktop:~$ sudo halcmd show sig qqq
Signals:
Type          Value  Name     (linked to)
bit           FALSE  qqq

2.The signal changes when I execute the following code in QT
halcmdsets("qqq","1");

3.The value of the signal is now true
u@u-desktop:~$ sudo halcmd show sig qqq
Signals:
Type          Value  Name     (linked to)
bit            TRUE  qqq

Finally, how should I write the halcmdsets? My English level is relatively poor, please forgive me for the improper description.
 

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

More
09 Mar 2022 23:31 #236791 by andypugh
Possibly you need to use pins not signals. Signals are just labels that are used to connect pins together.

I don't know how to create HAL pins in QT, but I am sure that there are examples out there.

What language are you using for the background handler code?

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

More
10 Mar 2022 05:26 #236815 by 961377074@qq.com
In the C++ language I use in QT, I want to change both the signal and the pin. I looked at the files in LinuxCNC and found the hal_lib.c file, which can help me realize the idea of changing signal values and pin values in QT. But now I have this idea but I don't know how to implement it using QT.

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

More
10 Mar 2022 08:57 #236819 by andypugh
The only example I can find of linuxcnc creating a HAL pin in C++ is in the code that the Python module calls.

But, here is that:
github.com/LinuxCNC/linuxcnc/blob/8241aa...al/halmodule.cc#L360

Basically you pass it a pointer to one of your internal variables, and the function then moves that variable into shared memory. From that point in your code you can just use the variable to get or set the pin value.

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

More
11 Mar 2022 23:23 #236965 by 961377074@qq.com
Ok, I will analyze the file halModulo. c, may I ask whether I can contact you through any chat software? I would like to continue to consult you about this aspect.

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

More
12 Mar 2022 00:50 #236969 by tommylight
@ 961377074
Please do not change the subject title.

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

More
12 Jun 2024 11:16 #302868 by TheRoslyak
Why do you need this signal? And how did you create it. (Python / C++) Maybe you need to attach to an already existing one. and hang it on the button.

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

More
12 Jun 2024 11:54 #302870 by Aciera
@TheRoslyak
That post is likely a spam setup.
First post with female username and some ChatGPT result to something found in an old thread. Then the actual spam link is added later on.
The following user(s) said Thank You: meister

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

More
12 Jun 2024 13:26 #302876 by Grotius

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

More
14 Jun 2024 12:18 #303003 by JT
You might take a look at Flex GUI for ideas.

gnipsel.com/linuxcnc/flexgui

JT

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

Time to create page: 0.187 seconds
Powered by Kunena Forum