- Thank you received: 0
Passing a IP address to a comp when loading.
- BeagleBrainz
- Topic Author
- New Member
-
Less
More
5 years 5 months ago #209746
by BeagleBrainz
Passing a IP address to a comp when loading. was created by BeagleBrainz
I've been having a look a the ESP32 Linuxcnc software stepping gizmo, thread here
forum.linuxcnc.org/18-computer/42414-lin...t-using-esp32#207495
.
Looking at the comp the IP address of the ESP32 is hardcoded in the comp file, is there way, or how would you pass the IP address when loading.
Looking at the comp the IP address of the ESP32 is hardcoded in the comp file, is there way, or how would you pass the IP address when loading.
Please Log in to join the conversation.
5 years 5 months ago #209752
by andypugh
Replied by andypugh on topic Passing a IP address to a comp when loading.
Halcompile has a limited ability to accept custom modparams, however it only really handles ints:
github.com/LinuxCNC/linuxcnc/blob/master...ls/halcompile.g#L116
It would be cool to expand it to handle MP_ARRAY_STRING (for example) but at the moment the solution is to use "dummy" and then handle it in the code.
For an example that passes an array of strings:
github.com/LinuxCNC/linuxcnc/blob/2e75b0...ponents/message.comp
(very) limited docs: linuxcnc.org/docs/2.8/html/man/man3/RTAP...Y_STRING.3rtapi.html
You use "modparam dummy" purely to document it, in practice the RTAPI_MP..... does all the work, basically declaring and populating a global variable.
github.com/LinuxCNC/linuxcnc/blob/master...ls/halcompile.g#L116
It would be cool to expand it to handle MP_ARRAY_STRING (for example) but at the moment the solution is to use "dummy" and then handle it in the code.
For an example that passes an array of strings:
github.com/LinuxCNC/linuxcnc/blob/2e75b0...ponents/message.comp
(very) limited docs: linuxcnc.org/docs/2.8/html/man/man3/RTAP...Y_STRING.3rtapi.html
You use "modparam dummy" purely to document it, in practice the RTAPI_MP..... does all the work, basically declaring and populating a global variable.
Please Log in to join the conversation.
- BeagleBrainz
- Topic Author
- New Member
-
Less
More
- Thank you received: 0
5 years 5 months ago #209818
by BeagleBrainz
Replied by BeagleBrainz on topic Passing a IP address to a comp when loading.
Many thanks Andy, once someone points you in the right direction things can seem easier,been messing around with your suggestion, for the moment I'm using RTAPI_MP_STRING and things seem to be going smoothly.
Is it ok to use socket functions in the EXTRA_SETUP, from memory there is a function I can use to validate that the address is good. I'll have to check my socket programming book.
Is it ok to use socket functions in the EXTRA_SETUP, from memory there is a function I can use to validate that the address is good. I'll have to check my socket programming book.
Please Log in to join the conversation.
5 years 5 months ago #209827
by andypugh
I am not sure. Does it work?
I am actually wondering if anything using IP is going to work in a realtime component. Maybe this needs to be a userspace component anyway?
Replied by andypugh on topic Passing a IP address to a comp when loading.
BeagleBrainz wrote: Is it ok to use socket functions in the EXTRA_SETUP, from memory there is a function I can use to validate that the address is good. I'll have to check my socket programming book.
I am not sure. Does it work?
I am actually wondering if anything using IP is going to work in a realtime component. Maybe this needs to be a userspace component anyway?
Please Log in to join the conversation.
- BeagleBrainz
- Topic Author
- New Member
-
Less
More
- Thank you received: 0
5 years 5 months ago #209829
by BeagleBrainz
Replied by BeagleBrainz on topic Passing a IP address to a comp when loading.
I had the original unmodified code running yesterday, tho I haven't a chance to hook a stepper yet.
Please Log in to join the conversation.
Time to create page: 0.076 seconds
