Passing a IP address to a comp when loading.

More
21 May 2021 10:16 #209746 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.

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

More
21 May 2021 12:06 #209752 by andypugh
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.
The following user(s) said Thank You: BeagleBrainz

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

More
22 May 2021 02:11 #209818 by BeagleBrainz
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.

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

More
22 May 2021 09:12 #209827 by andypugh

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 or Create an account to join the conversation.

More
22 May 2021 10:48 #209829 by BeagleBrainz
I had the original unmodified code running yesterday, tho I haven't a chance to hook a stepper yet.

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

Time to create page: 0.065 seconds
Powered by Kunena Forum