Add universe_size field to E1.31 configuration to set number of channels per universe
This commit is contained in:
parent
501a1ff489
commit
212c3e6297
3 changed files with 15 additions and 5 deletions
|
|
@ -52,6 +52,7 @@ void DetectE131Controllers(std::vector<RGBController*> &rgb_controllers)
|
|||
dev.matrix_height = 0;
|
||||
dev.start_channel = 1;
|
||||
dev.start_universe = 1;
|
||||
dev.universe_size = 512;
|
||||
|
||||
if(e131_settings["devices"][device_idx].contains("name"))
|
||||
{
|
||||
|
|
@ -164,6 +165,11 @@ void DetectE131Controllers(std::vector<RGBController*> &rgb_controllers)
|
|||
dev.matrix_height = e131_settings["devices"][device_idx]["matrix_height"];
|
||||
}
|
||||
|
||||
if(e131_settings["devices"][device_idx].contains("universe_size"))
|
||||
{
|
||||
dev.universe_size = e131_settings["devices"][device_idx]["universe_size"];
|
||||
}
|
||||
|
||||
if(e131_settings["devices"][device_idx].contains("type"))
|
||||
{
|
||||
std::string type_val = e131_settings["devices"][device_idx]["type"];
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ RGBController_E131::RGBController_E131(std::vector<E131Device> device_list)
|
|||
|
||||
for(unsigned int device_idx = 0; device_idx < devices.size(); device_idx++)
|
||||
{
|
||||
unsigned int total_universes = ceil( ( ( devices[device_idx].num_leds * 3 ) + devices[device_idx].start_channel ) / 512.0f );
|
||||
float universe_size = devices[device_idx].universe_size;
|
||||
unsigned int total_universes = ceil( ( ( devices[device_idx].num_leds * 3 ) + devices[device_idx].start_channel ) / universe_size );
|
||||
|
||||
for(unsigned int univ_idx = 0; univ_idx < total_universes; univ_idx++)
|
||||
{
|
||||
|
|
@ -141,7 +142,8 @@ RGBController_E131::RGBController_E131(std::vector<E131Device> device_list)
|
|||
/*-----------------------------------------*\
|
||||
| Add Universes |
|
||||
\*-----------------------------------------*/
|
||||
unsigned int total_universes = ceil( ( ( devices[device_idx].num_leds * 3 ) + devices[device_idx].start_channel ) / 512.0f );
|
||||
float universe_size = devices[device_idx].universe_size;
|
||||
unsigned int total_universes = ceil( ( ( devices[device_idx].num_leds * 3 ) + devices[device_idx].start_channel ) / universe_size );
|
||||
|
||||
for (unsigned int univ_idx = 0; univ_idx < total_universes; univ_idx++)
|
||||
{
|
||||
|
|
@ -161,7 +163,7 @@ RGBController_E131::RGBController_E131(std::vector<E131Device> device_list)
|
|||
e131_packet_t packet;
|
||||
e131_addr_t dest_addr;
|
||||
|
||||
e131_pkt_init(&packet, universe, 512);
|
||||
e131_pkt_init(&packet, universe, universe_size);
|
||||
|
||||
if(multicast)
|
||||
{
|
||||
|
|
@ -363,7 +365,8 @@ void RGBController_E131::DeviceUpdateLEDs()
|
|||
|
||||
for(std::size_t device_idx = 0; device_idx < devices.size(); device_idx++)
|
||||
{
|
||||
unsigned int total_universes = ceil( ( ( devices[device_idx].num_leds * 3 ) + devices[device_idx].start_channel ) / 512.0f );
|
||||
float universe_size = devices[device_idx].universe_size;
|
||||
unsigned int total_universes = ceil( ( ( devices[device_idx].num_leds * 3 ) + devices[device_idx].start_channel ) / universe_size );
|
||||
unsigned int channel_idx = devices[device_idx].start_channel;
|
||||
unsigned int led_idx = 0;
|
||||
unsigned int rgb_idx = 0;
|
||||
|
|
@ -377,7 +380,7 @@ void RGBController_E131::DeviceUpdateLEDs()
|
|||
{
|
||||
if(!done && (universes[packet_idx] == universe))
|
||||
{
|
||||
while(!done && (channel_idx <= 512))
|
||||
while(!done && (channel_idx <= universe_size))
|
||||
{
|
||||
switch(rgb_idx)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ struct E131Device
|
|||
zone_type type;
|
||||
unsigned int matrix_width;
|
||||
unsigned int matrix_height;
|
||||
unsigned int universe_size;
|
||||
e131_matrix_order matrix_order;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue