Check entire range of universes when attempting to group multicast controllers, rather than just checking the start universe
This commit is contained in:
parent
31e35884dd
commit
d3aefcfdf4
1 changed files with 15 additions and 1 deletions
|
|
@ -204,12 +204,26 @@ void DetectE131Controllers(std::vector<RGBController*> &rgb_controllers)
|
|||
{
|
||||
for(unsigned int device_idx = 0; device_idx < device_lists[list_idx].size(); device_idx++)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Determine if there is any overlap between this device and |
|
||||
| any existing device list |
|
||||
| Offset the end by two - one because the range is 1-512 |
|
||||
| rather than 0-511, and one because the start channel is |
|
||||
| included in the first set of 3 channels. |
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned int dev_start = dev.start_universe;
|
||||
unsigned int list_start = device_lists[list_idx][device_idx].start_universe;
|
||||
unsigned int dev_end = dev.start_universe + ((dev.start_channel + (3 * dev.num_leds) - 2) / 512);
|
||||
unsigned int list_end = device_lists[list_idx][device_idx].start_universe + ((device_lists[list_idx][device_idx].start_channel + (3 * device_lists[list_idx][device_idx].num_leds) - 2) / 512);
|
||||
|
||||
bool overlap = !(dev_end < list_start || list_end < dev_start);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Check if any universes used by this new device exist in |
|
||||
| the existing device. If so, add the new device to the |
|
||||
| existing list. |
|
||||
\*---------------------------------------------------------*/
|
||||
if(dev.start_universe == device_lists[list_idx][device_idx].start_universe)
|
||||
if(overlap)
|
||||
{
|
||||
device_lists[list_idx].push_back(dev);
|
||||
device_added_to_existing_list = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue