View Single Post
Old March 2nd, 2010   #14
ericthegeek
Task Group Member
 
Join Date: Aug 2008
Posts: 375
Default

As Michael said earlier, you don't need an actual queue.

Lets say you have 5 sub-devices, each with 2 PIDs that you need to track QUEUED_MESSAGES for (DMX address and Personality). That's a total of 10 possible queued messages. So, you allocate 10 bits. If all 5 personalities change, you just set the 5 bits (one for each sub-device). Then, when the responder receives a "GET QUEUED_MESSAGES" it scans through the 10 bits until it finds one that's set, sends the matching response, and clears the bit.

If the same parameters changes two times before it's reported to the console, it doesn't matter. The console only needs the most recent data.

A big advantage of this method is that your queue can never overflow (since there's no queue). It's easy to implement on microcontrollers with a few bit-test instructions and you can statically allocate all of the bits you need up front.
ericthegeek is offline   Reply With Quote