2D device arrays
MLaletas
Posts: 226
I'm working on a particular project and within my current framework it made sense to use this. It works but just curious if anyone else has used this as well. If so how did you handle that data event? For now I have them listed out separately within the first dimension.
0
Comments
One thing to keep in mind when doing this is this kind of code can create a large number of button_events depending upon how large the array dimensions are. A single button event cannot have more than a few thousand ids. If you go beyond the limit, it will sometimes still compile and all that. It just won't work and if you're not careful, you can spend a lot of time debugging code that is not 'wrong' but still doesn't 'work'
Depending upon the size/scope of your whole project and the size of your eventual button array(s) this might be a good candidate for button_event,0 (the catchall)
And the catch all doesn't have the 4k channel limit and I think uses the resources of just one channel. A little foggy on this but those are my recolllections.
This is one of those discussion we all had back in the olden dayse of yore' that I was fascinated me. it's one of those examples of good code (from a readability standpoint) didn't always translate into good code (from a processor efficiency) stand point.
I don't enough about the under-the-hood aspect of how NX/NI processors handle events, how it stacks them and the processing of them. I have written entire systems on just one catch-all button event. It made for a pretty hefty stack of logic to traverse to get to your actual button event code. But, it did seem to be pretty zippy. I personally don't mind having many button events, however.
I remember when the catch all was introduced and I was running tests to get familar with it. I was shocked when it would catch channels above 4000 so I kept trying and I think it went up to 65535 and then I thought that would be a terrible resouce hog. Fortunately one of the engineers chimed in and said is just uses a single channel resource and very processor friendly. Thise were the good old days.
Anyway I usually only do a catchall with generic devices, source devices like STB's, BD's, etc... Codec's, DSP's, VoIP I have setup separate button event array of similar functions (dialer, content, phone book, camera control). Seems like the general opinion is the catchall is actually less resource hungry even though it's a little harder to read because of the additional logic needed. Although if you still use arrays or channels with certain ranges to clean things up.