'Catch all' event
PhreaK
Posts: 966
Has anyone got any techniques they'd be nice enough to share when it comes to having events which catch everything from all ports of a device? eg. one event to catch events from 41001:1:0, 41001:2:0 ... 41001:n:0. Currently I build an array on boot that contains up to port n, where n is the max port I'm interested in, then rebuild the event tables. Just wondering if anyone's got a more elegant solution.
P.S. yes i've tried and event for 41001:0:0, unfortunately it doesn't play nice like the channels do.
P.S. yes i've tried and event for 41001:0:0, unfortunately it doesn't play nice like the channels do.
0
Comments
Just to make sure I understand you correctly, you want something more elegant than this?
Am I understanding correctly?
Cheers
Mush
Which is called in DEFINE_START. Just curious as to how others approach it.
Ahh.. I see.
I presume this is in a comms module for an unknown amount of separate modules that 'plug in' at run time?
In your inner for loop you are initializing component to 1 and decrementing. Is that what you want to do? Is there some reason they are chars instead of integers?
Are you saying that you don't know the value of DSP_MAX_COMPONENTS until run time? That shouldn't matter, just get it at some point and then run your for loops.
Paul
I think he is saying he doesn't know the length of vdvDSP until run time?
Inner loop decriment was a typo, removed some other guff as I pasted.
I'm using chars because it's impossible for those values to ever be larger than 255. Every byte is precious, especially when the code is on old NI-X000's.
@mush
Exactly. The code has to be flexible to allow for an unknown number of devices, each with an unknown number of components.
Interesting way of doing it and I guess it depends on which device you are trying to program.
When we send a string to the comms module we include the device number of who sent it, the ID of the device we are trying to reach and the data we are trying to send.
The comms module then knows who to send what and doesn't need to keep a list of devices.
Not as refined as your way but it works well!
Mush
I wouldn't worry about using one more byte in a stack_var that is reallocated as soon as the function ends. That seems a bit extreme.
If 256 is the max for those values can't you just make the array that big? At some point during runtime you will know how many DSPs there are so set the variable in the for loop guard to that and run your loops. You can prune your array using set_length_array if need be.
Paul
If I was to just set it to the max it would end up being a 65536 element array (256 devices * 256 components).