mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-04-04 06:11:07 -04:00
Zone and Segment type updates
* Add zone flags to indicate if fields are manually configurable and if they have been manually configured * Add flags field to segment type * Add segment flags for group start and group member * Add color mode support flags to zone (RGB, RBG, GRB, GBR, BRG, BGR) * Add color mode enum to zone * Update zone and segment description functions to support new fields * Rename the effects-only configurable size flag * Remove zone type and matrix map configuration from E1.31 manual configuration, use zone editor instead * Rework DeviceResizeZone to DeviceConfigureZone * Rework most ARGB controllers to allow zone customizations * Rework DRGBController to define devices in DRGBDevices list (similar to RazerDevices) * Rework NollieController to define devices in NollieDevices list (similar to RazerDevices)
This commit is contained in:
@@ -194,6 +194,16 @@ RGBController_PolychromeUSB::~RGBController_PolychromeUSB()
|
||||
|
||||
void RGBController_PolychromeUSB::SetupZones()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
{
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
@@ -204,28 +214,54 @@ void RGBController_PolychromeUSB::SetupZones()
|
||||
/*-------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-------------------------------------------------*/
|
||||
for(unsigned int channel_idx = 0; channel_idx < zones.size(); channel_idx++)
|
||||
for(std::size_t channel_idx = 0; channel_idx < zones.size(); channel_idx++)
|
||||
{
|
||||
PolychromeDeviceInfo device_info = controller->GetPolychromeDevices()[channel_idx];
|
||||
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
|
||||
if(device_info.device_type== PolychromeDeviceType::ADDRESSABLE)
|
||||
{
|
||||
zones[channel_idx].name = polychrome_USB_zone_names[device_info.zone_type];
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = ASROCK_ADDRESSABLE_MAX_LEDS;
|
||||
zones[channel_idx].leds_count = device_info.num_leds;
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = ASROCK_ADDRESSABLE_MAX_LEDS;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[channel_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[channel_idx].name = polychrome_USB_zone_names[device_info.zone_type];
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[channel_idx].leds_count = device_info.num_leds;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[channel_idx].matrix_map.width = 0;
|
||||
zones[channel_idx].matrix_map.height = 0;
|
||||
zones[channel_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
}
|
||||
else if(device_info.device_type==PolychromeDeviceType::FIXED)
|
||||
{
|
||||
zones[channel_idx].name = polychrome_USB_zone_names[device_info.zone_type];
|
||||
zones[channel_idx].leds_min = device_info.num_leds;
|
||||
zones[channel_idx].leds_max = device_info.num_leds;
|
||||
zones[channel_idx].leds_count = device_info.num_leds;
|
||||
zones[channel_idx].name = polychrome_USB_zone_names[device_info.zone_type];
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
zones[channel_idx].leds_min = device_info.num_leds;
|
||||
zones[channel_idx].leds_max = device_info.num_leds;
|
||||
zones[channel_idx].leds_count = device_info.num_leds;
|
||||
}
|
||||
|
||||
|
||||
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
{
|
||||
led new_led;
|
||||
@@ -278,10 +314,14 @@ void RGBController_PolychromeUSB::SetupZones()
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_PolychromeUSB::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_PolychromeUSB::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
zones[zone].leds_count = (unsigned char) new_size;
|
||||
controller->SetZoneSize(zones_info[zone].zone, new_size);
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
controller->SetZoneSize(zones_info[zone_idx].zone, zones[zone_idx].leds_count);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_PolychromeUSB::DeviceUpdateLEDs()
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -298,10 +298,9 @@ void RGBController_ASRockPolychromeV1SMBus::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_ASRockPolychromeV1SMBus::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_ASRockPolychromeV1SMBus::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
LOG_TRACE("[%s] DeviceResizeZone(%02X, %02X)", name.c_str(), zone, new_size);
|
||||
controller-> SetARGBSize(new_size & 0xFF);
|
||||
controller-> SetARGBSize(zones[zone_idx].leds_count & 0xFF);
|
||||
zones[POLYCHROME_V1_ZONE_ADDRESSABLE].leds_count = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -281,7 +281,7 @@ void RGBController_ASRockPolychromeV2SMBus::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_ASRockPolychromeV2SMBus::DeviceResizeZone(int /*zone*/, int /*new_size*/)
|
||||
void RGBController_ASRockPolychromeV2SMBus::DeviceConfigureZone(int /*zone_idx*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -147,41 +147,67 @@ void RGBController_AuraUSB::SetupZones()
|
||||
| Set zones and leds |
|
||||
\*-------------------------------------------------*/
|
||||
int addressableCounter = 1;
|
||||
for (unsigned int channel_idx = 0; channel_idx < zones.size(); channel_idx++)
|
||||
|
||||
for(std::size_t channel_idx = 0; channel_idx < zones.size(); channel_idx++)
|
||||
{
|
||||
AuraDeviceInfo device_info = controller->GetAuraDevices()[channel_idx];
|
||||
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
|
||||
if(device_info.device_type == AuraDeviceType::FIXED)
|
||||
{
|
||||
zones[channel_idx].name = "Aura Mainboard";
|
||||
zones[channel_idx].leds_min = device_info.num_leds;
|
||||
zones[channel_idx].leds_max = device_info.num_leds;
|
||||
zones[channel_idx].leds_count = device_info.num_leds;
|
||||
zones[channel_idx].name = "Aura Mainboard";
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
zones[channel_idx].leds_min = device_info.num_leds;
|
||||
zones[channel_idx].leds_max = device_info.num_leds;
|
||||
zones[channel_idx].leds_count = device_info.num_leds;
|
||||
}
|
||||
else
|
||||
{
|
||||
zones[channel_idx].name = "Aura Addressable ";
|
||||
zones[channel_idx].name.append(std::to_string(addressableCounter));
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = AURA_ADDRESSABLE_MAX_LEDS;
|
||||
|
||||
addressableCounter++;
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = AURA_ADDRESSABLE_MAX_LEDS;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
zones[channel_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[channel_idx].name = "Addressable RGB Header ";
|
||||
zones[channel_idx].name.append(std::to_string(addressableCounter));
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[channel_idx].matrix_map.width = 0;
|
||||
zones[channel_idx].matrix_map.height = 0;
|
||||
zones[channel_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
addressableCounter++;
|
||||
}
|
||||
|
||||
unsigned int num_mainboard_leds = device_info.num_leds - device_info.num_headers;
|
||||
for (unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
|
||||
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
{
|
||||
unsigned led_idx = led_ch_idx + 1;
|
||||
led new_led;
|
||||
|
||||
new_led.name = zones[channel_idx].name;
|
||||
|
||||
if(device_info.device_type == AuraDeviceType::FIXED && led_ch_idx >= num_mainboard_leds)
|
||||
{
|
||||
new_led.name.append(", RGB Header ");
|
||||
@@ -191,6 +217,7 @@ void RGBController_AuraUSB::SetupZones()
|
||||
{
|
||||
new_led.name.append(", LED ");
|
||||
}
|
||||
|
||||
new_led.name.append(std::to_string(led_idx));
|
||||
|
||||
new_led.value = channel_idx;
|
||||
@@ -202,17 +229,10 @@ void RGBController_AuraUSB::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_AuraUSB::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_AuraUSB::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -51,81 +51,82 @@ RGBController_BlinkyTape::~RGBController_BlinkyTape()
|
||||
|
||||
void RGBController_BlinkyTape::SetupZones()
|
||||
{
|
||||
zones.clear();
|
||||
/*-------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
{
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(1);
|
||||
|
||||
zone led_zone;
|
||||
led_zone.name = "LED Strip";
|
||||
led_zone.type = ZONE_TYPE_LINEAR;
|
||||
led_zone.leds_min = 0;
|
||||
led_zone.leds_max = 512;
|
||||
led_zone.leds_count = 0;
|
||||
zones.push_back(led_zone);
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up zones |
|
||||
\*-----------------------------------------------------*/
|
||||
zones[0].leds_min = 0;
|
||||
zones[0].leds_max = 512;
|
||||
|
||||
DeviceResizeZone(0, led_zone.leds_count);
|
||||
}
|
||||
|
||||
void RGBController_BlinkyTape::DeviceResizeZone(int zone, int new_size)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Explicitly cast these to avoid compiler warnings |
|
||||
\*-------------------------------------------------*/
|
||||
const unsigned int zone_u = static_cast<unsigned int>(zone);
|
||||
const unsigned int new_size_u = static_cast<unsigned int>(new_size);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Check that the zone is in bounds |
|
||||
\*-------------------------------------------------*/
|
||||
if((zone_u > zones.size()) || (zone < 0))
|
||||
if(first_run)
|
||||
{
|
||||
return;
|
||||
zones[0].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| And that the new size is in bounds |
|
||||
\*-------------------------------------------------*/
|
||||
if((new_size_u > zones.at(zone).leds_max) || (new_size_u < zones.at(zone).leds_min))
|
||||
if(!(zones[0].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
return;
|
||||
zones[0].name = "Addressable RGB Header";
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| And that there's actually a change |
|
||||
\*-------------------------------------------------*/
|
||||
if(zones.at(zone).leds_count == new_size_u)
|
||||
if(!(zones[0].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
return;
|
||||
zones[0].leds_count = 0;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| If the new size is less than the current size, |
|
||||
| just chop off the end |
|
||||
\*-------------------------------------------------*/
|
||||
if(leds.size() > new_size_u)
|
||||
if(!(zones[0].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
leds.resize(new_size);
|
||||
zones[0].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Otherwise, add new LEDs to the end |
|
||||
\*-------------------------------------------------*/
|
||||
if(leds.size() < new_size_u)
|
||||
if(!(zones[0].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
for(size_t led_idx = leds.size(); led_idx < new_size_u; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = "LED ";
|
||||
new_led.name.append(std::to_string(led_idx));
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
zones[0].matrix_map.width = 0;
|
||||
zones[0].matrix_map.height = 0;
|
||||
zones[0].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
zones.at(zone).leds_count = new_size;
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up LEDs |
|
||||
\*-----------------------------------------------------*/
|
||||
for(size_t led_idx = leds.size(); led_idx < zones[0].leds_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = zones[0].name + ", LED ";
|
||||
new_led.name.append(std::to_string(led_idx));
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_BlinkyTape::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_BlinkyTape::DeviceUpdateLEDs()
|
||||
{
|
||||
controller->SetLEDs(colors);
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -398,29 +398,46 @@ void RGBController_CMARGBController::SetupZones()
|
||||
\*-----------------------------------------------------*/
|
||||
for(unsigned int channel_idx = 0; channel_idx < 4; channel_idx++)
|
||||
{
|
||||
char ch_idx_string[2];
|
||||
snprintf(ch_idx_string, 2, "%d", channel_idx + 1);
|
||||
|
||||
zones[channel_idx].name = "Addressable RGB Header ";
|
||||
zones[channel_idx].name.append(ch_idx_string);
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = 48;
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = 48;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
zones[channel_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[channel_idx].name = "Addressable RGB Header ";
|
||||
zones[channel_idx].name.append(std::to_string(channel_idx + 1));
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[channel_idx].matrix_map.width = 0;
|
||||
zones[channel_idx].matrix_map.height = 0;
|
||||
zones[channel_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
{
|
||||
char led_idx_string[4];
|
||||
snprintf(led_idx_string, 4, "%d", led_ch_idx + 1);
|
||||
|
||||
led new_led;
|
||||
new_led.name = zones[channel_idx].name;
|
||||
new_led.name.append(", LED ");
|
||||
new_led.name.append(led_idx_string);
|
||||
new_led.name.append(std::to_string(led_ch_idx + 1));
|
||||
new_led.value = channel_idx;
|
||||
|
||||
leds.push_back(new_led);
|
||||
@@ -444,18 +461,11 @@ void RGBController_CMARGBController::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CMARGBController::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_CMARGBController::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
controller->SetPortLEDCount(zone, zones[zone].leds_count);
|
||||
controller->SetPortLEDCount(zone_idx, zones[zone_idx].leds_count);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
void SetupModes();
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -220,10 +220,8 @@ void RGBController_CMARGBGen2A1Controller::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CMARGBGen2A1Controller::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_CMARGBGen2A1Controller::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
unsigned int total_leds = 0;
|
||||
|
||||
for(unsigned int channel = 0; channel < CM_ARGB_GEN2_A1_CHANNEL_COUNT; channel++)
|
||||
@@ -238,7 +236,7 @@ void RGBController_CMARGBGen2A1Controller::DeviceResizeZone(int zone, int new_si
|
||||
leds[i].name = "LED " + std::to_string(i + 1);
|
||||
}
|
||||
|
||||
controller->SetupZoneSize(zone, new_size);
|
||||
controller->SetupZoneSize(zone_idx, zones[zone_idx].leds_count);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
~RGBController_CMARGBGen2A1Controller();
|
||||
|
||||
void SetupZones();
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
void UpdateSegmentLEDs(int zone, int subchannel);
|
||||
|
||||
@@ -18,11 +18,10 @@ cm_small_argb_headers cm_small_argb_header_data[1] =
|
||||
{ "CM Small ARGB", 0x01, true, 12 }
|
||||
};
|
||||
|
||||
CMSmallARGBController::CMSmallARGBController(hid_device* dev_handle, char *_path, unsigned char _zone_idx)
|
||||
CMSmallARGBController::CMSmallARGBController(hid_device* dev_handle, char *_path)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = _path;
|
||||
zone_index = _zone_idx;
|
||||
current_speed = CM_SMALL_ARGB_SPEED_NORMAL;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
@@ -51,7 +50,7 @@ void CMSmallARGBController::GetStatus()
|
||||
{
|
||||
unsigned char buffer[CM_SMALL_ARGB_PACKET_SIZE] = { 0x00, 0x80, 0x01, 0x01 };
|
||||
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
|
||||
int header = zone_index - 1;
|
||||
int header = 0 - 1;
|
||||
|
||||
buffer[CM_SMALL_ARGB_ZONE_BYTE] = header;
|
||||
buffer[CM_SMALL_ARGB_MODE_BYTE] = 0x01;
|
||||
@@ -98,11 +97,6 @@ std::string CMSmallARGBController::GetLocation()
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
unsigned char CMSmallARGBController::GetZoneIndex()
|
||||
{
|
||||
return(zone_index);
|
||||
}
|
||||
|
||||
unsigned char CMSmallARGBController::GetMode()
|
||||
{
|
||||
return(current_mode);
|
||||
@@ -177,7 +171,7 @@ void CMSmallARGBController::SetLedsDirect(RGBColor* led_colours, unsigned int le
|
||||
colours.push_back( RGBGetBValue(colour) );
|
||||
}
|
||||
|
||||
buffer[CM_SMALL_ARGB_ZONE_BYTE] = zone_index - 1; //argb_header_data[zone_index].header;
|
||||
buffer[CM_SMALL_ARGB_ZONE_BYTE] = 0 - 1; //argb_header_data[zone_index].header;
|
||||
buffer[CM_SMALL_ARGB_MODE_BYTE] = led_count;
|
||||
unsigned char buffer_idx = CM_SMALL_ARGB_MODE_BYTE + 1;
|
||||
|
||||
@@ -225,7 +219,7 @@ void CMSmallARGBController::SendUpdate()
|
||||
|
||||
buffer[CM_SMALL_ARGB_COMMAND_BYTE] = 0x0b;
|
||||
buffer[CM_SMALL_ARGB_FUNCTION_BYTE] = (false) ? 0x01 : 0x02; //This controls custom mode TODO
|
||||
buffer[CM_SMALL_ARGB_ZONE_BYTE] = cm_small_argb_header_data[zone_index].header;
|
||||
buffer[CM_SMALL_ARGB_ZONE_BYTE] = cm_small_argb_header_data[0].header;
|
||||
buffer[CM_SMALL_ARGB_MODE_BYTE] = current_mode;
|
||||
buffer[CM_SMALL_ARGB_SPEED_BYTE] = current_speed;
|
||||
buffer[CM_SMALL_ARGB_COLOUR_INDEX_BYTE] = (bool_random) ? 0x00 : 0x10; //This looks to still be the colour index and controls random colours
|
||||
|
||||
@@ -74,14 +74,13 @@ enum
|
||||
class CMSmallARGBController
|
||||
{
|
||||
public:
|
||||
CMSmallARGBController(hid_device* dev_handle, char *_path, unsigned char _zone_idx);
|
||||
CMSmallARGBController(hid_device* dev_handle, char *_path);
|
||||
~CMSmallARGBController();
|
||||
|
||||
std::string GetDeviceName();
|
||||
std::string GetSerial();
|
||||
std::string GetLocation();
|
||||
|
||||
unsigned char GetZoneIndex();
|
||||
unsigned char GetMode();
|
||||
unsigned char GetLedRed();
|
||||
unsigned char GetLedGreen();
|
||||
@@ -97,7 +96,6 @@ private:
|
||||
std::string location;
|
||||
hid_device* dev;
|
||||
|
||||
unsigned char zone_index;
|
||||
unsigned char current_mode;
|
||||
unsigned char current_speed;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ RGBController_CMSmallARGBController::RGBController_CMSmallARGBController(CMSmall
|
||||
controller = controller_ptr;
|
||||
unsigned char speed = controller->GetLedSpeed();
|
||||
|
||||
name = cm_small_argb_header_data[controller->GetZoneIndex()].name;
|
||||
name = cm_small_argb_header_data[0].name;
|
||||
vendor = "Cooler Master";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
description = controller->GetDeviceName();
|
||||
@@ -152,7 +152,6 @@ RGBController_CMSmallARGBController::RGBController_CMSmallARGBController(CMSmall
|
||||
PassThru.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(PassThru);
|
||||
|
||||
Init_Controller(); //Only processed on first run
|
||||
SetupZones();
|
||||
|
||||
int temp_mode = controller->GetMode();
|
||||
@@ -186,57 +185,69 @@ RGBController_CMSmallARGBController::~RGBController_CMSmallARGBController()
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CMSmallARGBController::Init_Controller()
|
||||
{
|
||||
int zone_idx = controller->GetZoneIndex();
|
||||
int zone_led_count = cm_small_argb_header_data[zone_idx].count;
|
||||
bool boolSingleLED = ( zone_led_count == 1 ); //If argb_header_data[zone_idx].count == 1 then the zone is ZONE_TYPE_SINGLE
|
||||
|
||||
zone ARGB_zone;
|
||||
ARGB_zone.name = std::to_string(zone_idx);
|
||||
ARGB_zone.type = (boolSingleLED) ? ZONE_TYPE_SINGLE : ZONE_TYPE_LINEAR;
|
||||
ARGB_zone.leds_min = CM_SMALL_ARGB_MIN_LEDS;
|
||||
ARGB_zone.leds_max = CM_SMALL_ARGB_MAX_LEDS;
|
||||
ARGB_zone.leds_count = zone_led_count;
|
||||
zones.push_back(ARGB_zone);
|
||||
}
|
||||
|
||||
void RGBController_CMSmallARGBController::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
{
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-----------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(1);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zones |
|
||||
\*---------------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up zones and LEDs |
|
||||
\*-----------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
bool boolSingleLED = (zones[zone_idx].type == ZONE_TYPE_SINGLE); //Calculated for later use
|
||||
zones[zone_idx].leds_min = 0;
|
||||
zones[zone_idx].leds_max = CM_SMALL_ARGB_MAX_LEDS;
|
||||
|
||||
if (!boolSingleLED)
|
||||
if(first_run)
|
||||
{
|
||||
controller->SetLedCount(cm_small_argb_header_data[zone_idx].header, zones[zone_idx].leds_count);
|
||||
zones[zone_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[zone_idx].name = "Addressable RGB Header";
|
||||
zones[zone_idx].name.append(std::to_string(zone_idx + 1));
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[zone_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[zone_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[zone_idx].matrix_map.width = 0;
|
||||
zones[zone_idx].matrix_map.height = 0;
|
||||
zones[zone_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
for(unsigned int lp_idx = 0; lp_idx < zones[zone_idx].leds_count; lp_idx++)
|
||||
{
|
||||
led new_led;
|
||||
unsigned int i = std::stoi(zones[zone_idx].name);
|
||||
|
||||
if(boolSingleLED)
|
||||
{
|
||||
new_led.name = i;
|
||||
new_led.value = cm_small_argb_header_data[i].header;
|
||||
}
|
||||
else
|
||||
{
|
||||
new_led.name = i;
|
||||
new_led.name.append(" LED " + std::to_string(lp_idx));
|
||||
new_led.value = cm_small_argb_header_data[i].header;
|
||||
}
|
||||
led new_led;
|
||||
new_led.name = zones[zone_idx].name;
|
||||
new_led.name.append(", LED " + std::to_string(lp_idx));
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
@@ -245,16 +256,11 @@ void RGBController_CMSmallARGBController::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CMSmallARGBController::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_CMSmallARGBController::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
controller->SetLedCount(cm_small_argb_header_data[zone_idx].header, zones[zone_idx].leds_count);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
~RGBController_CMSmallARGBController();
|
||||
|
||||
void SetupZones();
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -326,7 +326,7 @@ DetectedControllers DetectCoolerMasterSmallARGB(hid_device_info* info, const std
|
||||
|
||||
if(dev)
|
||||
{
|
||||
CMSmallARGBController* controller = new CMSmallARGBController(dev, info->path, 0);
|
||||
CMSmallARGBController* controller = new CMSmallARGBController(dev, info->path);
|
||||
RGBController_CMSmallARGBController* rgb_controller = new RGBController_CMSmallARGBController(controller);
|
||||
|
||||
detected_controllers.push_back(rgb_controller);
|
||||
|
||||
@@ -51,22 +51,23 @@ static unsigned int matrix_map24[11][11] =
|
||||
|
||||
RGBController_CorsairCommanderCore::RGBController_CorsairCommanderCore(CorsairCommanderCoreController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetNameString();
|
||||
vendor = "Corsair";
|
||||
description = "Corsair Commander Core Device";
|
||||
version = controller->GetFirmwareString();
|
||||
type = DEVICE_TYPE_COOLER;
|
||||
location = controller->GetLocationString();
|
||||
SetupZones();
|
||||
name = controller->GetNameString();
|
||||
vendor = "Corsair";
|
||||
description = "Corsair Commander Core Device";
|
||||
version = controller->GetFirmwareString();
|
||||
type = DEVICE_TYPE_COOLER;
|
||||
location = controller->GetLocationString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_CorsairCommanderCore::~RGBController_CorsairCommanderCore()
|
||||
@@ -78,31 +79,70 @@ RGBController_CorsairCommanderCore::~RGBController_CorsairCommanderCore()
|
||||
|
||||
void RGBController_CorsairCommanderCore::SetupZones()
|
||||
{
|
||||
std::atomic<bool> first_run;
|
||||
first_run = 0;
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
{
|
||||
first_run = 1;
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
std::vector<unsigned short int> led_count = controller->GetLedCounts();
|
||||
/*-----------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-----------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(7);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up zones |
|
||||
\*-----------------------------------------------------*/
|
||||
std::vector<unsigned short int> led_count = controller->GetLedCounts();
|
||||
|
||||
if(controller->GetPidInt() == CORSAIR_COMMANDER_CORE_XT_PID)
|
||||
{
|
||||
zones[0].name = "External RGB Port";
|
||||
zones[0].type = ZONE_TYPE_LINEAR;
|
||||
zones[0].leds_min = zones[0].leds_min;
|
||||
zones[0].leds_max = 204;
|
||||
zones[0].leds_count = zones[0].leds_count;
|
||||
zones[0].leds_min = 0;
|
||||
zones[0].leds_max = 204;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[0].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
if(!(zones[0].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[0].name = "Corsair RGB Header";
|
||||
}
|
||||
|
||||
if(!(zones[0].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[0].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[0].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[0].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[0].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[0].matrix_map.width = 0;
|
||||
zones[0].matrix_map.height = 0;
|
||||
zones[0].matrix_map.map.resize(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
zones[0].name = "Pump";
|
||||
zones[0].type = ZONE_TYPE_MATRIX;
|
||||
zones[0].leds_min = led_count.at(0);
|
||||
zones[0].leds_max = led_count.at(0);
|
||||
zones[0].leds_count = led_count.at(0);
|
||||
zones[0].name = "Pump";
|
||||
zones[0].type = ZONE_TYPE_MATRIX;
|
||||
zones[0].leds_min = led_count.at(0);
|
||||
zones[0].leds_max = led_count.at(0);
|
||||
zones[0].leds_count = led_count.at(0);
|
||||
|
||||
if(led_count.at(0) == 24)
|
||||
{
|
||||
@@ -114,28 +154,51 @@ void RGBController_CorsairCommanderCore::SetupZones()
|
||||
}
|
||||
}
|
||||
|
||||
for(unsigned int i = 1; i < (CORSAIR_COMMANDER_CORE_NUM_CHANNELS + 1); i++)
|
||||
for(unsigned int zone_idx = 1; zone_idx < (CORSAIR_COMMANDER_CORE_NUM_CHANNELS + 1); zone_idx++)
|
||||
{
|
||||
zones[i].name = "RGB Port " + std::to_string(i);
|
||||
zones[i].type = ZONE_TYPE_LINEAR;
|
||||
zones[i].leds_min = 0;
|
||||
zones[i].leds_max = 34;
|
||||
zones[zone_idx].leds_min = 0;
|
||||
zones[zone_idx].leds_max = 34;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[i].leds_count = (led_count.size() > i) ? led_count.at(i) : 0;
|
||||
zones[zone_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[zone_idx].name = "Corsair Fan Header " + std::to_string(zone_idx);
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[zone_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[zone_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[zone_idx].matrix_map.width = 0;
|
||||
zones[zone_idx].matrix_map.height = 0;
|
||||
zones[zone_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
}
|
||||
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up LEDs |
|
||||
\*-----------------------------------------------------*/
|
||||
for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
for(unsigned int led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = zones[zone_idx].name + " LED " + std::to_string(led_idx+1);
|
||||
new_led.name = zones[zone_idx].name + ", LED " + std::to_string(led_idx+1);
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
@@ -144,28 +207,23 @@ void RGBController_CorsairCommanderCore::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairCommanderCore::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_CorsairCommanderCore::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
if(zone == 0 && controller->GetPidInt() == CORSAIR_COMMANDER_CORE_XT_PID)
|
||||
if(zone_idx == 0 && controller->GetPidInt() == CORSAIR_COMMANDER_CORE_XT_PID)
|
||||
{
|
||||
if(new_size > 0)
|
||||
if(zones[zone_idx].leds_count > 0)
|
||||
{
|
||||
controller->SetFanMode(true);
|
||||
controller->SetLedAmount(new_size);
|
||||
controller->SetLedAmount(zones[zone_idx].leds_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
controller->SetFanMode(false);
|
||||
}
|
||||
}
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
void DeviceUpdateSingleLED(int led);
|
||||
|
||||
@@ -51,7 +51,6 @@ RGBController_CorsairHydroPlatinum::RGBController_CorsairHydroPlatinum(CorsairHy
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
Init_Controller();
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
@@ -62,46 +61,90 @@ RGBController_CorsairHydroPlatinum::~RGBController_CorsairHydroPlatinum()
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydroPlatinum::Init_Controller()
|
||||
void RGBController_CorsairHydroPlatinum::SetupZones()
|
||||
{
|
||||
zone cpu_block_zone;
|
||||
cpu_block_zone.name = "CPU Block";
|
||||
cpu_block_zone.type = ZONE_TYPE_MATRIX;
|
||||
cpu_block_zone.leds_min = 16;
|
||||
cpu_block_zone.leds_max = 16;
|
||||
cpu_block_zone.leds_count = 16;
|
||||
cpu_block_zone.matrix_map.Set(5, 5, (unsigned int *)&matrix_map);
|
||||
zones.push_back(cpu_block_zone);
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
{
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| If the device is RGB fan-capable, set up fan zones. |
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-----------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
if(controller->HaveRgbFan())
|
||||
{
|
||||
zones.resize(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
zones.resize(1);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up zones |
|
||||
\*-----------------------------------------------------*/
|
||||
zones[0].name = "CPU Block";
|
||||
zones[0].type = ZONE_TYPE_MATRIX;
|
||||
zones[0].leds_min = 16;
|
||||
zones[0].leds_max = 16;
|
||||
zones[0].leds_count = 16;
|
||||
zones[0].matrix_map.Set(5, 5, (unsigned int *)&matrix_map);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| If the device is RGB fan-capable, set up fan zone. |
|
||||
\*-----------------------------------------------------*/
|
||||
if(controller->HaveRgbFan())
|
||||
{
|
||||
zone fans_zone;
|
||||
fans_zone.name = "Fans";
|
||||
fans_zone.type = ZONE_TYPE_LINEAR;
|
||||
fans_zone.leds_min = 0;
|
||||
fans_zone.leds_max = 32;
|
||||
fans_zone.leds_count = 0;
|
||||
zones.push_back(fans_zone);
|
||||
zones[1].leds_min = 0;
|
||||
zones[1].leds_max = 32;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[1].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
if(!(zones[1].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[1].name = "Corsair Fan Header";
|
||||
}
|
||||
|
||||
if(!(zones[1].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[1].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[1].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[1].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[1].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[1].matrix_map.width = 0;
|
||||
zones[1].matrix_map.height = 0;
|
||||
zones[1].matrix_map.map.resize(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydroPlatinum::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up LEDs |
|
||||
\*-----------------------------------------------------*/
|
||||
for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
for(unsigned int led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = zones[zone_idx].name + " " + std::to_string(led_idx);;
|
||||
new_led.name = zones[zone_idx].name + ", LED " + std::to_string(led_idx);;
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
}
|
||||
@@ -109,17 +152,10 @@ void RGBController_CorsairHydroPlatinum::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairHydroPlatinum::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_CorsairHydroPlatinum::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -297,9 +297,9 @@ void RGBController_CorsairLightingNode::SetupModes()
|
||||
|
||||
void RGBController_CorsairLightingNode::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
@@ -307,68 +307,74 @@ void RGBController_CorsairLightingNode::SetupZones()
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-----------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(CORSAIR_LIGHTING_NODE_NUM_CHANNELS);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-------------------------------------------------*/
|
||||
for (unsigned int channel_idx = 0; channel_idx < CORSAIR_LIGHTING_NODE_NUM_CHANNELS; channel_idx++)
|
||||
/*-----------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-----------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
char ch_idx_string[2];
|
||||
snprintf(ch_idx_string, 2, "%d", channel_idx + 1);
|
||||
|
||||
zones[channel_idx].name = "Corsair Channel ";
|
||||
zones[channel_idx].name.append(ch_idx_string);
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| I did some experimenting and determined that the |
|
||||
| maximum number of LEDs the Corsair Commander Pro |
|
||||
| can support is 200. |
|
||||
\*-------------------------------------------------*/
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = 204;
|
||||
zones[zone_idx].leds_min = 0;
|
||||
zones[zone_idx].leds_max = 204;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
zones[zone_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
for (unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
char led_idx_string[4];
|
||||
snprintf(led_idx_string, 4, "%d", led_ch_idx + 1);
|
||||
zones[zone_idx].name = "Corsair RGB Header ";
|
||||
zones[zone_idx].name.append(std::to_string(zone_idx + 1));
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[zone_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[zone_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[zone_idx].matrix_map.width = 0;
|
||||
zones[zone_idx].matrix_map.height = 0;
|
||||
zones[zone_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[zone_idx].leds_count; led_ch_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = "Corsair Channel ";
|
||||
new_led.name.append(ch_idx_string);
|
||||
new_led.name.append(", LED ");
|
||||
new_led.name.append(led_idx_string);
|
||||
new_led.name = zones[zone_idx].name + ", LED " + std::to_string(led_ch_idx + 1);
|
||||
|
||||
leds.push_back(new_led);
|
||||
leds_channel.push_back(channel_idx);
|
||||
leds_channel.push_back(zone_idx);
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairLightingNode::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_CorsairLightingNode::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
void SetupModes();
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -50,56 +50,91 @@ RGBController_CreativeSoundBlasterAE5::~RGBController_CreativeSoundBlasterAE5()
|
||||
|
||||
void RGBController_CreativeSoundBlasterAE5::SetupZones()
|
||||
{
|
||||
zone internal_zone;
|
||||
internal_zone.name = "Internal";
|
||||
internal_zone.type = ZONE_TYPE_LINEAR;
|
||||
internal_zone.leds_min = 5;
|
||||
internal_zone.leds_max = 5;
|
||||
internal_zone.leds_count = 5;
|
||||
zones.push_back(internal_zone);
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
for(unsigned int led_idx = 0; led_idx < 5; led_idx++)
|
||||
if(zones.size() == 0)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = "Internal LED " + std::to_string(led_idx + 1);
|
||||
leds.push_back(new_led);
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
zone external_zone;
|
||||
external_zone.name = "External";
|
||||
external_zone.type = ZONE_TYPE_LINEAR;
|
||||
external_zone.leds_min = 0;
|
||||
external_zone.leds_max = 100;
|
||||
external_zone.leds_count = controller->GetExternalLEDCount();
|
||||
zones.push_back(external_zone);
|
||||
/*-----------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-----------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(2);
|
||||
|
||||
for(unsigned int led_idx = 0; led_idx < controller->GetExternalLEDCount(); led_idx++)
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up internal zone |
|
||||
\*-----------------------------------------------------*/
|
||||
zones[0].name = "Internal";
|
||||
zones[0].type = ZONE_TYPE_LINEAR;
|
||||
zones[0].leds_min = 5;
|
||||
zones[0].leds_max = 5;
|
||||
zones[0].leds_count = 5;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up internal zone and LEDs |
|
||||
\*-----------------------------------------------------*/
|
||||
zones[1].leds_min = 0;
|
||||
zones[1].leds_max = 100;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = "External LED " + std::to_string(led_idx + 1);
|
||||
leds.push_back(new_led);
|
||||
zones[1].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
if(!(zones[1].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[1].name = "Addressable RGB Header";
|
||||
}
|
||||
|
||||
if(!(zones[1].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[1].leds_count = controller->GetExternalLEDCount();;
|
||||
}
|
||||
|
||||
if(!(zones[1].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[1].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[1].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[1].matrix_map.width = 0;
|
||||
zones[1].matrix_map.height = 0;
|
||||
zones[1].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up LEDs |
|
||||
\*-----------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
for(unsigned int led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = zones[0].name + ", LED " + std::to_string(led_idx + 1);
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterAE5::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_CreativeSoundBlasterAE5::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if(zone == 1) // External zone
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
controller->SetExternalLEDCount(zones[zone_idx].leds_count);
|
||||
|
||||
leds.resize(5);
|
||||
|
||||
for(unsigned int led_idx = 0; led_idx < (unsigned int)new_size; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = "External LED " + std::to_string(led_idx + 1);
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
controller->SetExternalLEDCount(new_size);
|
||||
SetupColors();
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -20,7 +20,21 @@ DRGBController::DRGBController(hid_device* dev_handle, const char* path, unsigne
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
name = dev_name;
|
||||
device_pid = pid;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Loop through all known devices to look for a PID |
|
||||
| match |
|
||||
\*-----------------------------------------------------*/
|
||||
for(unsigned int i = 0; i < DRGB_NUM_DEVICES; i++)
|
||||
{
|
||||
if(drgb_device_list[i]->pid == pid)
|
||||
{
|
||||
/*---------------------------------------------*\
|
||||
| Set device index |
|
||||
\*---------------------------------------------*/
|
||||
device_index = i;
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Exit hardware effects. Start a thread to continuously|
|
||||
@@ -38,20 +52,6 @@ DRGBController::~DRGBController()
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
void DRGBController::KeepaliveThread()
|
||||
{
|
||||
unsigned char sleep_buf[65];
|
||||
sleep_buf[0] = 0x65;
|
||||
while(keepalive_thread_run.load())
|
||||
{
|
||||
if((std::chrono::steady_clock::now() - last_commit_time) > std::chrono::milliseconds(500))
|
||||
{
|
||||
SendPacketFS(sleep_buf, 1, 0);
|
||||
}
|
||||
std::this_thread::sleep_for(300ms);
|
||||
}
|
||||
}
|
||||
|
||||
std::string DRGBController::GetFirmwareString()
|
||||
{
|
||||
return "v"+std::to_string(version[0]) + "." + std::to_string(version[1]) + "." + std::to_string(version[2]) + "." + std::to_string(version[3]);
|
||||
@@ -82,7 +82,99 @@ std::string DRGBController::GetSerialString()
|
||||
|
||||
unsigned short DRGBController::GetDevicePID()
|
||||
{
|
||||
return(device_pid);
|
||||
return(drgb_device_list[device_index]->pid);
|
||||
}
|
||||
|
||||
unsigned char DRGBController::GetNumChannels()
|
||||
{
|
||||
return(drgb_device_list[device_index]->channels);
|
||||
}
|
||||
|
||||
unsigned short DRGBController::GetLEDsPerChannel()
|
||||
{
|
||||
return(drgb_device_list[device_index]->leds_per_channel);
|
||||
}
|
||||
|
||||
unsigned short DRGBController::GetVersion()
|
||||
{
|
||||
return(drgb_device_list[device_index]->version);
|
||||
}
|
||||
|
||||
std::string DRGBController::GetChannelName(unsigned char channel)
|
||||
{
|
||||
std::string channel_name;
|
||||
|
||||
if(drgb_device_list[device_index]->channels == 6)
|
||||
{
|
||||
if(channel == 0)
|
||||
{
|
||||
channel_name = "Strimer ATX" + std::to_string(channel + 1);
|
||||
}
|
||||
else if(channel < 3)
|
||||
{
|
||||
channel_name = "Channel C" + std::to_string(channel);
|
||||
}
|
||||
else if(channel == 3)
|
||||
{
|
||||
channel_name = "Strimer GPU" + std::to_string(channel - 2);
|
||||
}
|
||||
else if(channel < 6)
|
||||
{
|
||||
channel_name = "Channel D" + std::to_string(channel - 3);
|
||||
}
|
||||
}
|
||||
else if(drgb_device_list[device_index]->channels == 10 || drgb_device_list[device_index]->channels == 12)
|
||||
{
|
||||
channel_name = "Channel " + std::to_string(channel + 1);
|
||||
}
|
||||
else if(drgb_device_list[device_index]->channels == 14)
|
||||
{
|
||||
if(channel < 4)
|
||||
{
|
||||
channel_name = "LCD " + std::to_string(channel + 1);
|
||||
}
|
||||
else if(channel < 6)
|
||||
{
|
||||
channel_name = "LED " + std::to_string(channel + 1);
|
||||
}
|
||||
else if(channel < 16)
|
||||
{
|
||||
channel_name = "ARGB " + std::to_string(channel - 5);
|
||||
}
|
||||
}
|
||||
else if(channel < 8)
|
||||
{
|
||||
channel_name = "Channel A" + std::to_string(channel + 1);
|
||||
}
|
||||
else if(channel < 16)
|
||||
{
|
||||
channel_name = "Channel B" + std::to_string(channel - 7);
|
||||
}
|
||||
else if(drgb_device_list[device_index]->channels == 30)
|
||||
{
|
||||
if(channel < 24)
|
||||
{
|
||||
channel_name = "Channel C" + std::to_string(channel - 15);
|
||||
}
|
||||
else if(channel < 30)
|
||||
{
|
||||
channel_name = "Channel D" + std::to_string(channel - 23);
|
||||
}
|
||||
}
|
||||
else if(channel < 22)
|
||||
{
|
||||
channel_name = "Channel C" + std::to_string(channel - 15);
|
||||
}
|
||||
else if(channel < 28)
|
||||
{
|
||||
channel_name = "Channel D" + std::to_string(channel - 21);
|
||||
}
|
||||
else if(channel < 36)
|
||||
{
|
||||
channel_name = "Channel E" + std::to_string(channel - 27);
|
||||
}
|
||||
|
||||
return(channel_name);
|
||||
}
|
||||
|
||||
void DRGBController::SetChannelLEDs(unsigned char /*channel*/, RGBColor* /*colors*/, unsigned int /*num_colors*/)
|
||||
@@ -153,3 +245,17 @@ void DRGBController::SendPacketFS(unsigned char* colors, unsigned int buf_packet
|
||||
hid_write(dev, usb_buf, 65);
|
||||
}
|
||||
}
|
||||
|
||||
void DRGBController::KeepaliveThread()
|
||||
{
|
||||
unsigned char sleep_buf[65];
|
||||
sleep_buf[0] = 0x65;
|
||||
while(keepalive_thread_run.load())
|
||||
{
|
||||
if((std::chrono::steady_clock::now() - last_commit_time) > std::chrono::milliseconds(500))
|
||||
{
|
||||
SendPacketFS(sleep_buf, 1, 0);
|
||||
}
|
||||
std::this_thread::sleep_for(300ms);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <chrono>
|
||||
#include <vector>
|
||||
#include <hidapi.h>
|
||||
#include "DRGBDevices.h"
|
||||
#include "RGBController.h"
|
||||
|
||||
#define DRGB_V4_ONE_PACKAGE_SIZE 316
|
||||
@@ -27,15 +28,24 @@ public:
|
||||
DRGBController(hid_device* dev_handle, const char* path, unsigned short pid, std::string dev_name);
|
||||
~DRGBController();
|
||||
|
||||
void KeepaliveThread();
|
||||
std::string GetFirmwareString();
|
||||
std::string GetLocationString();
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
|
||||
unsigned short GetDevicePID();
|
||||
unsigned char GetNumChannels();
|
||||
unsigned short GetLEDsPerChannel();
|
||||
unsigned short GetVersion();
|
||||
|
||||
std::string GetChannelName(unsigned char channel);
|
||||
|
||||
void SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors);
|
||||
void SendPacket(unsigned char* colors,unsigned int buf_packets ,unsigned int LEDtotal);
|
||||
void SendPacketFS(unsigned char* colors,unsigned int buf_packets ,unsigned int Array);
|
||||
void SendPacket(unsigned char* colors, unsigned int buf_packets, unsigned int LEDtotal);
|
||||
void SendPacketFS(unsigned char* colors, unsigned int buf_packets, unsigned int Array);
|
||||
|
||||
void KeepaliveThread();
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
@@ -44,5 +54,5 @@ private:
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::chrono::time_point<std::chrono::steady_clock> last_commit_time;
|
||||
unsigned char version[4] = {0, 0, 0,0};
|
||||
unsigned short device_pid;
|
||||
unsigned int device_index;
|
||||
};
|
||||
|
||||
@@ -23,10 +23,6 @@ DetectedControllers DetectDRGBControllers(hid_device_info* info, const std::stri
|
||||
|
||||
if(dev)
|
||||
{
|
||||
wchar_t product[128];
|
||||
hid_get_product_string(dev, product, 128);
|
||||
std::wstring product_str(product);
|
||||
|
||||
DRGBController* controller = new DRGBController(dev, info->path, info->product_id, name);
|
||||
RGBController_DRGB* rgb_controller = new RGBController_DRGB(controller);
|
||||
|
||||
@@ -55,7 +51,7 @@ REGISTER_HID_DETECTOR("DeepRGB C16 V5F", DetectDRGBControllers, DRGBV
|
||||
REGISTER_HID_DETECTOR("DeepRGB S16 V5F", DetectDRGBControllers, DRGBV4_VID, DRGB_S16_V5F_PID);
|
||||
|
||||
REGISTER_HID_DETECTOR("DeepRGB LED", DetectDRGBControllers, DRGBV3_VID, DRGB_LED_V3_PID);
|
||||
REGISTER_HID_DETECTOR("DeepRGB Ultra V3", DetectDRGBControllers, DRGBV3_VID, DRGB_Ultra_V3_PID);
|
||||
REGISTER_HID_DETECTOR("DeepRGB Ultra V3", DetectDRGBControllers, DRGBV3_VID, DRGB_ULTRA_V3_PID);
|
||||
REGISTER_HID_DETECTOR("DeepRGB CORE V3", DetectDRGBControllers, DRGBV3_VID, DRGB_CORE_V3_PID);
|
||||
REGISTER_HID_DETECTOR("DeepRGB E8 F", DetectDRGBControllers, DRGBV3_VID, DRGB_E8_F_PID);
|
||||
REGISTER_HID_DETECTOR("DeepRGB E8", DetectDRGBControllers, DRGBV3_VID, DRGB_E8_PID);
|
||||
@@ -67,7 +63,7 @@ REGISTER_HID_DETECTOR("DeepRGB LED Controller", DetectDRGBControllers, DRGBV
|
||||
REGISTER_HID_DETECTOR("DeepRGB ULTRA", DetectDRGBControllers, DRGBV2_VID, DRGB_ULTRA_PID);
|
||||
REGISTER_HID_DETECTOR("DeepRGB SIG AB", DetectDRGBControllers, DRGBV2_VID, DRGB_SIG_AB_PID);
|
||||
REGISTER_HID_DETECTOR("DeepRGB SIG CD", DetectDRGBControllers, DRGBV2_VID, DRGB_SIG_CD_PID);
|
||||
REGISTER_HID_DETECTOR("DeepRGB Strimer Controller", DetectDRGBControllers, DRGBV2_VID, DRGB_Strimer_PID);
|
||||
REGISTER_HID_DETECTOR("DeepRGB Strimer Controller", DetectDRGBControllers, DRGBV2_VID, DRGB_STRIMER_PID);
|
||||
|
||||
REGISTER_HID_DETECTOR("YICO 8 ELITE", DetectDRGBControllers, YICO_VID, YICO_8_PID);
|
||||
REGISTER_HID_DETECTOR("YICO 08 ELITE", DetectDRGBControllers, YICO_VID, YICO_08_PID);
|
||||
|
||||
322
Controllers/DRGBController/DRGBDevices.cpp
Normal file
322
Controllers/DRGBController/DRGBDevices.cpp
Normal file
@@ -0,0 +1,322 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| DRGBDevices.cpp |
|
||||
| |
|
||||
| Device list for DRGB devices |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 16 Mar 2026 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "DRGBDevices.h"
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| DRGB Devices |
|
||||
\*---------------------------------------------------------*/
|
||||
static const drgb_device drgb_led_v4 =
|
||||
{
|
||||
DRGB_LED_V4_PID,
|
||||
8,
|
||||
512,
|
||||
4
|
||||
};
|
||||
|
||||
static const drgb_device drgb_ultra_v4f =
|
||||
{
|
||||
DRGB_ULTRA_V4F_PID,
|
||||
16,
|
||||
256,
|
||||
4
|
||||
};
|
||||
|
||||
static const drgb_device drgb_core_v4f =
|
||||
{
|
||||
DRGB_CORE_V4F_PID,
|
||||
32,
|
||||
256,
|
||||
4
|
||||
};
|
||||
|
||||
static const drgb_device drgb_sig_v4f =
|
||||
{
|
||||
DRGB_SIG_V4F_PID,
|
||||
36,
|
||||
256,
|
||||
4
|
||||
};
|
||||
|
||||
static const drgb_device drgb_ag_04_v4f =
|
||||
{
|
||||
DRGB_AG_04_V4F_PID,
|
||||
4,
|
||||
256,
|
||||
4
|
||||
};
|
||||
|
||||
static const drgb_device drgb_ag_16_v4f =
|
||||
{
|
||||
DRGB_AG_16_V4F_PID,
|
||||
16,
|
||||
256,
|
||||
4
|
||||
};
|
||||
|
||||
static const drgb_device drgb_ag_08 =
|
||||
{
|
||||
DRGB_AG_08_PID,
|
||||
8,
|
||||
256,
|
||||
4
|
||||
};
|
||||
|
||||
static const drgb_device drgb_ag_08_f08 =
|
||||
{
|
||||
DRGB_AG_08_F08_PID,
|
||||
8,
|
||||
256,
|
||||
4
|
||||
};
|
||||
|
||||
static const drgb_device drgb_ag_16_f12 =
|
||||
{
|
||||
DRGB_AG_16_F12_PID,
|
||||
16,
|
||||
256,
|
||||
4
|
||||
};
|
||||
|
||||
static const drgb_device drgb_l8_v5 =
|
||||
{
|
||||
DRGB_L8_V5_PID,
|
||||
8,
|
||||
512,
|
||||
4
|
||||
};
|
||||
|
||||
static const drgb_device drgb_u16_v5 =
|
||||
{
|
||||
DRGB_U16_V5_PID,
|
||||
16,
|
||||
256,
|
||||
4
|
||||
};
|
||||
|
||||
static const drgb_device drgb_u16_v5f =
|
||||
{
|
||||
DRGB_U16_V5F_PID,
|
||||
16,
|
||||
256,
|
||||
4
|
||||
};
|
||||
|
||||
static const drgb_device drgb_c16_v5 =
|
||||
{
|
||||
DRGB_C16_V5_PID,
|
||||
32,
|
||||
256,
|
||||
4
|
||||
};
|
||||
|
||||
static const drgb_device drgb_c16_v5f =
|
||||
{
|
||||
DRGB_C16_V5F_PID,
|
||||
32,
|
||||
256,
|
||||
4
|
||||
};
|
||||
|
||||
static const drgb_device drgb_s16_v5f =
|
||||
{
|
||||
DRGB_S16_V5F_PID,
|
||||
32,
|
||||
256,
|
||||
4
|
||||
};
|
||||
|
||||
static const drgb_device drgb_led_v3 =
|
||||
{
|
||||
DRGB_LED_V3_PID,
|
||||
8,
|
||||
256,
|
||||
3
|
||||
};
|
||||
|
||||
static const drgb_device drgb_ultra_v3 =
|
||||
{
|
||||
DRGB_ULTRA_V3_PID,
|
||||
16,
|
||||
256,
|
||||
3
|
||||
};
|
||||
|
||||
static const drgb_device drgb_core_v3 =
|
||||
{
|
||||
DRGB_CORE_V3_PID,
|
||||
30,
|
||||
256,
|
||||
3
|
||||
};
|
||||
|
||||
static const drgb_device drgb_e8_f =
|
||||
{
|
||||
DRGB_E8_F_PID,
|
||||
8,
|
||||
132,
|
||||
1
|
||||
};
|
||||
|
||||
static const drgb_device drgb_e8 =
|
||||
{
|
||||
DRGB_E8_PID,
|
||||
8,
|
||||
132,
|
||||
1
|
||||
};
|
||||
|
||||
static const drgb_device drgb_e16 =
|
||||
{
|
||||
DRGB_E16_PID,
|
||||
16,
|
||||
132,
|
||||
1
|
||||
};
|
||||
|
||||
static const drgb_device dm_10 =
|
||||
{
|
||||
DM_10_PID,
|
||||
10,
|
||||
132,
|
||||
1
|
||||
};
|
||||
|
||||
static const drgb_device jpu_12 =
|
||||
{
|
||||
JPU_12_PID,
|
||||
12,
|
||||
60,
|
||||
1
|
||||
};
|
||||
|
||||
static const drgb_device drgb_led =
|
||||
{
|
||||
DRGB_LED_PID,
|
||||
8,
|
||||
256,
|
||||
2
|
||||
};
|
||||
|
||||
static const drgb_device drgb_ultra =
|
||||
{
|
||||
DRGB_ULTRA_PID,
|
||||
16,
|
||||
256,
|
||||
2
|
||||
};
|
||||
|
||||
static const drgb_device drgb_sig_ab =
|
||||
{
|
||||
DRGB_SIG_AB_PID,
|
||||
16,
|
||||
256,
|
||||
2
|
||||
};
|
||||
|
||||
static const drgb_device drgb_sig_cd =
|
||||
{
|
||||
DRGB_SIG_CD_PID,
|
||||
6,
|
||||
256,
|
||||
2
|
||||
};
|
||||
|
||||
static const drgb_device drgb_strimer =
|
||||
{
|
||||
DRGB_STRIMER_PID,
|
||||
6,
|
||||
256,
|
||||
2
|
||||
};
|
||||
|
||||
static const drgb_device yico_8 =
|
||||
{
|
||||
YICO_8_PID,
|
||||
8,
|
||||
256,
|
||||
3
|
||||
};
|
||||
|
||||
static const drgb_device yico_08 =
|
||||
{
|
||||
YICO_08_PID,
|
||||
8,
|
||||
256,
|
||||
3
|
||||
};
|
||||
|
||||
static const drgb_device yico_08_1 =
|
||||
{
|
||||
YICO_08_1_PID,
|
||||
8,
|
||||
132,
|
||||
3
|
||||
};
|
||||
|
||||
static const drgb_device yico_14 =
|
||||
{
|
||||
YICO_14_PID,
|
||||
14,
|
||||
132,
|
||||
1
|
||||
};
|
||||
|
||||
static const drgb_device yico_16 =
|
||||
{
|
||||
YICO_16_PID,
|
||||
16,
|
||||
256,
|
||||
4
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| DRGB Device List |
|
||||
\*---------------------------------------------------------*/
|
||||
static const drgb_device* device_list[] =
|
||||
{
|
||||
&drgb_led_v4,
|
||||
&drgb_ultra_v4f,
|
||||
&drgb_core_v4f,
|
||||
&drgb_sig_v4f,
|
||||
&drgb_ag_04_v4f,
|
||||
&drgb_ag_16_v4f,
|
||||
&drgb_ag_08,
|
||||
&drgb_ag_08_f08,
|
||||
&drgb_ag_16_f12,
|
||||
&drgb_l8_v5,
|
||||
&drgb_u16_v5,
|
||||
&drgb_u16_v5f,
|
||||
&drgb_c16_v5,
|
||||
&drgb_c16_v5f,
|
||||
&drgb_s16_v5f,
|
||||
&drgb_led_v3,
|
||||
&drgb_ultra_v3,
|
||||
&drgb_core_v3,
|
||||
&drgb_e8_f,
|
||||
&drgb_e8,
|
||||
&drgb_e16,
|
||||
&dm_10,
|
||||
&jpu_12,
|
||||
&drgb_led,
|
||||
&drgb_ultra,
|
||||
&drgb_sig_ab,
|
||||
&drgb_sig_cd,
|
||||
&drgb_strimer,
|
||||
&yico_8,
|
||||
&yico_08,
|
||||
&yico_08_1,
|
||||
&yico_14,
|
||||
&yico_16
|
||||
};
|
||||
|
||||
const unsigned int DRGB_NUM_DEVICES = (sizeof(device_list) / sizeof(device_list[ 0 ]));
|
||||
const drgb_device** drgb_device_list = device_list;
|
||||
77
Controllers/DRGBController/DRGBDevices.h
Normal file
77
Controllers/DRGBController/DRGBDevices.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| DRGBDevices.h |
|
||||
| |
|
||||
| Device list for DRGB devices |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 16 Mar 2026 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "DRGBController.h"
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| DRGB vendor IDs |
|
||||
\*---------------------------------------------------------*/
|
||||
#define DRGBV2_VID 0x2023
|
||||
#define DRGBV3_VID 0x2023
|
||||
#define DRGBV4_VID 0x2486
|
||||
#define YICO_VID 0x1368
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| DRGB product IDs |
|
||||
\*---------------------------------------------------------*/
|
||||
#define DRGB_LED_V4_PID 0x3608
|
||||
#define DRGB_ULTRA_V4F_PID 0x3616
|
||||
#define DRGB_CORE_V4F_PID 0x3628
|
||||
#define DRGB_SIG_V4F_PID 0x3636
|
||||
#define DRGB_AG_04_V4F_PID 0x3204
|
||||
#define DRGB_AG_16_V4F_PID 0x3216
|
||||
#define DRGB_AG_08_PID 0x3F08
|
||||
#define DRGB_AG_08_F08_PID 0x3F16
|
||||
#define DRGB_AG_16_F12_PID 0x3F28
|
||||
|
||||
#define DRGB_L8_V5_PID 0x3208
|
||||
#define DRGB_U16_V5_PID 0x3215
|
||||
#define DRGB_U16_V5F_PID 0x3217
|
||||
#define DRGB_C16_V5_PID 0x3228
|
||||
#define DRGB_C16_V5F_PID 0x3229
|
||||
#define DRGB_S16_V5F_PID 0x3232
|
||||
|
||||
#define DRGB_LED_V3_PID 0x1209
|
||||
#define DRGB_ULTRA_V3_PID 0x1221
|
||||
#define DRGB_CORE_V3_PID 0x1226
|
||||
#define DRGB_E8_F_PID 0x1408
|
||||
#define DRGB_E8_PID 0x1407
|
||||
#define DRGB_E16_PID 0x1416
|
||||
#define DM_10_PID 0x1410
|
||||
#define JPU_12_PID 0x1412
|
||||
|
||||
#define DRGB_LED_PID 0x1208
|
||||
#define DRGB_ULTRA_PID 0x1220
|
||||
#define DRGB_SIG_AB_PID 0x1210
|
||||
#define DRGB_SIG_CD_PID 0x1211
|
||||
#define DRGB_STRIMER_PID 0x1215
|
||||
|
||||
#define YICO_8_PID 0x6077
|
||||
#define YICO_08_PID 0x6078
|
||||
#define YICO_08_1_PID 0x6079
|
||||
#define YICO_14_PID 0x1614
|
||||
#define YICO_16_PID 0x1616
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short pid;
|
||||
unsigned char channels;
|
||||
unsigned short leds_per_channel;
|
||||
unsigned short version;
|
||||
} drgb_device;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| These constant values are defined in DRGBDevices.cpp |
|
||||
\*---------------------------------------------------------*/
|
||||
extern const unsigned int DRGB_NUM_DEVICES;
|
||||
extern const drgb_device** drgb_device_list;
|
||||
@@ -26,21 +26,21 @@
|
||||
|
||||
RGBController_DRGB::RGBController_DRGB(DRGBController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetNameString();
|
||||
vendor = "DRGB";
|
||||
description = "DRGB Controller Device";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
version = controller->GetFirmwareString();
|
||||
location = controller->GetLocationString();
|
||||
serial = controller->GetSerialString();
|
||||
name = controller->GetNameString();
|
||||
vendor = "DRGB";
|
||||
description = "DRGB Controller Device";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
version = controller->GetFirmwareString();
|
||||
location = controller->GetLocationString();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0xFFFF;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0xFFFF;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
@@ -55,324 +55,84 @@ RGBController_DRGB::~RGBController_DRGB()
|
||||
|
||||
void RGBController_DRGB::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
{
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-----------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(controller->GetNumChannels());
|
||||
|
||||
unsigned int NUM_CHANNELS = 0;
|
||||
unsigned int NUM_Channel_led = 0;
|
||||
switch(controller->GetDevicePID())
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up zones |
|
||||
\*-----------------------------------------------------*/
|
||||
for(std::size_t channel_idx = 0; channel_idx < zones.size(); channel_idx++)
|
||||
{
|
||||
case DRGB_LED_V4_PID:
|
||||
NUM_CHANNELS = 8;
|
||||
NUM_Channel_led = 512;
|
||||
Version = 4;
|
||||
break;
|
||||
case DRGB_ULTRA_V4F_PID:
|
||||
NUM_CHANNELS = 16;
|
||||
NUM_Channel_led = 256;
|
||||
Version = 4;
|
||||
break;
|
||||
case DRGB_CORE_V4F_PID:
|
||||
NUM_CHANNELS = 32;
|
||||
NUM_Channel_led = 256;
|
||||
Version = 4;
|
||||
break;
|
||||
case DRGB_SIG_V4F_PID:
|
||||
NUM_CHANNELS = 36;
|
||||
NUM_Channel_led = 256;
|
||||
Version = 4;
|
||||
break;
|
||||
case DRGB_AG_04_V4F_PID:
|
||||
NUM_CHANNELS = 4;
|
||||
NUM_Channel_led = 256;
|
||||
Version = 4;
|
||||
break;
|
||||
case DRGB_AG_08_PID:
|
||||
NUM_CHANNELS = 8;
|
||||
NUM_Channel_led = 256;
|
||||
Version = 4;
|
||||
break;
|
||||
case DRGB_AG_08_F08_PID:
|
||||
NUM_CHANNELS = 8;
|
||||
NUM_Channel_led = 256;
|
||||
Version = 4;
|
||||
break;
|
||||
case DRGB_AG_16_V4F_PID:
|
||||
NUM_CHANNELS = 16;
|
||||
NUM_Channel_led = 256;
|
||||
Version = 4;
|
||||
break;
|
||||
case DRGB_AG_16_F12_PID:
|
||||
NUM_CHANNELS = 16;
|
||||
NUM_Channel_led = 256;
|
||||
Version = 4;
|
||||
break;
|
||||
|
||||
case DRGB_L8_V5_PID:
|
||||
NUM_CHANNELS = 8;
|
||||
NUM_Channel_led = 512;
|
||||
Version = 4;
|
||||
break;
|
||||
case DRGB_U16_V5_PID:
|
||||
NUM_CHANNELS = 16;
|
||||
NUM_Channel_led = 256;
|
||||
Version = 4;
|
||||
break;
|
||||
case DRGB_U16_V5F_PID:
|
||||
NUM_CHANNELS = 16;
|
||||
NUM_Channel_led = 256;
|
||||
Version = 4;
|
||||
break;
|
||||
case DRGB_C16_V5_PID:
|
||||
NUM_CHANNELS = 32;
|
||||
NUM_Channel_led = 256;
|
||||
Version = 4;
|
||||
break;
|
||||
case DRGB_C16_V5F_PID:
|
||||
NUM_CHANNELS = 32;
|
||||
NUM_Channel_led = 256;
|
||||
Version = 4;
|
||||
break;
|
||||
case DRGB_S16_V5F_PID:
|
||||
NUM_CHANNELS = 32;
|
||||
NUM_Channel_led = 256;
|
||||
Version = 4;
|
||||
break;
|
||||
|
||||
case DRGB_LED_V3_PID:
|
||||
NUM_CHANNELS = 8;
|
||||
NUM_Channel_led = 256;
|
||||
Version = 3;
|
||||
break;
|
||||
case DRGB_Ultra_V3_PID:
|
||||
NUM_CHANNELS = 16;
|
||||
NUM_Channel_led = 256;
|
||||
Version = 3;
|
||||
break;
|
||||
case DRGB_CORE_V3_PID:
|
||||
NUM_CHANNELS = 30;
|
||||
NUM_Channel_led = 256;
|
||||
Version = 3;
|
||||
break;
|
||||
case DRGB_E8_F_PID:
|
||||
NUM_CHANNELS = 8;
|
||||
NUM_Channel_led = 132;
|
||||
Version = 1;
|
||||
break;
|
||||
case DRGB_E8_PID:
|
||||
NUM_CHANNELS = 8;
|
||||
NUM_Channel_led = 132;
|
||||
Version = 1;
|
||||
break;
|
||||
case DRGB_E16_PID:
|
||||
NUM_CHANNELS = 16;
|
||||
NUM_Channel_led = 132;
|
||||
Version = 1;
|
||||
break;
|
||||
case DM_10_PID:
|
||||
NUM_CHANNELS = 10;
|
||||
NUM_Channel_led = 132;
|
||||
Version = 1;
|
||||
break;
|
||||
case JPU_12_PID:
|
||||
NUM_CHANNELS = 12;
|
||||
NUM_Channel_led = 60;
|
||||
Version = 1;
|
||||
break;
|
||||
|
||||
case DRGB_LED_PID:
|
||||
NUM_CHANNELS = 8;
|
||||
NUM_Channel_led = 256;
|
||||
Version = 2;
|
||||
break;
|
||||
case DRGB_ULTRA_PID:
|
||||
NUM_CHANNELS = 16;
|
||||
NUM_Channel_led = 256;
|
||||
Version = 2;
|
||||
break;
|
||||
case DRGB_SIG_AB_PID:
|
||||
NUM_CHANNELS = 16;
|
||||
NUM_Channel_led = 256;
|
||||
Version = 2;
|
||||
break;
|
||||
case DRGB_SIG_CD_PID:
|
||||
NUM_CHANNELS = 6;
|
||||
NUM_Channel_led = 256;
|
||||
Version = 2;
|
||||
break;
|
||||
case DRGB_Strimer_PID:
|
||||
NUM_CHANNELS = 6;
|
||||
NUM_Channel_led = 256;
|
||||
Version = 2;
|
||||
break;
|
||||
|
||||
case YICO_8_PID:
|
||||
NUM_CHANNELS = 8;
|
||||
NUM_Channel_led = 256;
|
||||
Version = 3;
|
||||
break;
|
||||
case YICO_08_PID:
|
||||
NUM_CHANNELS = 8;
|
||||
NUM_Channel_led = 256;
|
||||
Version = 3;
|
||||
break;
|
||||
case YICO_08_1_PID:
|
||||
NUM_CHANNELS = 8;
|
||||
NUM_Channel_led = 132;
|
||||
Version = 3;
|
||||
break;
|
||||
case YICO_14_PID:
|
||||
NUM_CHANNELS = 14;
|
||||
NUM_Channel_led = 132;
|
||||
Version = 1;
|
||||
break;
|
||||
case YICO_16_PID:
|
||||
NUM_CHANNELS = 16;
|
||||
NUM_Channel_led = 256;
|
||||
Version = 4;
|
||||
break;
|
||||
}
|
||||
|
||||
zones.resize(NUM_CHANNELS);
|
||||
|
||||
for(unsigned int channel_idx = 0; channel_idx < NUM_CHANNELS; channel_idx++)
|
||||
{
|
||||
char ch_idx_string[4];
|
||||
if(NUM_CHANNELS == 6)
|
||||
{
|
||||
if(channel_idx==0)
|
||||
{
|
||||
snprintf(ch_idx_string, 2, "%d", channel_idx+1 );
|
||||
zones[channel_idx].name = "Strimer ATX";
|
||||
}
|
||||
else if(channel_idx<3)
|
||||
{
|
||||
snprintf(ch_idx_string, 2, "%d", channel_idx );
|
||||
zones[channel_idx].name = "Channel C";
|
||||
}
|
||||
else if(channel_idx==3)
|
||||
{
|
||||
snprintf(ch_idx_string, 2, "%d", channel_idx-2 );
|
||||
zones[channel_idx].name = "Strimer GPU";
|
||||
}
|
||||
else if(channel_idx<6)
|
||||
{
|
||||
snprintf(ch_idx_string, 2, "%d", channel_idx -3);
|
||||
zones[channel_idx].name = "Channel D";
|
||||
}
|
||||
}
|
||||
else if(NUM_CHANNELS == 10 || NUM_CHANNELS == 12)
|
||||
{
|
||||
snprintf(ch_idx_string, 4, "%d", channel_idx+1 );
|
||||
zones[channel_idx].name = "Channel ";
|
||||
}
|
||||
else if(NUM_CHANNELS == 14)
|
||||
{
|
||||
if(channel_idx<4)
|
||||
{
|
||||
snprintf(ch_idx_string, 3, "%d", channel_idx+1 );
|
||||
zones[channel_idx].name = "LCD ";
|
||||
}
|
||||
else if(channel_idx<6)
|
||||
{
|
||||
snprintf(ch_idx_string, 3, "%d", channel_idx+1 );
|
||||
zones[channel_idx].name = "LED ";
|
||||
}
|
||||
else if(channel_idx<16)
|
||||
{
|
||||
snprintf(ch_idx_string, 3, "%d", channel_idx-5 );
|
||||
zones[channel_idx].name = "ARGB ";
|
||||
}
|
||||
}
|
||||
else if(channel_idx<8)
|
||||
{
|
||||
snprintf(ch_idx_string, 3, "%d", channel_idx + 1);
|
||||
zones[channel_idx].name = "Channel A";
|
||||
}
|
||||
else if(channel_idx<16)
|
||||
{
|
||||
snprintf(ch_idx_string, 2, "%d", channel_idx -7);
|
||||
zones[channel_idx].name = "Channel B";
|
||||
}
|
||||
else if(NUM_CHANNELS == 30)
|
||||
{
|
||||
if(channel_idx<24)
|
||||
{
|
||||
snprintf(ch_idx_string, 2, "%d", channel_idx -15);
|
||||
zones[channel_idx].name = "Channel C";
|
||||
}
|
||||
else if(channel_idx<30)
|
||||
{
|
||||
snprintf(ch_idx_string, 2, "%d", channel_idx -23);
|
||||
zones[channel_idx].name = "Channel D";
|
||||
}
|
||||
}
|
||||
else if(channel_idx<22)
|
||||
{
|
||||
snprintf(ch_idx_string, 2, "%d", channel_idx -15);
|
||||
zones[channel_idx].name = "Channel C";
|
||||
}
|
||||
else if(channel_idx<28)
|
||||
{
|
||||
snprintf(ch_idx_string, 2, "%d", channel_idx -21);
|
||||
zones[channel_idx].name = "Channel D";
|
||||
}
|
||||
else if(channel_idx<36)
|
||||
{
|
||||
snprintf(ch_idx_string, 2, "%d", channel_idx -27);
|
||||
zones[channel_idx].name = "Channel E";
|
||||
}
|
||||
zones[channel_idx].name.append(ch_idx_string);
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = NUM_Channel_led;
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = controller->GetLEDsPerChannel();
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
zones[channel_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[channel_idx].name = controller->GetChannelName((unsigned char)channel_idx);
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[channel_idx].matrix_map.width = 0;
|
||||
zones[channel_idx].matrix_map.height = 0;
|
||||
zones[channel_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
{
|
||||
char led_idx_string[4];
|
||||
snprintf(led_idx_string, 4, "%d", led_ch_idx + 1);
|
||||
led new_led;
|
||||
new_led.name = "LED ";
|
||||
new_led.name.append(led_idx_string);
|
||||
new_led.name = zones[channel_idx].name + ", LED " + std::to_string(led_ch_idx);
|
||||
leds.push_back(new_led);
|
||||
leds_channel.push_back(channel_idx);
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
|
||||
}
|
||||
|
||||
void RGBController_DRGB::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_DRGB::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_DRGB::DeviceUpdateLEDs()
|
||||
{
|
||||
switch(Version)
|
||||
switch(controller->GetVersion())
|
||||
{
|
||||
case 4:
|
||||
{
|
||||
|
||||
@@ -13,49 +13,6 @@
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "DRGBController.h"
|
||||
|
||||
#define DRGBV4_VID 0x2486
|
||||
#define DRGB_LED_V4_PID 0x3608
|
||||
#define DRGB_ULTRA_V4F_PID 0x3616
|
||||
#define DRGB_CORE_V4F_PID 0x3628
|
||||
#define DRGB_SIG_V4F_PID 0x3636
|
||||
#define DRGB_AG_04_V4F_PID 0x3204
|
||||
#define DRGB_AG_16_V4F_PID 0x3216
|
||||
#define DRGB_AG_08_PID 0x3F08
|
||||
#define DRGB_AG_08_F08_PID 0x3F16
|
||||
#define DRGB_AG_16_F12_PID 0x3F28
|
||||
|
||||
#define DRGB_L8_V5_PID 0x3208
|
||||
#define DRGB_U16_V5_PID 0x3215
|
||||
#define DRGB_U16_V5F_PID 0x3217
|
||||
#define DRGB_C16_V5_PID 0x3228
|
||||
#define DRGB_C16_V5F_PID 0x3229
|
||||
#define DRGB_S16_V5F_PID 0x3232
|
||||
|
||||
#define DRGBV3_VID 0x2023
|
||||
#define DRGB_LED_V3_PID 0x1209
|
||||
#define DRGB_Ultra_V3_PID 0x1221
|
||||
#define DRGB_CORE_V3_PID 0x1226
|
||||
#define DRGB_E8_F_PID 0x1408
|
||||
#define DRGB_E8_PID 0x1407
|
||||
#define DRGB_E16_PID 0x1416
|
||||
#define DM_10_PID 0x1410
|
||||
#define JPU_12_PID 0x1412
|
||||
|
||||
#define DRGBV2_VID 0x2023
|
||||
#define DRGB_LED_PID 0x1208
|
||||
#define DRGB_ULTRA_PID 0x1220
|
||||
#define DRGB_SIG_AB_PID 0x1210
|
||||
#define DRGB_SIG_CD_PID 0x1211
|
||||
#define DRGB_Strimer_PID 0x1215
|
||||
|
||||
#define YICO_VID 0x1368
|
||||
#define YICO_8_PID 0x6077
|
||||
#define YICO_08_PID 0x6078
|
||||
#define YICO_08_1_PID 0x6079
|
||||
#define YICO_14_PID 0x1614
|
||||
#define YICO_16_PID 0x1616
|
||||
|
||||
class RGBController_DRGB : public RGBController
|
||||
{
|
||||
public:
|
||||
@@ -63,15 +20,17 @@ public:
|
||||
~RGBController_DRGB();
|
||||
|
||||
void SetupZones();
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
void DeviceUpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
DRGBController* controller;
|
||||
DRGBController* controller;
|
||||
std::vector<unsigned int> leds_channel;
|
||||
std::vector<unsigned int> zones_channel;
|
||||
unsigned int Version = 4;
|
||||
};
|
||||
|
||||
@@ -46,8 +46,11 @@ static unsigned int debug_keyboard_underglow_map[3][10] =
|
||||
{ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 },
|
||||
{ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 } };
|
||||
|
||||
RGBController_Debug::RGBController_Debug(bool custom_controller, json debug_settings)
|
||||
RGBController_Debug::RGBController_Debug(bool custom, json settings)
|
||||
{
|
||||
custom_controller = custom;
|
||||
debug_settings = settings;
|
||||
|
||||
if(custom_controller)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
@@ -80,19 +83,109 @@ RGBController_Debug::RGBController_Debug(bool custom_controller, json debug_sett
|
||||
location = debug_settings["DeviceLocation"];
|
||||
version = debug_settings["DeviceVersion"];
|
||||
serial = debug_settings["DeviceSerial"];
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string name_setting = "";
|
||||
std::string type_setting = "keyboard";
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Create the mode |
|
||||
\*-------------------------------------------------*/
|
||||
mode Direct;
|
||||
if(debug_settings.contains("name"))
|
||||
{
|
||||
name_setting = debug_settings["name"];
|
||||
}
|
||||
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
if(debug_settings.contains("type"))
|
||||
{
|
||||
type_setting = debug_settings["type"];
|
||||
}
|
||||
|
||||
modes.push_back(Direct);
|
||||
if(type_setting == "motherboard")
|
||||
{
|
||||
name = "Debug Motherboard";
|
||||
type = DEVICE_TYPE_MOTHERBOARD;
|
||||
}
|
||||
else if(type_setting == "dram")
|
||||
{
|
||||
name = "Debug DRAM";
|
||||
type = DEVICE_TYPE_DRAM;
|
||||
}
|
||||
else if(type_setting == "gpu")
|
||||
{
|
||||
name = "Debug GPU";
|
||||
type = DEVICE_TYPE_GPU;
|
||||
}
|
||||
else if(type_setting == "keyboard")
|
||||
{
|
||||
name = "Debug Keyboard";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
}
|
||||
else if(type_setting == "mouse")
|
||||
{
|
||||
name = "Debug Mouse";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
}
|
||||
else if(type_setting == "argb")
|
||||
{
|
||||
name = "Debug ARGB Controller";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Fill in debug controller information |
|
||||
\*---------------------------------------------------------*/
|
||||
description = name + " Device";
|
||||
vendor = name + " Vendor String";
|
||||
location = name + " Location String";
|
||||
version = name + " Version String";
|
||||
serial = name + " Serial String";
|
||||
|
||||
if(name_setting != "")
|
||||
{
|
||||
name = name_setting;
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the mode |
|
||||
\*-----------------------------------------------------*/
|
||||
mode Direct;
|
||||
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_Debug::~RGBController_Debug()
|
||||
{
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
void RGBController_Debug::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
std::size_t zone_idx = 0;
|
||||
|
||||
if(zones.size() == 0)
|
||||
{
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
|
||||
if(custom_controller)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Fill in zones |
|
||||
\*-------------------------------------------------*/
|
||||
@@ -237,28 +330,14 @@ RGBController_Debug::RGBController_Debug(bool custom_controller, json debug_sett
|
||||
|
||||
zones.push_back(custom_zone);
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
else
|
||||
{
|
||||
bool zone_single = true;
|
||||
bool zone_linear = true;
|
||||
bool zone_resizable = false;
|
||||
bool zone_keyboard = false;
|
||||
bool zone_underglow = false;
|
||||
std::string name_setting = "";
|
||||
std::string type_setting = "keyboard";
|
||||
|
||||
if(debug_settings.contains("name"))
|
||||
{
|
||||
name_setting = debug_settings["name"];
|
||||
}
|
||||
|
||||
if(debug_settings.contains("type"))
|
||||
{
|
||||
type_setting = debug_settings["type"];
|
||||
}
|
||||
bool zone_single = true;
|
||||
bool zone_linear = true;
|
||||
bool zone_resizable = false;
|
||||
bool zone_keyboard = false;
|
||||
bool zone_underglow = false;
|
||||
|
||||
if(debug_settings.contains("single"))
|
||||
{
|
||||
@@ -285,66 +364,9 @@ RGBController_Debug::RGBController_Debug(bool custom_controller, json debug_sett
|
||||
zone_underglow = debug_settings["underglow"];
|
||||
}
|
||||
|
||||
if(type_setting == "motherboard")
|
||||
{
|
||||
name = "Debug Motherboard";
|
||||
type = DEVICE_TYPE_MOTHERBOARD;
|
||||
}
|
||||
else if(type_setting == "dram")
|
||||
{
|
||||
name = "Debug DRAM";
|
||||
type = DEVICE_TYPE_DRAM;
|
||||
}
|
||||
else if(type_setting == "gpu")
|
||||
{
|
||||
name = "Debug GPU";
|
||||
type = DEVICE_TYPE_GPU;
|
||||
}
|
||||
else if(type_setting == "keyboard")
|
||||
{
|
||||
name = "Debug Keyboard";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
}
|
||||
else if(type_setting == "mouse")
|
||||
{
|
||||
name = "Debug Mouse";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
}
|
||||
else if(type_setting == "argb")
|
||||
{
|
||||
name = "Debug ARGB Controller";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Fill in debug controller information |
|
||||
\*---------------------------------------------------------*/
|
||||
description = name + " Device";
|
||||
vendor = name + " Vendor String";
|
||||
location = name + " Location String";
|
||||
version = name + " Version String";
|
||||
serial = name + " Serial String";
|
||||
|
||||
if(name_setting != "")
|
||||
{
|
||||
name = name_setting;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Create a direct mode |
|
||||
\*---------------------------------------------------------*/
|
||||
mode Direct;
|
||||
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
|
||||
modes.push_back(Direct);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Create a single zone/LED |
|
||||
\*---------------------------------------------------------*/
|
||||
/*-------------------------------------------------*\
|
||||
| Create a single zone/LED |
|
||||
\*-------------------------------------------------*/
|
||||
if(zone_single)
|
||||
{
|
||||
zone single_zone;
|
||||
@@ -355,7 +377,14 @@ RGBController_Debug::RGBController_Debug(bool custom_controller, json debug_sett
|
||||
single_zone.leds_max = 1;
|
||||
single_zone.leds_count = 1;
|
||||
|
||||
zones.push_back(single_zone);
|
||||
if(first_run)
|
||||
{
|
||||
zones.push_back(single_zone);
|
||||
}
|
||||
else
|
||||
{
|
||||
zones[zone_idx] = single_zone;
|
||||
}
|
||||
|
||||
led single_led;
|
||||
|
||||
@@ -364,11 +393,13 @@ RGBController_Debug::RGBController_Debug(bool custom_controller, json debug_sett
|
||||
leds.push_back(single_led);
|
||||
|
||||
led_alt_names.push_back("");
|
||||
|
||||
zone_idx++;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Create a linear zone |
|
||||
\*---------------------------------------------------------*/
|
||||
/*-------------------------------------------------*\
|
||||
| Create a linear zone |
|
||||
\*-------------------------------------------------*/
|
||||
if(zone_linear)
|
||||
{
|
||||
zone linear_zone;
|
||||
@@ -379,7 +410,14 @@ RGBController_Debug::RGBController_Debug(bool custom_controller, json debug_sett
|
||||
linear_zone.leds_max = 10;
|
||||
linear_zone.leds_count = 10;
|
||||
|
||||
zones.push_back(linear_zone);
|
||||
if(first_run)
|
||||
{
|
||||
zones.push_back(linear_zone);
|
||||
}
|
||||
else
|
||||
{
|
||||
zones[zone_idx] = linear_zone;
|
||||
}
|
||||
|
||||
for(std::size_t led_idx = 0; led_idx < 10; led_idx++)
|
||||
{
|
||||
@@ -391,10 +429,13 @@ RGBController_Debug::RGBController_Debug(bool custom_controller, json debug_sett
|
||||
|
||||
led_alt_names.push_back("");
|
||||
}
|
||||
|
||||
zone_idx++;
|
||||
}
|
||||
/*---------------------------------------------------------*\
|
||||
| Create a keyboard matrix zone |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Create a keyboard matrix zone |
|
||||
\*-------------------------------------------------*/
|
||||
if(zone_keyboard)
|
||||
{
|
||||
KEYBOARD_LAYOUT layout = KEYBOARD_LAYOUT::KEYBOARD_LAYOUT_ANSI_QWERTY;
|
||||
@@ -419,9 +460,9 @@ RGBController_Debug::RGBController_Debug(bool custom_controller, json debug_sett
|
||||
|
||||
description += ", Layout: " + layout_names[layout] + ", Size: " + new_kb.GetName();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Check for custom key inserts and swaps |
|
||||
\*-----------------------------------------------------*/
|
||||
/*---------------------------------------------*\
|
||||
| Check for custom key inserts and swaps |
|
||||
\*---------------------------------------------*/
|
||||
const char* change_keys = "change_keys";
|
||||
|
||||
if(debug_settings.contains(change_keys))
|
||||
@@ -486,7 +527,14 @@ RGBController_Debug::RGBController_Debug(bool custom_controller, json debug_sett
|
||||
keyboard_zone.leds_count = new_kb.GetKeyCount();
|
||||
keyboard_zone.matrix_map = new_kb.GetKeyMap(KEYBOARD_MAP_FILL_TYPE_COUNT);
|
||||
|
||||
zones.push_back(keyboard_zone);
|
||||
if(first_run)
|
||||
{
|
||||
zones.push_back(keyboard_zone);
|
||||
}
|
||||
else
|
||||
{
|
||||
zones[zone_idx] = keyboard_zone;
|
||||
}
|
||||
|
||||
for(unsigned int led_idx = 0; led_idx < keyboard_zone.leds_count; led_idx++)
|
||||
{
|
||||
@@ -498,10 +546,13 @@ RGBController_Debug::RGBController_Debug(bool custom_controller, json debug_sett
|
||||
|
||||
led_alt_names.push_back(new_kb.GetKeyAltNameAt(led_idx));
|
||||
}
|
||||
|
||||
zone_idx++;
|
||||
}
|
||||
/*---------------------------------------------------------*\
|
||||
| Create an underglow matrix zone |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Create an underglow matrix zone |
|
||||
\*-------------------------------------------------*/
|
||||
if(zone_underglow)
|
||||
{
|
||||
zone underglow_zone;
|
||||
@@ -513,7 +564,14 @@ RGBController_Debug::RGBController_Debug(bool custom_controller, json debug_sett
|
||||
underglow_zone.leds_count = 30;
|
||||
underglow_zone.matrix_map.Set(3, 10, (unsigned int*)&debug_keyboard_underglow_map);
|
||||
|
||||
zones.push_back(underglow_zone);
|
||||
if(first_run)
|
||||
{
|
||||
zones.push_back(underglow_zone);
|
||||
}
|
||||
else
|
||||
{
|
||||
zones[zone_idx] = underglow_zone;
|
||||
}
|
||||
|
||||
for(std::size_t led_idx = 0; led_idx < underglow_zone.leds_count; led_idx++)
|
||||
{
|
||||
@@ -525,70 +583,75 @@ RGBController_Debug::RGBController_Debug(bool custom_controller, json debug_sett
|
||||
|
||||
led_alt_names.push_back("");
|
||||
}
|
||||
|
||||
zone_idx++;
|
||||
}
|
||||
/*---------------------------------------------------------*\
|
||||
| Create a resizable linear zone |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Create a resizable linear zone |
|
||||
\*-------------------------------------------------*/
|
||||
if(zone_resizable)
|
||||
{
|
||||
zone resizable_zone;
|
||||
|
||||
resizable_zone.name = "Resizable Zone";
|
||||
resizable_zone.type = ZONE_TYPE_LINEAR;
|
||||
resizable_zone.leds_min = 0;
|
||||
resizable_zone.leds_max = 100;
|
||||
resizable_zone.leds_count = 0;
|
||||
|
||||
zones.push_back(resizable_zone);
|
||||
if(first_run)
|
||||
{
|
||||
resizable_zone.flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
zones.push_back(resizable_zone);
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[zone_idx].name = "Resizable Zone";
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[zone_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[zone_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[zone_idx].matrix_map.width = 0;
|
||||
zones[zone_idx].matrix_map.height = 0;
|
||||
zones[zone_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
for(std::size_t led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
{
|
||||
led resizable_led;
|
||||
|
||||
resizable_led.name = zones[zone_idx].name + ", LED " + std::to_string(led_idx);
|
||||
|
||||
leds.push_back(resizable_led);
|
||||
|
||||
led_alt_names.push_back("");
|
||||
}
|
||||
|
||||
zone_idx++;
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
RGBController_Debug::~RGBController_Debug()
|
||||
void RGBController_Debug::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
void RGBController_Debug::DeviceResizeZone(int index, int new_size)
|
||||
{
|
||||
//Make sure that it isn't out of bounds (negative numbers)
|
||||
if(new_size < int(zones[index].leds_min))
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
new_size = zones[index].leds_min;
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
// Same thing as the above line except for over 100
|
||||
if(new_size > int(zones[index].leds_max))
|
||||
{
|
||||
new_size = zones[index].leds_max;
|
||||
}
|
||||
|
||||
// Store the previous amount of LEDs
|
||||
int old_size = zones[index].leds_count;
|
||||
|
||||
// Set the LED count in the zone to the new ammount
|
||||
zones[index].leds_count = new_size;
|
||||
|
||||
// Set the new ammount of LEDs for to the new size
|
||||
size_t old_leds_size = leds.size();
|
||||
|
||||
// Add the new ammount of LEDs to the old ammount
|
||||
size_t new_leds_size = leds.size() - old_size + new_size;
|
||||
|
||||
leds.resize(std::max(old_leds_size, new_leds_size));
|
||||
|
||||
memmove((void *)(&leds[zones[index].start_idx] + old_leds_size), (const void *)(&leds[zones[index].start_idx] + new_leds_size), (old_leds_size - zones[index].start_idx - old_size) * sizeof(led));
|
||||
|
||||
leds.resize(new_leds_size);
|
||||
|
||||
for(int i = 0; i < new_size; ++i)
|
||||
{
|
||||
leds[zones[index].start_idx + i].name = "Linear LED " + std::to_string(i);
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_Debug::DeviceUpdateLEDs()
|
||||
|
||||
@@ -20,14 +20,20 @@ using json = nlohmann::json;
|
||||
class RGBController_Debug : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_Debug(bool custom_controller, json debug_settings);
|
||||
RGBController_Debug(bool custom, json settings);
|
||||
~RGBController_Debug();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void SetupZones();
|
||||
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
void DeviceUpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
json debug_settings;
|
||||
bool custom_controller;
|
||||
};
|
||||
|
||||
@@ -41,12 +41,7 @@ DetectedControllers DetectE131Controllers()
|
||||
\*---------------------------------------------*/
|
||||
dev.name = "";
|
||||
dev.ip = "";
|
||||
dev.type = ZONE_TYPE_SINGLE;
|
||||
dev.num_leds = 0;
|
||||
dev.rgb_order = E131_RGB_ORDER_RBG;
|
||||
dev.matrix_order = E131_MATRIX_ORDER_HORIZONTAL_TOP_LEFT;
|
||||
dev.matrix_width = 0;
|
||||
dev.matrix_height = 0;
|
||||
dev.start_channel = 1;
|
||||
dev.start_universe = 1;
|
||||
dev.keepalive_time = 0;
|
||||
@@ -82,128 +77,11 @@ DetectedControllers DetectE131Controllers()
|
||||
dev.keepalive_time = e131_settings["devices"][device_idx]["keepalive_time"];
|
||||
}
|
||||
|
||||
if(e131_settings["devices"][device_idx].contains("matrix_order"))
|
||||
{
|
||||
if(e131_settings["devices"][device_idx]["matrix_order"].is_string())
|
||||
{
|
||||
std::string matrix_order_val = e131_settings["devices"][device_idx]["matrix_order"];
|
||||
|
||||
if(matrix_order_val == "HORIZONTAL_TOP_LEFT")
|
||||
{
|
||||
dev.matrix_order = E131_MATRIX_ORDER_HORIZONTAL_TOP_LEFT;
|
||||
}
|
||||
else if(matrix_order_val == "HORIZONTAL_TOP_RIGHT")
|
||||
{
|
||||
dev.matrix_order = E131_MATRIX_ORDER_HORIZONTAL_TOP_RIGHT;
|
||||
}
|
||||
else if(matrix_order_val == "HORIZONTAL_BOTTOM_LEFT")
|
||||
{
|
||||
dev.matrix_order = E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_LEFT;
|
||||
}
|
||||
else if(matrix_order_val == "HORIZONTAL_BOTTOM_RIGHT")
|
||||
{
|
||||
dev.matrix_order = E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_RIGHT;
|
||||
}
|
||||
else if(matrix_order_val == "VERTICAL_TOP_LEFT")
|
||||
{
|
||||
dev.matrix_order = E131_MATRIX_ORDER_VERTICAL_TOP_LEFT;
|
||||
}
|
||||
else if(matrix_order_val == "VERTICAL_TOP_RIGHT")
|
||||
{
|
||||
dev.matrix_order = E131_MATRIX_ORDER_VERTICAL_TOP_RIGHT;
|
||||
}
|
||||
else if(matrix_order_val == "VERTICAL_BOTTOM_LEFT")
|
||||
{
|
||||
dev.matrix_order = E131_MATRIX_ORDER_VERTICAL_BOTTOM_LEFT;
|
||||
}
|
||||
else if(matrix_order_val == "VERTICAL_BOTTOM_RIGHT")
|
||||
{
|
||||
dev.matrix_order = E131_MATRIX_ORDER_VERTICAL_BOTTOM_RIGHT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dev.matrix_order = e131_settings["devices"][device_idx]["matrix_order"];
|
||||
}
|
||||
}
|
||||
|
||||
if(e131_settings["devices"][device_idx].contains("rgb_order"))
|
||||
{
|
||||
if(e131_settings["devices"][device_idx]["rgb_order"].is_string())
|
||||
{
|
||||
std::string rgb_order_val = e131_settings["devices"][device_idx]["rgb_order"];
|
||||
|
||||
if(rgb_order_val == "RGB")
|
||||
{
|
||||
dev.rgb_order = E131_RGB_ORDER_RGB;
|
||||
}
|
||||
else if(rgb_order_val == "RBG")
|
||||
{
|
||||
dev.rgb_order = E131_RGB_ORDER_RBG;
|
||||
}
|
||||
else if(rgb_order_val == "GRB")
|
||||
{
|
||||
dev.rgb_order = E131_RGB_ORDER_GRB;
|
||||
}
|
||||
else if(rgb_order_val == "GBR")
|
||||
{
|
||||
dev.rgb_order = E131_RGB_ORDER_GBR;
|
||||
}
|
||||
else if(rgb_order_val == "BRG")
|
||||
{
|
||||
dev.rgb_order = E131_RGB_ORDER_BRG;
|
||||
}
|
||||
else if(rgb_order_val == "BGR")
|
||||
{
|
||||
dev.rgb_order = E131_RGB_ORDER_BGR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dev.rgb_order = e131_settings["devices"][device_idx]["rgb_order"];
|
||||
}
|
||||
}
|
||||
|
||||
if(e131_settings["devices"][device_idx].contains("matrix_width"))
|
||||
{
|
||||
dev.matrix_width = e131_settings["devices"][device_idx]["matrix_width"];
|
||||
}
|
||||
|
||||
if(e131_settings["devices"][device_idx].contains("matrix_height"))
|
||||
{
|
||||
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"))
|
||||
{
|
||||
if(e131_settings["devices"][device_idx]["type"].is_string())
|
||||
{
|
||||
std::string type_val = e131_settings["devices"][device_idx]["type"];
|
||||
|
||||
if(type_val == "SINGLE")
|
||||
{
|
||||
dev.type = ZONE_TYPE_SINGLE;
|
||||
}
|
||||
else if(type_val == "LINEAR")
|
||||
{
|
||||
dev.type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
else if(type_val == "MATRIX")
|
||||
{
|
||||
dev.type = ZONE_TYPE_MATRIX;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dev.type = e131_settings["devices"][device_idx]["type"];
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------*\
|
||||
| Determine whether to create a new list or add |
|
||||
| this device to an existing list. A device is |
|
||||
|
||||
@@ -28,47 +28,45 @@ using namespace std::chrono_literals;
|
||||
|
||||
RGBController_E131::RGBController_E131(std::vector<E131Device> device_list)
|
||||
{
|
||||
bool multicast = false;
|
||||
bool multicast = false;
|
||||
|
||||
devices = device_list;
|
||||
devices = device_list;
|
||||
|
||||
name = "E1.31 Device Group";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
description = "E1.31 Streaming ACN Device";
|
||||
location = "E1.31: ";
|
||||
name = "E1.31 Device Group";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
description = "E1.31 Streaming ACN Device";
|
||||
location = "E1.31: ";
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| If this controller only represents a |
|
||||
| single device, use the device name for the|
|
||||
| controller name |
|
||||
\*-----------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| If this controller only represents a single device, |
|
||||
| use the device name for the controller name |
|
||||
\*-----------------------------------------------------*/
|
||||
if(devices.size() == 1)
|
||||
{
|
||||
name = devices[0].name;
|
||||
name = devices[0].name;
|
||||
}
|
||||
else if(devices[0].ip != "")
|
||||
{
|
||||
name += " (" + devices[0].ip + ")";
|
||||
name += " (" + devices[0].ip + ")";
|
||||
}
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Append the destination address to the |
|
||||
| location field |
|
||||
\*-----------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Append the destination address to the location field |
|
||||
\*-----------------------------------------------------*/
|
||||
if(devices[0].ip != "")
|
||||
{
|
||||
location += "Unicast " + devices[0].ip + ", ";
|
||||
location += "Unicast " + devices[0].ip + ", ";
|
||||
}
|
||||
else
|
||||
{
|
||||
location += "Multicast, ";
|
||||
multicast = true;
|
||||
multicast = true;
|
||||
}
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Calculate universe list |
|
||||
| Use this to fill in the location field |
|
||||
\*-----------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Calculate universe list |
|
||||
| Use this to fill in the location field |
|
||||
\*-----------------------------------------------------*/
|
||||
std::vector<unsigned int> universe_list;
|
||||
|
||||
for(unsigned int device_idx = 0; device_idx < devices.size(); device_idx++)
|
||||
@@ -96,58 +94,58 @@ RGBController_E131::RGBController_E131(std::vector<E131Device> device_list)
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Append "Universe" and make plural if there|
|
||||
| are multiple universes in use |
|
||||
\*-----------------------------------------*/
|
||||
location += "Universe";
|
||||
/*-----------------------------------------------------*\
|
||||
| Append "Universe" and make plural if there are |
|
||||
| multiple universes in use |
|
||||
\*-----------------------------------------------------*/
|
||||
location += "Universe";
|
||||
|
||||
if(universe_list.size() > 1)
|
||||
{
|
||||
location += "s ";
|
||||
location += "s ";
|
||||
}
|
||||
else
|
||||
{
|
||||
location += " ";
|
||||
location += " ";
|
||||
}
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Append comma separated list of universes |
|
||||
\*-----------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Append comma separated list of universes |
|
||||
\*-----------------------------------------------------*/
|
||||
for(unsigned int univ_list_idx = 0; univ_list_idx < universe_list.size(); univ_list_idx++)
|
||||
{
|
||||
location += std::to_string(universe_list[univ_list_idx]);
|
||||
|
||||
if(univ_list_idx < (universe_list.size() - 1))
|
||||
{
|
||||
location += ", ";
|
||||
location += ", ";
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Set up modes |
|
||||
\*-----------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up modes |
|
||||
\*-----------------------------------------------------*/
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Create E1.31 socket |
|
||||
\*-----------------------------------------*/
|
||||
sockfd = e131_socket();
|
||||
/*-----------------------------------------------------*\
|
||||
| Create E1.31 socket |
|
||||
\*-----------------------------------------------------*/
|
||||
sockfd = e131_socket();
|
||||
|
||||
keepalive_delay = 0ms;
|
||||
keepalive_delay = 0ms;
|
||||
|
||||
SetupZones();
|
||||
|
||||
for (std::size_t device_idx = 0; device_idx < devices.size(); device_idx++)
|
||||
for(std::size_t device_idx = 0; device_idx < devices.size(); device_idx++)
|
||||
{
|
||||
/*-----------------------------------------*\
|
||||
| Update keepalive delay |
|
||||
\*-----------------------------------------*/
|
||||
/*-------------------------------------------------*\
|
||||
| Update keepalive delay |
|
||||
\*-------------------------------------------------*/
|
||||
if(devices[device_idx].keepalive_time > 0)
|
||||
{
|
||||
if(keepalive_delay.count() == 0 || keepalive_delay.count() > devices[device_idx].keepalive_time)
|
||||
@@ -156,9 +154,9 @@ RGBController_E131::RGBController_E131(std::vector<E131Device> device_list)
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Add Universes |
|
||||
\*-----------------------------------------*/
|
||||
/*-------------------------------------------------*\
|
||||
| Add Universes |
|
||||
\*-------------------------------------------------*/
|
||||
float universe_size = (float)devices[device_idx].universe_size;
|
||||
unsigned int total_universes = (unsigned int)ceil( ( ( devices[device_idx].num_leds * 3 ) + devices[device_idx].start_channel ) / universe_size );
|
||||
|
||||
@@ -196,104 +194,6 @@ RGBController_E131::RGBController_E131(std::vector<E131Device> device_list)
|
||||
dest_addrs.push_back(dest_addr);
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Generate matrix maps |
|
||||
\*-----------------------------------------*/
|
||||
if(devices[device_idx].type == ZONE_TYPE_MATRIX)
|
||||
{
|
||||
unsigned int led_idx = 0;
|
||||
matrix_map_type new_map;
|
||||
|
||||
new_map.width = devices[device_idx].matrix_width;
|
||||
new_map.height = devices[device_idx].matrix_height;
|
||||
new_map.map.resize(devices[device_idx].matrix_width * devices[device_idx].matrix_height);
|
||||
|
||||
switch(devices[device_idx].matrix_order)
|
||||
{
|
||||
case E131_MATRIX_ORDER_HORIZONTAL_TOP_LEFT:
|
||||
for(unsigned int y = 0; y < new_map.height; y++)
|
||||
{
|
||||
for(unsigned int x = 0; x < new_map.width; x++)
|
||||
{
|
||||
new_map.map[(y * new_map.width) + x] = led_idx;
|
||||
led_idx++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case E131_MATRIX_ORDER_HORIZONTAL_TOP_RIGHT:
|
||||
for(unsigned int y = 0; y < new_map.height; y++)
|
||||
{
|
||||
for(int x = new_map.width - 1; x >= 0; x--)
|
||||
{
|
||||
new_map.map[(y * new_map.width) + x] = led_idx;
|
||||
led_idx++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_LEFT:
|
||||
for(int y = new_map.height; y >= 0; y--)
|
||||
{
|
||||
for(unsigned int x = 0; x < new_map.width; x++)
|
||||
{
|
||||
new_map.map[(y * new_map.width) + x] = led_idx;
|
||||
led_idx++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_RIGHT:
|
||||
for(int y = new_map.height; y >= 0; y--)
|
||||
{
|
||||
for(int x = new_map.width - 1; x >= 0; x--)
|
||||
{
|
||||
new_map.map[(y * new_map.width) + x] = led_idx;
|
||||
led_idx++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case E131_MATRIX_ORDER_VERTICAL_TOP_LEFT:
|
||||
for(unsigned int x = 0; x < new_map.width; x++)
|
||||
{
|
||||
for(unsigned int y = 0; y < new_map.height; y++)
|
||||
{
|
||||
new_map.map[(y * new_map.width) + x] = led_idx;
|
||||
led_idx++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case E131_MATRIX_ORDER_VERTICAL_TOP_RIGHT:
|
||||
for(int x = new_map.width - 1; x >= 0; x--)
|
||||
{
|
||||
for(unsigned int y = 0; y < new_map.height; y++)
|
||||
{
|
||||
new_map.map[(y * new_map.width) + x] = led_idx;
|
||||
led_idx++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case E131_MATRIX_ORDER_VERTICAL_BOTTOM_LEFT:
|
||||
for(unsigned int x = 0; x < new_map.width; x++)
|
||||
{
|
||||
for(int y = new_map.height - 1; y >= 0; y--)
|
||||
{
|
||||
new_map.map[(y * new_map.width) + x] = led_idx;
|
||||
led_idx++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case E131_MATRIX_ORDER_VERTICAL_BOTTOM_RIGHT:
|
||||
for(int x = new_map.width - 1; x >= 0; x--)
|
||||
{
|
||||
for(int y = new_map.height - 1; y >= 0; y--)
|
||||
{
|
||||
new_map.map[(y * new_map.width) + x] = led_idx;
|
||||
led_idx++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
zones[device_idx].matrix_map = new_map;
|
||||
}
|
||||
}
|
||||
|
||||
if(keepalive_delay.count() > 0)
|
||||
@@ -322,23 +222,28 @@ RGBController_E131::~RGBController_E131()
|
||||
|
||||
void RGBController_E131::SetupZones()
|
||||
{
|
||||
/*-----------------------------------------*\
|
||||
| Add Zones |
|
||||
\*-----------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Add Zones |
|
||||
\*-----------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < devices.size(); zone_idx++)
|
||||
{
|
||||
zone led_zone;
|
||||
led_zone.name = devices[zone_idx].name;
|
||||
led_zone.type = devices[zone_idx].type;
|
||||
led_zone.type = ZONE_TYPE_LINEAR;
|
||||
led_zone.leds_min = devices[zone_idx].num_leds;
|
||||
led_zone.leds_max = devices[zone_idx].num_leds;
|
||||
led_zone.leds_count = devices[zone_idx].num_leds;
|
||||
led_zone.flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_SEGMENTS
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_COLOR_ORDER;
|
||||
|
||||
zones.push_back(led_zone);
|
||||
}
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Add LEDs |
|
||||
\*-----------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Add LEDs |
|
||||
\*-----------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
for(std::size_t led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
|
||||
@@ -16,46 +16,15 @@
|
||||
#include <e131.h>
|
||||
#include "RGBController.h"
|
||||
|
||||
typedef unsigned int e131_rgb_order;
|
||||
|
||||
enum
|
||||
{
|
||||
E131_RGB_ORDER_RGB,
|
||||
E131_RGB_ORDER_RBG,
|
||||
E131_RGB_ORDER_GRB,
|
||||
E131_RGB_ORDER_GBR,
|
||||
E131_RGB_ORDER_BRG,
|
||||
E131_RGB_ORDER_BGR
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
E131_MATRIX_ORDER_HORIZONTAL_TOP_LEFT,
|
||||
E131_MATRIX_ORDER_HORIZONTAL_TOP_RIGHT,
|
||||
E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_LEFT,
|
||||
E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_RIGHT,
|
||||
E131_MATRIX_ORDER_VERTICAL_TOP_LEFT,
|
||||
E131_MATRIX_ORDER_VERTICAL_TOP_RIGHT,
|
||||
E131_MATRIX_ORDER_VERTICAL_BOTTOM_LEFT,
|
||||
E131_MATRIX_ORDER_VERTICAL_BOTTOM_RIGHT
|
||||
};
|
||||
|
||||
typedef unsigned int e131_matrix_order;
|
||||
|
||||
struct E131Device
|
||||
{
|
||||
std::string name;
|
||||
std::string ip;
|
||||
unsigned int num_leds;
|
||||
unsigned int start_universe;
|
||||
unsigned int start_channel;
|
||||
unsigned int keepalive_time;
|
||||
e131_rgb_order rgb_order;
|
||||
zone_type type;
|
||||
unsigned int matrix_width;
|
||||
unsigned int matrix_height;
|
||||
unsigned int universe_size;
|
||||
e131_matrix_order matrix_order;
|
||||
std::string ip;
|
||||
std::string name;
|
||||
unsigned int keepalive_time;
|
||||
unsigned int num_leds;
|
||||
unsigned int start_channel;
|
||||
unsigned int start_universe;
|
||||
unsigned int universe_size;
|
||||
};
|
||||
|
||||
class RGBController_E131 : public RGBController
|
||||
|
||||
@@ -257,9 +257,9 @@ void RGBController_EVGAGPUv3::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_EVGAGPUv3::DeviceResizeZone(int /*zone*/, int newSize)
|
||||
void RGBController_EVGAGPUv3::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
controller->ResizeARGB(newSize);
|
||||
controller->ResizeARGB(zones[zone_idx].leds_count);
|
||||
}
|
||||
|
||||
void RGBController_EVGAGPUv3::DeviceUpdateLEDs()
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -458,181 +458,228 @@ RGBController_GaiZhongGaiKeyboard::~RGBController_GaiZhongGaiKeyboard()
|
||||
|
||||
void RGBController_GaiZhongGaiKeyboard::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zones |
|
||||
\*---------------------------------------------------------*/
|
||||
char str[10];
|
||||
unsigned int total_led_count = 0;
|
||||
unsigned int zone_idx_len = 1;
|
||||
unsigned int temp;
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
{
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-----------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.clear();
|
||||
|
||||
for(unsigned int zone_idx = 0; zone_idx < zone_idx_len; zone_idx++)
|
||||
{
|
||||
zone new_zone;
|
||||
|
||||
switch(controller->GetUSBPID())
|
||||
{
|
||||
case GAIZHONGGAI_68_PRO_PID:
|
||||
{
|
||||
new_zone.type = ZONE_TYPE_MATRIX;
|
||||
new_zone.leds_min = 68;
|
||||
new_zone.leds_max = 68;
|
||||
new_zone.leds_count = 68;
|
||||
new_zone.matrix_map.Set(17, 5, (unsigned int *)&matrix_map_68);
|
||||
new_zone.name = zone_names[zone_idx];
|
||||
}
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_42_PRO_PID:
|
||||
{
|
||||
new_zone.type = ZONE_TYPE_MATRIX;
|
||||
new_zone.leds_min = 42;
|
||||
new_zone.leds_max = 42;
|
||||
new_zone.leds_count = 42;
|
||||
new_zone.matrix_map.Set(12, 4, (unsigned int *)&matrix_map_42);
|
||||
new_zone.name = zone_names[zone_idx];
|
||||
}
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_17_TOUCH_PRO_PID:
|
||||
{
|
||||
new_zone.type = ZONE_TYPE_MATRIX;
|
||||
new_zone.leds_min = 88;
|
||||
new_zone.leds_max = 88;
|
||||
new_zone.leds_count = 88;
|
||||
new_zone.matrix_map.Set(5, 5, (unsigned int *)&matrix_map_PAD_Touch);
|
||||
new_zone.name = zone_names[zone_idx];
|
||||
}
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_17_PRO_PID:
|
||||
{
|
||||
new_zone.type = ZONE_TYPE_MATRIX;
|
||||
new_zone.leds_min = 85;
|
||||
new_zone.leds_max = 85;
|
||||
new_zone.leds_count = 85;
|
||||
new_zone.matrix_map.Set(4, 5, (unsigned int *)&matrix_map_17PAD);
|
||||
new_zone.name = zone_names[zone_idx];
|
||||
}
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_20_PRO_PID:
|
||||
{
|
||||
new_zone.type = ZONE_TYPE_MATRIX;
|
||||
new_zone.leds_min = 88;
|
||||
new_zone.leds_max = 88;
|
||||
new_zone.leds_count = 88;
|
||||
new_zone.matrix_map.Set(4, 6, (unsigned int *)&matrix_map_20PAD);
|
||||
new_zone.name = zone_names[zone_idx];
|
||||
}
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_DIAL_PID:
|
||||
{
|
||||
new_zone.type = ZONE_TYPE_MATRIX;
|
||||
new_zone.leds_min = 89;
|
||||
new_zone.leds_max = 89;
|
||||
new_zone.leds_count = 89;
|
||||
new_zone.matrix_map.Set(2, 2, (unsigned int *)&matrix_map_dial);
|
||||
new_zone.name = zone_names[zone_idx];
|
||||
}
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_LIGHT_BOARD_PID:
|
||||
{
|
||||
temp = LightBoard_init(controller->GetDataFlash());//get led_len
|
||||
new_zone.type = ZONE_TYPE_MATRIX;
|
||||
new_zone.leds_min = temp;
|
||||
new_zone.leds_max = temp;
|
||||
new_zone.leds_count = temp;
|
||||
new_zone.matrix_map.Set(controller->GetDataFlash()[124], controller->GetDataFlash()[125], (unsigned int *)&matrix_map_light_board);
|
||||
new_zone.name = zone_names[zone_idx + 1];
|
||||
}
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_RGB_HUB_GREEN_PID:
|
||||
{
|
||||
zone_idx_len = 4;
|
||||
temp = controller->GetChannelLen(zone_idx);//get led_len
|
||||
new_zone.type = ZONE_TYPE_LINEAR;
|
||||
new_zone.leds_min = 1;
|
||||
new_zone.leds_max = 637;
|
||||
new_zone.leds_count = temp;
|
||||
new_zone.name = zone_names[zone_idx + 1];
|
||||
}
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_RGB_HUB_BLUE_PID:
|
||||
{
|
||||
zone_idx_len = 8;
|
||||
temp = controller->GetChannelLen(zone_idx);//get led_len
|
||||
new_zone.type = ZONE_TYPE_LINEAR;
|
||||
new_zone.leds_min = 1;
|
||||
new_zone.leds_max = 633;
|
||||
new_zone.leds_count = temp;
|
||||
new_zone.name = zone_names[zone_idx + 1];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
zones.push_back(new_zone);
|
||||
|
||||
total_led_count += new_zone.leds_count;
|
||||
}
|
||||
|
||||
switch(controller->GetUSBPID())
|
||||
{
|
||||
case GAIZHONGGAI_LIGHT_BOARD_PID:
|
||||
case GAIZHONGGAI_RGB_HUB_GREEN_PID:
|
||||
case GAIZHONGGAI_RGB_HUB_BLUE_PID:
|
||||
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
snprintf(str, 10, "RGB_%03d", led_idx + 1);
|
||||
new_led.name = str;
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
default:
|
||||
zones.resize(1);
|
||||
break;
|
||||
case GAIZHONGGAI_42_PRO_PID:
|
||||
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
|
||||
{
|
||||
|
||||
case GAIZHONGGAI_RGB_HUB_GREEN_PID:
|
||||
zones.resize(4);
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_RGB_HUB_BLUE_PID:
|
||||
zones.resize(8);
|
||||
break;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up zones |
|
||||
\*-----------------------------------------------------*/
|
||||
unsigned int temp;
|
||||
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
switch(controller->GetUSBPID())
|
||||
{
|
||||
case GAIZHONGGAI_68_PRO_PID:
|
||||
zones[zone_idx].name = zone_names[zone_idx];
|
||||
zones[zone_idx].type = ZONE_TYPE_MATRIX;
|
||||
zones[zone_idx].leds_min = 68;
|
||||
zones[zone_idx].leds_max = 68;
|
||||
zones[zone_idx].leds_count = 68;
|
||||
zones[zone_idx].matrix_map.Set(17, 5, (unsigned int *)&matrix_map_68);
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_42_PRO_PID:
|
||||
zones[zone_idx].name = zone_names[zone_idx];
|
||||
zones[zone_idx].type = ZONE_TYPE_MATRIX;
|
||||
zones[zone_idx].leds_min = 42;
|
||||
zones[zone_idx].leds_max = 42;
|
||||
zones[zone_idx].leds_count = 42;
|
||||
zones[zone_idx].matrix_map.Set(12, 4, (unsigned int *)&matrix_map_42);
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_17_TOUCH_PRO_PID:
|
||||
zones[zone_idx].name = zone_names[zone_idx];
|
||||
zones[zone_idx].type = ZONE_TYPE_MATRIX;
|
||||
zones[zone_idx].leds_min = 88;
|
||||
zones[zone_idx].leds_max = 88;
|
||||
zones[zone_idx].leds_count = 88;
|
||||
zones[zone_idx].matrix_map.Set(5, 5, (unsigned int *)&matrix_map_PAD_Touch);
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_17_PRO_PID:
|
||||
zones[zone_idx].name = zone_names[zone_idx];
|
||||
zones[zone_idx].type = ZONE_TYPE_MATRIX;
|
||||
zones[zone_idx].leds_min = 85;
|
||||
zones[zone_idx].leds_max = 85;
|
||||
zones[zone_idx].leds_count = 85;
|
||||
zones[zone_idx].matrix_map.Set(4, 5, (unsigned int *)&matrix_map_17PAD);
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_20_PRO_PID:
|
||||
zones[zone_idx].name = zone_names[zone_idx];
|
||||
zones[zone_idx].type = ZONE_TYPE_MATRIX;
|
||||
zones[zone_idx].leds_min = 88;
|
||||
zones[zone_idx].leds_max = 88;
|
||||
zones[zone_idx].leds_count = 88;
|
||||
zones[zone_idx].matrix_map.Set(4, 6, (unsigned int *)&matrix_map_20PAD);
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_DIAL_PID:
|
||||
zones[zone_idx].name = zone_names[zone_idx];
|
||||
zones[zone_idx].type = ZONE_TYPE_MATRIX;
|
||||
zones[zone_idx].leds_min = 89;
|
||||
zones[zone_idx].leds_max = 89;
|
||||
zones[zone_idx].leds_count = 89;
|
||||
zones[zone_idx].matrix_map.Set(2, 2, (unsigned int *)&matrix_map_dial);
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_LIGHT_BOARD_PID:
|
||||
temp = LightBoard_init(controller->GetDataFlash());//get led_len
|
||||
zones[zone_idx].name = zone_names[zone_idx + 1];
|
||||
zones[zone_idx].type = ZONE_TYPE_MATRIX;
|
||||
zones[zone_idx].leds_min = temp;
|
||||
zones[zone_idx].leds_max = temp;
|
||||
zones[zone_idx].leds_count = temp;
|
||||
zones[zone_idx].matrix_map.Set(controller->GetDataFlash()[124], controller->GetDataFlash()[125], (unsigned int *)&matrix_map_light_board);
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_RGB_HUB_GREEN_PID:
|
||||
temp = controller->GetChannelLen(zone_idx);//get led_len
|
||||
zones[zone_idx].leds_min = 0;
|
||||
zones[zone_idx].leds_max = 637;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[zone_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[zone_idx].name = zone_names[zone_idx + 1];
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[zone_idx].leds_count = temp;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[zone_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[zone_idx].matrix_map.width = 0;
|
||||
zones[zone_idx].matrix_map.height = 0;
|
||||
zones[zone_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_RGB_HUB_BLUE_PID:
|
||||
temp = controller->GetChannelLen(zone_idx);//get led_len
|
||||
zones[zone_idx].leds_min = 0;
|
||||
zones[zone_idx].leds_max = 633;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[zone_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[zone_idx].name = zone_names[zone_idx + 1];
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[zone_idx].leds_count = temp;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[zone_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[zone_idx].matrix_map.width = 0;
|
||||
zones[zone_idx].matrix_map.height = 0;
|
||||
zones[zone_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
switch(controller->GetUSBPID())
|
||||
{
|
||||
case GAIZHONGGAI_LIGHT_BOARD_PID:
|
||||
case GAIZHONGGAI_RGB_HUB_GREEN_PID:
|
||||
case GAIZHONGGAI_RGB_HUB_BLUE_PID:
|
||||
for(std::size_t led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = zones[zone_idx].name + ", LED " + std::to_string(led_idx + 1);
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_42_PRO_PID:
|
||||
for(std::size_t led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = led_names_42key[led_idx];
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
|
||||
{
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
for(std::size_t led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = led_names_general[led_idx];
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_GaiZhongGaiKeyboard::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_GaiZhongGaiKeyboard::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
switch(controller->GetUSBPID())
|
||||
{
|
||||
case GAIZHONGGAI_RGB_HUB_GREEN_PID:
|
||||
case GAIZHONGGAI_RGB_HUB_BLUE_PID:
|
||||
controller->SetChannelLen(zone, new_size);
|
||||
controller->SetChannelLen(zone_idx, zones[zone_idx].leds_count);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
~RGBController_GaiZhongGaiKeyboard();
|
||||
|
||||
void SetupZones();
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -328,52 +328,132 @@ void RGBController_RGBFusion2USB::Init_Controller()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Iterate through layout and process each zone |
|
||||
\*---------------------------------------------------------*/
|
||||
for(uint8_t zone_idx = 0; zone_idx < GB_FUSION2_ZONES_MAX; zone_idx++)
|
||||
{
|
||||
if(!layout->zones[0][zone_idx])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const gb_fusion2_zone* zone_at_idx = layout->zones[0][zone_idx];
|
||||
|
||||
zone new_zone;
|
||||
new_zone.name = zone_at_idx->name;
|
||||
new_zone.leds_min = zone_at_idx->leds_min;
|
||||
new_zone.leds_max = zone_at_idx->leds_max;
|
||||
new_zone.leds_count = new_zone.leds_min;
|
||||
new_zone.type = (new_zone.leds_min == new_zone.leds_max) ? ZONE_TYPE_SINGLE : ZONE_TYPE_LINEAR;
|
||||
zones.emplace_back(new_zone);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_RGBFusion2USB::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*---------------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
{
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-----------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Count number of zones to resize zones vector |
|
||||
\*-----------------------------------------------------*/
|
||||
unsigned int num_zones;
|
||||
|
||||
for(num_zones = 0; num_zones < GB_FUSION2_ZONES_MAX; num_zones++)
|
||||
{
|
||||
if(!gb_fusion2_device_list[device_index]->zones[0][num_zones])
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
zones.resize(num_zones);
|
||||
|
||||
unsigned int d1 = 0, d2 = 0, d3 = 0, d4 = 0;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zones (Fixed so as to not spam the controller) |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
for(uint8_t zone_idx = 0; zone_idx < GB_FUSION2_ZONES_MAX; zone_idx++)
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up zones (Fixed so as to not spam the controller) |
|
||||
\*-----------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Get zone configuration from device data |
|
||||
\*-------------------------------------------------*/
|
||||
const gb_fusion2_zone* zone_at_idx = gb_fusion2_device_list[device_index]->zones[0][zone_idx];
|
||||
|
||||
if(!zone_at_idx)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
bool single_zone = (zone_at_idx->leds_min == zone_at_idx->leds_max);
|
||||
|
||||
if(!single_zone)
|
||||
/*-------------------------------------------------*\
|
||||
| Check if this is a fixed-size zone |
|
||||
\*-------------------------------------------------*/
|
||||
bool fixed_zone = (zone_at_idx->leds_min == zone_at_idx->leds_max);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| (Re-)initialize the zone |
|
||||
\*-------------------------------------------------*/
|
||||
if(fixed_zone)
|
||||
{
|
||||
zones[zone_idx].name = zone_at_idx->name;
|
||||
zones[zone_idx].type = ZONE_TYPE_SINGLE;
|
||||
zones[zone_idx].leds_min = zone_at_idx->leds_min;
|
||||
zones[zone_idx].leds_max = zone_at_idx->leds_max;
|
||||
zones[zone_idx].leds_count = zones[zone_idx].leds_min;
|
||||
}
|
||||
else
|
||||
{
|
||||
zones[zone_idx].leds_min = zone_at_idx->leds_min;
|
||||
zones[zone_idx].leds_max = zone_at_idx->leds_max;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[zone_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[zone_idx].name = zone_at_idx->name;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[zone_idx].leds_count = zone_at_idx->leds_min;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[zone_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[zone_idx].matrix_map.width = 0;
|
||||
zones[zone_idx].matrix_map.height = 0;
|
||||
zones[zone_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Initialize LEDs |
|
||||
\*-------------------------------------------------*/
|
||||
for(unsigned int led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
|
||||
new_led.name = zone_at_idx->name;
|
||||
new_led.value = zone_at_idx->idx;
|
||||
|
||||
if(!fixed_zone)
|
||||
{
|
||||
new_led.name.append(", LED " + std::to_string(led_idx + 1));
|
||||
}
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| If not a fixed-size zone, set up LED sizes |
|
||||
\*-------------------------------------------------*/
|
||||
if(!fixed_zone)
|
||||
{
|
||||
switch(zone_at_idx->idx)
|
||||
{
|
||||
@@ -392,21 +472,6 @@ void RGBController_RGBFusion2USB::SetupZones()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for(unsigned int led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
|
||||
new_led.name = zone_at_idx->name;
|
||||
new_led.value = zone_at_idx->idx;
|
||||
|
||||
if(!single_zone)
|
||||
{
|
||||
new_led.name.append(" LED " + std::to_string(led_idx));
|
||||
}
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
}
|
||||
|
||||
controller->SetLedCount(d1, d2, d3, d4);
|
||||
@@ -414,17 +479,10 @@ void RGBController_RGBFusion2USB::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_RGBFusion2USB::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_RGBFusion2USB::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -113,27 +113,20 @@ void RGBController_Govee::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_Govee::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_Govee::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if(zone < 0 || zone >= (int)zones.size() || new_size <= 0)
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
leds.clear();
|
||||
leds.resize(zones[zone_idx].leds_count);
|
||||
for(unsigned int i = 0; i < zones[zone_idx].leds_count; i++)
|
||||
{
|
||||
leds[i].name = "Govee LED " + std::to_string(i);
|
||||
}
|
||||
|
||||
SetupColors(); /* re-sync color buffers with LED count */
|
||||
DeviceUpdateLEDs(); /* push an updated frame */
|
||||
}
|
||||
|
||||
new_size = std::max(1, std::min(255, new_size));
|
||||
zones[zone].leds_count = new_size;
|
||||
zones[zone].leds_min = 1;
|
||||
zones[zone].leds_max = 255;
|
||||
|
||||
leds.clear();
|
||||
leds.resize(new_size);
|
||||
for(int i = 0; i < new_size; ++i)
|
||||
{
|
||||
leds[i].name = "Govee LED " + std::to_string(i);
|
||||
}
|
||||
|
||||
SetupColors(); /* re-sync color buffers with LED count */
|
||||
DeviceUpdateLEDs(); /* push an updated frame */
|
||||
}
|
||||
|
||||
void RGBController_Govee::DeviceUpdateLEDs()
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
~RGBController_Govee();
|
||||
|
||||
void SetupZones();
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -185,9 +185,9 @@ RGBController_JGINYUEInternalUSB::~RGBController_JGINYUEInternalUSB()
|
||||
|
||||
void RGBController_JGINYUEInternalUSB::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
@@ -195,39 +195,57 @@ void RGBController_JGINYUEInternalUSB::SetupZones()
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-----------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(JGINYUE_MAX_ZONES);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-------------------------------------------------*/
|
||||
zones[0].name = "ARGB Header 1";
|
||||
zones[0].type = ZONE_TYPE_LINEAR;
|
||||
zones[0].leds_min = 0;
|
||||
zones[0].leds_max = 100;
|
||||
|
||||
zones[1].name = "ARGB Header 2";
|
||||
zones[1].type = ZONE_TYPE_LINEAR;
|
||||
zones[1].leds_min = 0;
|
||||
zones[1].leds_max = 100;
|
||||
|
||||
if(first_run)
|
||||
/*-----------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-----------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
zones[0].leds_count = 0;
|
||||
zones[1].leds_count = 0;
|
||||
}
|
||||
zones[zone_idx].leds_min = 0;
|
||||
zones[zone_idx].leds_max = 100;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[zone_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[zone_idx].name = "Addressable RGB Header ";
|
||||
zones[zone_idx].name.append(std::to_string(zone_idx + 1));
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[zone_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[zone_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[zone_idx].matrix_map.width = 0;
|
||||
zones[zone_idx].matrix_map.height = 0;
|
||||
zones[zone_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
for(unsigned int zone_idx = 0; zone_idx < JGINYUE_MAX_ZONES; zone_idx++)
|
||||
{
|
||||
for(unsigned int led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = "ARGB Header " + std::to_string(zone_idx + 1) + " LED " + std::to_string(led_idx + 1);
|
||||
new_led.value = led_idx;
|
||||
new_led.name = zones[zone_idx].name + ", LED " + std::to_string(led_idx + 1);
|
||||
new_led.value = led_idx;
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
}
|
||||
@@ -235,28 +253,29 @@ void RGBController_JGINYUEInternalUSB::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_JGINYUEInternalUSB::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_JGINYUEInternalUSB::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
unsigned char area;
|
||||
|
||||
switch(zone)
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
case 0:
|
||||
area = 0x01;
|
||||
break;
|
||||
case 1:
|
||||
area = 0x02;
|
||||
break;
|
||||
default:
|
||||
area = 0x01;
|
||||
break;
|
||||
unsigned char area;
|
||||
|
||||
switch(zone_idx)
|
||||
{
|
||||
case 0:
|
||||
area = 0x01;
|
||||
break;
|
||||
case 1:
|
||||
area = 0x02;
|
||||
break;
|
||||
default:
|
||||
area = 0x01;
|
||||
break;
|
||||
}
|
||||
|
||||
controller->Area_resize(zones[zone_idx].leds_count, area);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
|
||||
controller->Area_resize(new_size, area);
|
||||
}
|
||||
|
||||
void RGBController_JGINYUEInternalUSB::DeviceUpdateLEDs()
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -328,7 +328,7 @@ RGBController_JGINYUEInternalUSBV2::RGBController_JGINYUEInternalUSBV2(JGINYUEIn
|
||||
Hourglass.colors.resize(8);
|
||||
//modes.push_back(Hourglass);
|
||||
|
||||
InitZones();
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_JGINYUEInternalUSBV2::~RGBController_JGINYUEInternalUSBV2()
|
||||
@@ -340,28 +340,102 @@ RGBController_JGINYUEInternalUSBV2::~RGBController_JGINYUEInternalUSBV2()
|
||||
|
||||
void RGBController_JGINYUEInternalUSBV2::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
{
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-----------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-------------------------------------------------*/
|
||||
unsigned char normal_zone_count = controller->GetZoneCount();
|
||||
if((controller->support_Global_zone == true) && (normal_zone_count > 1))
|
||||
{
|
||||
normal_zone_count--;
|
||||
//TODO support_Global_zone
|
||||
}
|
||||
zones.resize(normal_zone_count);
|
||||
|
||||
for(unsigned int zone_idx = 0; zone_idx < normal_zone_count; zone_idx++)
|
||||
/*-----------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-----------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
std::string zone_name;
|
||||
|
||||
switch(controller->device_config[zone_idx].Area_ID)
|
||||
{
|
||||
case JGINYUE_USB_V2_ARGB_STRIP_1:
|
||||
zone_name = "ARGB Strip Header 1";
|
||||
break;
|
||||
case JGINYUE_USB_V2_ARGB_STRIP_2:
|
||||
zone_name = "ARGB Strip Header 2";
|
||||
break;
|
||||
case JGINYUE_USB_V2_ARGB_FAN_1:
|
||||
zone_name = "ARGB Fan Header 1";
|
||||
break;
|
||||
case JGINYUE_USB_V2_ARGB_FAN_2:
|
||||
zone_name = "ARGB Fan Header 2";
|
||||
break;
|
||||
case JGINYUE_USB_V2_ARGB_FAN_3:
|
||||
zone_name = "ARGB Fan Header 3";
|
||||
break;
|
||||
case JGINYUE_USB_V2_ARGB_FAN_4:
|
||||
zone_name = "ARGB Fan Header 4";
|
||||
break;
|
||||
case JGINYUE_USB_V2_ARGB_FAN_5:
|
||||
zone_name = "ARGB Fan Header 5";
|
||||
break;
|
||||
default:
|
||||
zone_name = "Unknown Device";
|
||||
break;
|
||||
}
|
||||
|
||||
zones[zone_idx].leds_min = 0;
|
||||
zones[zone_idx].leds_max = controller->device_config[zone_idx].Max_LED_numbers;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[zone_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[zone_idx].name = zone_name;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[zone_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[zone_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[zone_idx].matrix_map.width = 0;
|
||||
zones[zone_idx].matrix_map.height = 0;
|
||||
zones[zone_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
for(unsigned int led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = zones[zone_idx].name + " LED#" + std::to_string(led_idx + 1);
|
||||
new_led.name = zones[zone_idx].name + ", LED " + std::to_string(led_idx + 1);
|
||||
new_led.value = 0;
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
@@ -370,23 +444,24 @@ void RGBController_JGINYUEInternalUSBV2::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_JGINYUEInternalUSBV2::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_JGINYUEInternalUSBV2::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
unsigned char area;
|
||||
|
||||
area = controller->device_config[zone].Area_ID;
|
||||
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
|
||||
if(modes[active_mode].value == JGINYUE_USB_V2_MODE_DIRECT)
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
controller->DirectLEDControl(zones[zone].colors, new_size, area);
|
||||
}
|
||||
else
|
||||
{
|
||||
controller->WriteZoneMode(area,modes[active_mode].value, new_size,modes[active_mode].colors, modes[active_mode].speed, modes[active_mode].brightness, modes[active_mode].direction);
|
||||
unsigned char area;
|
||||
|
||||
area = controller->device_config[zone_idx].Area_ID;
|
||||
|
||||
SetupZones();
|
||||
|
||||
if(modes[active_mode].value == JGINYUE_USB_V2_MODE_DIRECT)
|
||||
{
|
||||
controller->DirectLEDControl(zones[zone_idx].colors, zones[zone_idx].leds_count, area);
|
||||
}
|
||||
else
|
||||
{
|
||||
controller->WriteZoneMode(area, modes[active_mode].value, zones[zone_idx].leds_count, modes[active_mode].colors, modes[active_mode].speed, modes[active_mode].brightness, modes[active_mode].direction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,56 +532,3 @@ void RGBController_JGINYUEInternalUSBV2::DeviceUpdateZoneMode(int zone)
|
||||
modes[active_mode].brightness,
|
||||
modes[active_mode].direction);
|
||||
}
|
||||
|
||||
void RGBController_JGINYUEInternalUSBV2::InitZones()
|
||||
{
|
||||
unsigned char normal_zone_count = controller->GetZoneCount();
|
||||
zones.clear();
|
||||
zones.resize(normal_zone_count);
|
||||
|
||||
if((controller->support_Global_zone == true) && (normal_zone_count > 1))
|
||||
{
|
||||
normal_zone_count--;
|
||||
//TODO support_Global_zone
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < normal_zone_count; i++)
|
||||
{
|
||||
zone * zone_to_init = &(zones[i]);
|
||||
AreaConfigurationV2 * cfg = &(controller->device_config[i]);
|
||||
|
||||
zone_to_init->leds_min = 0;
|
||||
zone_to_init->leds_max = cfg->Max_LED_numbers;
|
||||
zone_to_init->leds_count = 0;
|
||||
zone_to_init->type = ZONE_TYPE_LINEAR;
|
||||
|
||||
switch(cfg->Area_ID)
|
||||
{
|
||||
case JGINYUE_USB_V2_ARGB_STRIP_1:
|
||||
zone_to_init->name = "ARGB Strip Header 1";
|
||||
break;
|
||||
case JGINYUE_USB_V2_ARGB_STRIP_2:
|
||||
zone_to_init->name = "ARGB Strip Header 2";
|
||||
break;
|
||||
case JGINYUE_USB_V2_ARGB_FAN_1:
|
||||
zone_to_init->name = "ARGB Fan Header 1";
|
||||
break;
|
||||
case JGINYUE_USB_V2_ARGB_FAN_2:
|
||||
zone_to_init->name = "ARGB Fan Header 2";
|
||||
break;
|
||||
case JGINYUE_USB_V2_ARGB_FAN_3:
|
||||
zone_to_init->name = "ARGB Fan Header 3";
|
||||
break;
|
||||
case JGINYUE_USB_V2_ARGB_FAN_4:
|
||||
zone_to_init->name = "ARGB Fan Header 4";
|
||||
break;
|
||||
case JGINYUE_USB_V2_ARGB_FAN_5:
|
||||
zone_to_init->name = "ARGB Fan Header 5";
|
||||
break;
|
||||
default:
|
||||
zone_to_init->name = "Unknow Device";
|
||||
break;
|
||||
}
|
||||
}
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
@@ -35,5 +35,4 @@ public:
|
||||
|
||||
private:
|
||||
JGINYUEInternalUSBV2Controller* controller;
|
||||
void InitZones();
|
||||
};
|
||||
|
||||
@@ -13,20 +13,6 @@
|
||||
#include <string>
|
||||
#include "RGBController_LianLiUniHubAL.h"
|
||||
|
||||
//0xFFFFFFFF indicates an unused entry in matrix
|
||||
#define NA 0xFFFFFFFF
|
||||
|
||||
static unsigned int matrix_map[8][35] =
|
||||
{ { NA, NA, 10, NA, NA, 11, NA, NA, NA, NA, NA, 30, NA, NA, 31, NA, NA, NA, NA, NA, 50, NA, NA, 51, NA, NA, NA, NA, NA, 70, NA, NA, 71, NA, NA},
|
||||
{ NA, 9, NA, NA, NA, NA, 12, NA, NA, NA, 29, NA, NA, NA, NA, 32, NA, NA, NA, 49, NA, NA, NA, NA, 52, NA, NA, NA, 69, NA, NA, NA, NA, 72, NA},
|
||||
{ 8, NA, NA, 1, 2, NA, NA, 13, NA, 28, NA, NA, 21, 22, NA, NA, 33, NA, 48, NA, NA, 41, 42, NA, NA, 53, NA, 68, NA, NA, 61, 62, NA, NA, 73},
|
||||
{ NA, NA, 0, NA, NA, 3, NA, NA, NA, NA, NA, 20, NA, NA, 23, NA, NA, NA, NA, NA, 40, NA, NA, 43, NA, NA, NA, NA, NA, 60, NA, NA, 63, NA, NA},
|
||||
{ NA, NA, 7, NA, NA, 4, NA, NA, NA, NA, NA, 27, NA, NA, 24, NA, NA, NA, NA, NA, 47, NA, NA, 44, NA, NA, NA, NA, NA, 67, NA, NA, 64, NA, NA},
|
||||
{ 19, NA, NA, 6, 5, NA, NA, 14, NA, 39, NA, NA, 26, 25, NA, NA, 34, NA, 59, NA, NA, 46, 45, NA, NA, 54, NA, 79, NA, NA, 66, 65, NA, NA, 74},
|
||||
{ NA, 18, NA, NA, NA, NA, 15, NA, NA, NA, 38, NA, NA, NA, NA, 35, NA, NA, NA, 58, NA, NA, NA, NA, 55, NA, NA, NA, 78, NA, NA, NA, NA, 75, NA},
|
||||
{ NA, NA, 17, NA, NA, 16, NA, NA, NA, NA, NA, 37, NA, NA, 36, NA, NA, NA, NA, NA, 57, NA, NA, 56, NA, NA, NA, NA, NA, 77, NA, NA, 76, NA, NA}
|
||||
};
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name Lian Li Uni Hub AL
|
||||
@type USB
|
||||
@@ -49,7 +35,6 @@ RGBController_LianLiUniHubAL::RGBController_LianLiUniHubAL(LianLiUniHubALControl
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
|
||||
initializedMode = false;
|
||||
|
||||
mode Custom;
|
||||
@@ -350,7 +335,7 @@ RGBController_LianLiUniHubAL::RGBController_LianLiUniHubAL(LianLiUniHubALControl
|
||||
Contest.colors.resize(3);
|
||||
modes.push_back(Contest);
|
||||
|
||||
RGBController_LianLiUniHubAL::SetupZones();
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_LianLiUniHubAL::~RGBController_LianLiUniHubAL()
|
||||
@@ -370,7 +355,6 @@ void RGBController_LianLiUniHubAL::SetupZones()
|
||||
if(zones.size() == 0)
|
||||
{
|
||||
first_run = true;
|
||||
zones.resize(UNIHUB_AL_CHANNEL_COUNT);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
@@ -378,70 +362,70 @@ void RGBController_LianLiUniHubAL::SetupZones()
|
||||
\*-------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(UNIHUB_AL_CHANNEL_COUNT);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-------------------------------------------------*/
|
||||
for(unsigned int channel_idx = 0; channel_idx < zones.size(); channel_idx++)
|
||||
for(std::size_t channel_idx = 0; channel_idx < zones.size(); channel_idx++)
|
||||
{
|
||||
zones[channel_idx].name = "Channel ";
|
||||
zones[channel_idx].name.append(std::to_string(channel_idx + 1));
|
||||
|
||||
// Note: Matrix types won't get loaded from the sizes.ors as the default zone type in this RGBController is ZONE_TYPE_LINEAR
|
||||
// This will require augmentation on the ProfileManager.cpp to be able to override zone types but this is probably not wanted in general
|
||||
if (zones[channel_idx].leds_count == 60 || zones[channel_idx].leds_count == 40 || zones[channel_idx].leds_count == 20 || zones[channel_idx].leds_count == 80) // Assume they're AL120 Fans
|
||||
{
|
||||
zones[channel_idx].type = ZONE_TYPE_MATRIX;
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = UNIHUB_AL_CHAN_LED_COUNT;
|
||||
zones[channel_idx].matrix_map.Set(8, 35, (unsigned int *)&matrix_map);
|
||||
}
|
||||
else // Treat as regular LED strip
|
||||
{
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = UNIHUB_AL_CHAN_LED_COUNT;
|
||||
}
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = UNIHUB_AL_CHAN_LED_COUNT;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[channel_idx].leds_count = zones[channel_idx].leds_min;
|
||||
zones[channel_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[channel_idx].name = "Channel ";
|
||||
zones[channel_idx].name.append(std::to_string(channel_idx + 1));
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[channel_idx].matrix_map.width = 0;
|
||||
zones[channel_idx].matrix_map.height = 0;
|
||||
zones[channel_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = zones[channel_idx].name;
|
||||
new_led.name.append(", LED ");
|
||||
new_led.name.append(std::to_string(led_ch_idx + 1));
|
||||
new_led.value = channel_idx;
|
||||
new_led.name = zones[channel_idx].name + ", LED " + std::to_string(led_ch_idx + 1);
|
||||
new_led.value = channel_idx;
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_LianLiUniHubAL::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_LianLiUniHubAL::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_LianLiUniHubAL::DeviceUpdateLEDs()
|
||||
{
|
||||
|
||||
if(!initializedMode)
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
@@ -470,7 +454,6 @@ void RGBController_LianLiUniHubAL::DeviceUpdateZoneLEDs(int zone)
|
||||
void RGBController_LianLiUniHubAL::DeviceUpdateSingleLED(int /* led */)
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
|
||||
}
|
||||
|
||||
void RGBController_LianLiUniHubAL::DeviceUpdateMode()
|
||||
@@ -488,7 +471,6 @@ void RGBController_LianLiUniHubAL::DeviceUpdateMode()
|
||||
/*-----------------------------------------------------*\
|
||||
| Check modes that requires updating both arrays |
|
||||
\*-----------------------------------------------------*/
|
||||
|
||||
switch(modes[active_mode].value)
|
||||
{
|
||||
case UNIHUB_AL_LED_MODE_STATIC_COLOR:
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -212,7 +212,7 @@ RGBController_LianLiUniHub::RGBController_LianLiUniHub(LianLiUniHubController* c
|
||||
Rgbh.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Rgbh);
|
||||
|
||||
RGBController_LianLiUniHub::SetupZones();
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_LianLiUniHub::~RGBController_LianLiUniHub()
|
||||
@@ -244,31 +244,47 @@ void RGBController_LianLiUniHub::SetupZones()
|
||||
/*-------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-------------------------------------------------*/
|
||||
int addressableCounter = 1;
|
||||
for(unsigned int channel_idx = 0; channel_idx < zones.size(); channel_idx++)
|
||||
for(std::size_t channel_idx = 0; channel_idx < zones.size(); channel_idx++)
|
||||
{
|
||||
zones[channel_idx].name = "Channel ";
|
||||
zones[channel_idx].name.append(std::to_string(addressableCounter));
|
||||
|
||||
addressableCounter++;
|
||||
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = UNIHUB_CHANLED_COUNT;
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = UNIHUB_CHANLED_COUNT;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[channel_idx].leds_count = zones[channel_idx].leds_min;
|
||||
zones[channel_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[channel_idx].name = "Channel ";
|
||||
zones[channel_idx].name.append(std::to_string(channel_idx + 1));
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[channel_idx].matrix_map.width = 0;
|
||||
zones[channel_idx].matrix_map.height = 0;
|
||||
zones[channel_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = zones[channel_idx].name;
|
||||
new_led.name.append(", LED ");
|
||||
new_led.name.append(std::to_string(led_ch_idx + 1));
|
||||
new_led.value = channel_idx;
|
||||
new_led.name = zones[channel_idx].name + ", LED " + std::to_string(led_ch_idx + 1);
|
||||
new_led.value = channel_idx;
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
@@ -277,17 +293,10 @@ void RGBController_LianLiUniHub::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_LianLiUniHub::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_LianLiUniHub::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
~RGBController_LianLiUniHub();
|
||||
|
||||
void SetupZones();
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -281,7 +281,7 @@ RGBController_LianLiUniHubSL::RGBController_LianLiUniHubSL(LianLiUniHubSLControl
|
||||
}
|
||||
}
|
||||
|
||||
RGBController_LianLiUniHubSL::SetupZones();
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_LianLiUniHubSL::~RGBController_LianLiUniHubSL()
|
||||
@@ -293,36 +293,67 @@ RGBController_LianLiUniHubSL::~RGBController_LianLiUniHubSL()
|
||||
|
||||
void RGBController_LianLiUniHubSL::SetupZones()
|
||||
{
|
||||
bool first_run = zones.size() == 0;
|
||||
/*-------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
if(first_run)
|
||||
if(zones.size() == 0)
|
||||
{
|
||||
zones.resize(UNIHUB_SL_MAX_CHANNEL);
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
for(size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
zones[zone_idx].name = "Channel ";
|
||||
zones[zone_idx].name.append(std::to_string(zone_idx + 1));
|
||||
zones[zone_idx].type = ZONE_TYPE_LINEAR;
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(UNIHUB_SL_MAX_CHANNEL);
|
||||
|
||||
zones[zone_idx].leds_min = 0;
|
||||
zones[zone_idx].leds_max = UNIHUB_SL_MAX_FAN_PER_CHANNEL;
|
||||
/*-------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-------------------------------------------------*/
|
||||
for(std::size_t channel_idx = 0; channel_idx < zones.size(); channel_idx++)
|
||||
{
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = UNIHUB_SL_MAX_FAN_PER_CHANNEL;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[zone_idx].leds_count = zones[zone_idx].leds_min;
|
||||
zones[channel_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
for(unsigned int led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[channel_idx].name = "Channel ";
|
||||
zones[channel_idx].name.append(std::to_string(channel_idx + 1));
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[channel_idx].matrix_map.width = 0;
|
||||
zones[channel_idx].matrix_map.height = 0;
|
||||
zones[channel_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = zones[zone_idx].name;
|
||||
new_led.name.append(", Fan ");
|
||||
new_led.name.append(std::to_string(led_idx + 1));
|
||||
new_led.value = (unsigned int)zone_idx;
|
||||
new_led.name = zones[channel_idx].name + ", LED " + std::to_string(led_ch_idx + 1);
|
||||
new_led.value = channel_idx;
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
@@ -331,17 +362,10 @@ void RGBController_LianLiUniHubSL::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_LianLiUniHubSL::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_LianLiUniHubSL::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t)zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -309,7 +309,7 @@ RGBController_LianLiUniHubSLInfinity::RGBController_LianLiUniHubSLInfinity(LianL
|
||||
Tunnel.colors.resize(4);
|
||||
modes.push_back(Tunnel);
|
||||
|
||||
RGBController_LianLiUniHubSLInfinity::SetupZones();
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_LianLiUniHubSLInfinity::~RGBController_LianLiUniHubSLInfinity()
|
||||
@@ -329,7 +329,6 @@ void RGBController_LianLiUniHubSLInfinity::SetupZones()
|
||||
if(zones.size() == 0)
|
||||
{
|
||||
first_run = true;
|
||||
zones.resize(UNIHUB_SLINF_CHANNEL_COUNT);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
@@ -337,51 +336,64 @@ void RGBController_LianLiUniHubSLInfinity::SetupZones()
|
||||
\*-------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(UNIHUB_SLINF_CHANNEL_COUNT);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-------------------------------------------------*/
|
||||
for(unsigned int channel_idx = 0; channel_idx < zones.size(); channel_idx++)
|
||||
for(std::size_t channel_idx = 0; channel_idx < zones.size(); channel_idx++)
|
||||
{
|
||||
zones[channel_idx].name = "Channel ";
|
||||
zones[channel_idx].name.append(std::to_string(channel_idx + 1));
|
||||
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = UNIHUB_SLINF_CHAN_LED_COUNT;
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = UNIHUB_SLINF_CHAN_LED_COUNT;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[channel_idx].leds_count = zones[channel_idx].leds_min;
|
||||
zones[channel_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[channel_idx].name = "Channel ";
|
||||
zones[channel_idx].name.append(std::to_string(channel_idx + 1));
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[channel_idx].matrix_map.width = 0;
|
||||
zones[channel_idx].matrix_map.height = 0;
|
||||
zones[channel_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = zones[channel_idx].name;
|
||||
new_led.name.append(", LED ");
|
||||
new_led.name.append(std::to_string(led_ch_idx + 1));
|
||||
new_led.value = channel_idx;
|
||||
new_led.name = zones[channel_idx].name + ", LED " + std::to_string(led_ch_idx + 1);
|
||||
new_led.value = channel_idx;
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_LianLiUniHubSLInfinity::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_LianLiUniHubSLInfinity::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
@@ -417,7 +429,6 @@ void RGBController_LianLiUniHubSLInfinity::DeviceUpdateZoneLEDs(int zone)
|
||||
void RGBController_LianLiUniHubSLInfinity::DeviceUpdateSingleLED(int /* led */)
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
|
||||
}
|
||||
|
||||
void RGBController_LianLiUniHubSLInfinity::DeviceUpdateMode()
|
||||
@@ -442,6 +453,5 @@ void RGBController_LianLiUniHubSLInfinity::DeviceUpdateMode()
|
||||
controller->SetChannelMode((unsigned char)zone_idx,
|
||||
modes[active_mode],
|
||||
fan_idx);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -308,7 +308,7 @@ RGBController_LianLiUniHubSLV2::RGBController_LianLiUniHubSLV2(LianLiUniHubSLV2C
|
||||
Tunnel.colors.resize(4);
|
||||
modes.push_back(Tunnel);
|
||||
|
||||
RGBController_LianLiUniHubSLV2::SetupZones();
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_LianLiUniHubSLV2::~RGBController_LianLiUniHubSLV2()
|
||||
@@ -328,7 +328,6 @@ void RGBController_LianLiUniHubSLV2::SetupZones()
|
||||
if(zones.size() == 0)
|
||||
{
|
||||
first_run = true;
|
||||
zones.resize(UNIHUB_SLV2_CHANNEL_COUNT);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
@@ -336,58 +335,70 @@ void RGBController_LianLiUniHubSLV2::SetupZones()
|
||||
\*-------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(UNIHUB_SLV2_CHANNEL_COUNT);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-------------------------------------------------*/
|
||||
for(unsigned int channel_idx = 0; channel_idx < zones.size(); channel_idx++)
|
||||
for(std::size_t channel_idx = 0; channel_idx < zones.size(); channel_idx++)
|
||||
{
|
||||
zones[channel_idx].name = "Channel ";
|
||||
zones[channel_idx].name.append(std::to_string(channel_idx + 1));
|
||||
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = UNIHUB_SLV2_CHAN_LED_COUNT;
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = UNIHUB_SLV2_CHAN_LED_COUNT;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[channel_idx].leds_count = zones[channel_idx].leds_min;
|
||||
zones[channel_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[channel_idx].name = "Channel ";
|
||||
zones[channel_idx].name.append(std::to_string(channel_idx + 1));
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[channel_idx].matrix_map.width = 0;
|
||||
zones[channel_idx].matrix_map.height = 0;
|
||||
zones[channel_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = zones[channel_idx].name;
|
||||
new_led.name.append(", LED ");
|
||||
new_led.name.append(std::to_string(led_ch_idx + 1));
|
||||
new_led.value = channel_idx;
|
||||
new_led.name = zones[channel_idx].name + ", LED " + std::to_string(led_ch_idx + 1);
|
||||
new_led.value = channel_idx;
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_LianLiUniHubSLV2::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_LianLiUniHubSLV2::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_LianLiUniHubSLV2::DeviceUpdateLEDs()
|
||||
{
|
||||
|
||||
if(!initializedMode)
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
@@ -441,6 +452,5 @@ void RGBController_LianLiUniHubSLV2::DeviceUpdateMode()
|
||||
controller->SetChannelMode((unsigned char)zone_idx,
|
||||
modes[active_mode],
|
||||
fan_idx);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -350,7 +350,7 @@ RGBController_LianLiUniHub_AL10::RGBController_LianLiUniHub_AL10(LianLiUniHub_AL
|
||||
modes.push_back(Rgbh);
|
||||
*/
|
||||
|
||||
RGBController_LianLiUniHub_AL10::SetupZones();
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_LianLiUniHub_AL10::~RGBController_LianLiUniHub_AL10()
|
||||
@@ -382,31 +382,47 @@ void RGBController_LianLiUniHub_AL10::SetupZones()
|
||||
/*-------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-------------------------------------------------*/
|
||||
int addressableCounter = 1;
|
||||
for(unsigned int channel_idx = 0; channel_idx < zones.size(); channel_idx++)
|
||||
for(std::size_t channel_idx = 0; channel_idx < zones.size(); channel_idx++)
|
||||
{
|
||||
zones[channel_idx].name = "Channel ";
|
||||
zones[channel_idx].name.append(std::to_string(addressableCounter));
|
||||
|
||||
addressableCounter++;
|
||||
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = UNIHUB_AL10_CHANLED_COUNT;
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = UNIHUB_AL10_CHANLED_COUNT;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[channel_idx].leds_count = zones[channel_idx].leds_min;
|
||||
zones[channel_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[channel_idx].name = "Channel ";
|
||||
zones[channel_idx].name.append(std::to_string(channel_idx + 1));
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[channel_idx].matrix_map.width = 0;
|
||||
zones[channel_idx].matrix_map.height = 0;
|
||||
zones[channel_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = zones[channel_idx].name;
|
||||
new_led.name.append(", LED ");
|
||||
new_led.name.append(std::to_string(led_ch_idx + 1));
|
||||
new_led.value = channel_idx;
|
||||
new_led.name = zones[channel_idx].name + ", LED " + std::to_string(led_ch_idx + 1);
|
||||
new_led.value = channel_idx;
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
@@ -415,17 +431,10 @@ void RGBController_LianLiUniHub_AL10::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_LianLiUniHub_AL10::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_LianLiUniHub_AL10::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -124,12 +124,9 @@ int RGBController_MSIMysticLight185::GetDeviceMode()
|
||||
|
||||
void RGBController_MSIMysticLight185::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
@@ -137,106 +134,109 @@ void RGBController_MSIMysticLight185::SetupZones()
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
if(first_run)
|
||||
/*-----------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-----------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(zone_description.size());
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up zones |
|
||||
\*-----------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zones |
|
||||
\*---------------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < zone_description.size(); ++zone_idx)
|
||||
const ZoneDescription* zd = zone_description[zone_idx];
|
||||
unsigned int maxLeds = (unsigned int)controller->GetMaxDirectLeds(zd->zone_type);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| This is a fixed size zone |
|
||||
\*-------------------------------------------------*/
|
||||
if(((zd->zone_type != MSI_ZONE_J_RAINBOW_1)
|
||||
&& (zd->zone_type != MSI_ZONE_J_RAINBOW_2)
|
||||
&& (zd->zone_type != MSI_ZONE_J_RAINBOW_3)
|
||||
&& (zd->zone_type != MSI_ZONE_J_CORSAIR)))
|
||||
{
|
||||
const ZoneDescription* zd = zone_description[zone_idx];
|
||||
|
||||
zone new_zone;
|
||||
|
||||
new_zone.name = zd->name;
|
||||
new_zone.flags = 0;
|
||||
|
||||
int maxLeds = (int)controller->GetMaxDirectLeds(zd->zone_type);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| This is a fixed size zone |
|
||||
\*-------------------------------------------------*/
|
||||
if(((zd->zone_type != MSI_ZONE_J_RAINBOW_1)
|
||||
&& (zd->zone_type != MSI_ZONE_J_RAINBOW_2)
|
||||
&& (zd->zone_type != MSI_ZONE_J_RAINBOW_3)
|
||||
&& (zd->zone_type != MSI_ZONE_J_CORSAIR)))
|
||||
{
|
||||
new_zone.leds_min = maxLeds;
|
||||
new_zone.leds_max = maxLeds;
|
||||
new_zone.leds_count = maxLeds;
|
||||
}
|
||||
/*--------------------------------------------------\
|
||||
| This is a resizable zone on a board that does not |
|
||||
| support per-LED direct mode |
|
||||
\*-------------------------------------------------*/
|
||||
else if(controller->GetSupportedDirectMode() == MSIMysticLight185Controller::DIRECT_MODE_ZONE_BASED)
|
||||
{
|
||||
new_zone.leds_min = 0;
|
||||
new_zone.leds_max = 30;//maxLeds;
|
||||
new_zone.leds_count = 0;
|
||||
last_resizable_zone = zd->zone_type;
|
||||
new_zone.flags |= ZONE_FLAG_RESIZE_EFFECTS_ONLY;
|
||||
}
|
||||
/*--------------------------------------------------\
|
||||
| This is a resizable zone on a board that does |
|
||||
| support per-LED direct mode |
|
||||
\*-------------------------------------------------*/
|
||||
else
|
||||
{
|
||||
new_zone.leds_min = 0;
|
||||
new_zone.leds_max = maxLeds;
|
||||
new_zone.leds_count = 0;
|
||||
last_resizable_zone = zd->zone_type;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Determine zone type based on max number of LEDs |
|
||||
\*-------------------------------------------------*/
|
||||
if((new_zone.leds_max == 1) || (new_zone.flags & ZONE_FLAG_RESIZE_EFFECTS_ONLY))
|
||||
{
|
||||
new_zone.type = ZONE_TYPE_SINGLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
new_zone.type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
zones.push_back(new_zone);
|
||||
zones[zone_idx].name = zd->name;
|
||||
zones[zone_idx].type = ZONE_TYPE_SINGLE;
|
||||
zones[zone_idx].flags = 0;
|
||||
zones[zone_idx].leds_min = maxLeds;
|
||||
zones[zone_idx].leds_max = maxLeds;
|
||||
zones[zone_idx].leds_count = maxLeds;
|
||||
}
|
||||
}
|
||||
/*--------------------------------------------------\
|
||||
| This is a resizable zone on a board that does not |
|
||||
| support per-LED direct mode |
|
||||
\*-------------------------------------------------*/
|
||||
else if(controller->GetSupportedDirectMode() == MSIMysticLight185Controller::DIRECT_MODE_ZONE_BASED)
|
||||
{
|
||||
zones[zone_idx].name = zd->name;
|
||||
zones[zone_idx].type = ZONE_TYPE_SINGLE;
|
||||
zones[zone_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE_EFFECTS_ONLY;
|
||||
zones[zone_idx].leds_min = 0;
|
||||
zones[zone_idx].leds_max = 30;//maxLeds;
|
||||
zones[zone_idx].leds_count = 0;
|
||||
last_resizable_zone = zd->zone_type;
|
||||
}
|
||||
/*--------------------------------------------------\
|
||||
| This is a resizable zone on a board that does |
|
||||
| support per-LED direct mode |
|
||||
\*-------------------------------------------------*/
|
||||
else
|
||||
{
|
||||
zones[zone_idx].leds_min = 0;
|
||||
zones[zone_idx].leds_max = maxLeds;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[zone_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[zone_idx].name = zd->name;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[zone_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[zone_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[zone_idx].matrix_map.width = 0;
|
||||
zones[zone_idx].matrix_map.height = 0;
|
||||
zones[zone_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
last_resizable_zone = zd->zone_type;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up LEDs |
|
||||
\*---------------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < zone_description.size(); ++zone_idx)
|
||||
{
|
||||
controller->SetCycleCount(zone_description[zone_idx]->zone_type, zones[zone_idx].leds_count);
|
||||
|
||||
if((zones[zone_idx].flags & ZONE_FLAG_RESIZE_EFFECTS_ONLY) == 0)
|
||||
if((zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE_EFFECTS_ONLY) == 0)
|
||||
{
|
||||
for(std::size_t led_idx = 0; led_idx < zones[zone_idx].leds_count; ++led_idx)
|
||||
for(std::size_t led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
|
||||
new_led.name = zones[zone_idx].name;
|
||||
|
||||
if(zones[zone_idx].leds_count > 1)
|
||||
{
|
||||
new_led.name.append(" LED " + std::to_string(led_idx + 1));
|
||||
}
|
||||
|
||||
new_led.value = zone_description[zone_idx]->zone_type;
|
||||
new_led.name = zones[zone_idx].name + ", LED " + std::to_string(led_idx + 1);
|
||||
new_led.value = zone_description[zone_idx]->zone_type;
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
}
|
||||
else if(zones[zone_idx].leds_count > 0)
|
||||
{
|
||||
led new_led;
|
||||
|
||||
new_led.name = zones[zone_idx].name;
|
||||
|
||||
new_led.value = zone_description[zone_idx]->zone_type;
|
||||
new_led.name = zones[zone_idx].name;
|
||||
new_led.value = zone_description[zone_idx]->zone_type;
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
}
|
||||
@@ -244,23 +244,13 @@ void RGBController_MSIMysticLight185::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_MSIMysticLight185::DeviceResizeZone
|
||||
(
|
||||
int zone,
|
||||
int new_size
|
||||
)
|
||||
void RGBController_MSIMysticLight185::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t)zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
SetupZones();
|
||||
|
||||
if(zone_description[zone]->zone_type == last_resizable_zone)
|
||||
if(zone_description[zone_idx]->zone_type == last_resizable_zone)
|
||||
{
|
||||
GetDeviceConfig();
|
||||
last_resizable_zone = MSI_ZONE_NONE;
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
~RGBController_MSIMysticLight185();
|
||||
|
||||
void SetupZones();
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -104,12 +104,9 @@ int RGBController_MSIMysticLight761::GetDeviceMode()
|
||||
|
||||
void RGBController_MSIMysticLight761::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
@@ -117,109 +114,109 @@ void RGBController_MSIMysticLight761::SetupZones()
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
if(first_run)
|
||||
/*-----------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-----------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(zone_description.size());
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up zones |
|
||||
\*-----------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zones |
|
||||
\*---------------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < zone_description.size(); ++zone_idx)
|
||||
const ZoneDescription* zd = zone_description[zone_idx];
|
||||
unsigned int maxLeds = (unsigned int)controller->GetMaxDirectLeds(zd->zone_type);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| This is a fixed size zone |
|
||||
\*-------------------------------------------------*/
|
||||
if(((zd->zone_type != MSI_ZONE_J_RAINBOW_1)
|
||||
&& (zd->zone_type != MSI_ZONE_J_RAINBOW_2)
|
||||
&& (zd->zone_type != MSI_ZONE_J_RAINBOW_3)
|
||||
&& (zd->zone_type != MSI_ZONE_J_CORSAIR)))
|
||||
{
|
||||
const ZoneDescription* zd = zone_description[zone_idx];
|
||||
|
||||
zone new_zone;
|
||||
|
||||
new_zone.name = zd->name;
|
||||
new_zone.flags = 0;
|
||||
|
||||
int maxLeds = (int)controller->GetMaxDirectLeds(zd->zone_type);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| This is a fixed size zone |
|
||||
\*-------------------------------------------------*/
|
||||
if(((zd->zone_type != MSI_ZONE_J_RAINBOW_1)
|
||||
&& (zd->zone_type != MSI_ZONE_J_RAINBOW_2)
|
||||
&& (zd->zone_type != MSI_ZONE_J_RAINBOW_3)
|
||||
&& (zd->zone_type != MSI_ZONE_JAF)
|
||||
&& (zd->zone_type != MSI_ZONE_JARGB_1)
|
||||
&& (zd->zone_type != MSI_ZONE_JARGB_2)
|
||||
&& (zd->zone_type != MSI_ZONE_JARGB_3)
|
||||
&& (zd->zone_type != MSI_ZONE_J_CORSAIR)))
|
||||
{
|
||||
new_zone.leds_min = maxLeds;
|
||||
new_zone.leds_max = maxLeds;
|
||||
new_zone.leds_count = maxLeds;
|
||||
}
|
||||
/*--------------------------------------------------*\
|
||||
| This is a resizable zone on a board that does not |
|
||||
| support per-LED direct mode |
|
||||
\*--------------------------------------------------*/
|
||||
else if(controller->GetSupportedDirectMode() == MSIMysticLight761Controller::DIRECT_MODE_ZONE_BASED)
|
||||
{
|
||||
new_zone.leds_min = 0;
|
||||
new_zone.leds_max = 30;//maxLeds;
|
||||
new_zone.leds_count = 0;
|
||||
last_resizable_zone = zd->zone_type;
|
||||
new_zone.flags |= ZONE_FLAG_RESIZE_EFFECTS_ONLY;
|
||||
}
|
||||
/*--------------------------------------------------*\
|
||||
| This is a resizable zone on a board that does |
|
||||
| support per-LED direct mode |
|
||||
\*--------------------------------------------------*/
|
||||
else
|
||||
{
|
||||
new_zone.leds_min = 0;
|
||||
new_zone.leds_max = maxLeds;
|
||||
new_zone.leds_count = 0;
|
||||
last_resizable_zone = zd->zone_type;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Determine zone type based on max number of LEDs |
|
||||
\*-------------------------------------------------*/
|
||||
if((new_zone.leds_max == 1) || (new_zone.flags & ZONE_FLAG_RESIZE_EFFECTS_ONLY))
|
||||
{
|
||||
new_zone.type = ZONE_TYPE_SINGLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
new_zone.type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
zones.push_back(new_zone);
|
||||
zones[zone_idx].name = zd->name;
|
||||
zones[zone_idx].type = ZONE_TYPE_SINGLE;
|
||||
zones[zone_idx].flags = 0;
|
||||
zones[zone_idx].leds_min = maxLeds;
|
||||
zones[zone_idx].leds_max = maxLeds;
|
||||
zones[zone_idx].leds_count = maxLeds;
|
||||
}
|
||||
/*--------------------------------------------------\
|
||||
| This is a resizable zone on a board that does not |
|
||||
| support per-LED direct mode |
|
||||
\*-------------------------------------------------*/
|
||||
else if(controller->GetSupportedDirectMode() == MSIMysticLight761Controller::DIRECT_MODE_ZONE_BASED)
|
||||
{
|
||||
zones[zone_idx].name = zd->name;
|
||||
zones[zone_idx].type = ZONE_TYPE_SINGLE;
|
||||
zones[zone_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE_EFFECTS_ONLY;
|
||||
zones[zone_idx].leds_min = 0;
|
||||
zones[zone_idx].leds_max = 30;//maxLeds;
|
||||
zones[zone_idx].leds_count = 0;
|
||||
last_resizable_zone = zd->zone_type;
|
||||
}
|
||||
/*--------------------------------------------------\
|
||||
| This is a resizable zone on a board that does |
|
||||
| support per-LED direct mode |
|
||||
\*-------------------------------------------------*/
|
||||
else
|
||||
{
|
||||
zones[zone_idx].leds_min = 0;
|
||||
zones[zone_idx].leds_max = maxLeds;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[zone_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[zone_idx].name = zd->name;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[zone_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[zone_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[zone_idx].matrix_map.width = 0;
|
||||
zones[zone_idx].matrix_map.height = 0;
|
||||
zones[zone_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
last_resizable_zone = zd->zone_type;
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up LEDs |
|
||||
\*---------------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < zone_description.size(); ++zone_idx)
|
||||
{
|
||||
controller->SetCycleCount(zone_description[zone_idx]->zone_type, zones[zone_idx].leds_count);
|
||||
|
||||
if((zones[zone_idx].flags & ZONE_FLAG_RESIZE_EFFECTS_ONLY) == 0)
|
||||
if((zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE_EFFECTS_ONLY) == 0)
|
||||
{
|
||||
for(unsigned int led_idx = 0; led_idx < zones[zone_idx].leds_count; ++led_idx)
|
||||
for(std::size_t led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
|
||||
new_led.name = zones[zone_idx].name;
|
||||
|
||||
if(zones[zone_idx].leds_count > 1)
|
||||
{
|
||||
new_led.name.append(" LED " + std::to_string(led_idx + 1));
|
||||
}
|
||||
|
||||
new_led.value = zone_description[zone_idx]->zone_type;
|
||||
new_led.name = zones[zone_idx].name + ", LED " + std::to_string(led_idx + 1);
|
||||
new_led.value = zone_description[zone_idx]->zone_type;
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
}
|
||||
else if(zones[zone_idx].leds_count > 0)
|
||||
{
|
||||
led new_led;
|
||||
|
||||
new_led.name = zones[zone_idx].name;
|
||||
|
||||
new_led.value = zone_description[zone_idx]->zone_type;
|
||||
new_led.name = zones[zone_idx].name;
|
||||
new_led.value = zone_description[zone_idx]->zone_type;
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
}
|
||||
@@ -228,23 +225,13 @@ void RGBController_MSIMysticLight761::SetupZones()
|
||||
}
|
||||
|
||||
|
||||
void RGBController_MSIMysticLight761::DeviceResizeZone
|
||||
(
|
||||
int zone,
|
||||
int new_size
|
||||
)
|
||||
void RGBController_MSIMysticLight761::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((std::size_t)zone >= zones.size())
|
||||
if((std::size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
SetupZones();
|
||||
|
||||
if(zone_description[zone]->zone_type == last_resizable_zone)
|
||||
if(zone_description[zone_idx]->zone_type == last_resizable_zone)
|
||||
{
|
||||
GetDeviceConfig();
|
||||
last_resizable_zone = MSI_ZONE_NONE;
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
~RGBController_MSIMysticLight761();
|
||||
|
||||
void SetupZones();
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -427,17 +427,10 @@ void RGBController_NZXTHue2::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_NZXTHue2::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_NZXTHue2::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
void SetupModes();
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -231,9 +231,9 @@ void RGBController_HuePlus::SetupModes()
|
||||
|
||||
void RGBController_HuePlus::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
@@ -241,62 +241,69 @@ void RGBController_HuePlus::SetupZones()
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-----------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(HUE_PLUS_NUM_CHANNELS);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Set up zones |
|
||||
\*-------------------------------------------------*/
|
||||
for(unsigned int zone_idx = 0; zone_idx < HUE_PLUS_NUM_CHANNELS; zone_idx++)
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up zones |
|
||||
\*-----------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
zones[zone_idx].name = "Hue+ Channel ";
|
||||
zones[zone_idx].name.append(std::to_string(zone_idx + 1));
|
||||
zones[zone_idx].type = ZONE_TYPE_LINEAR;
|
||||
zones[zone_idx].leds_min = 0;
|
||||
zones[zone_idx].leds_max = 40;
|
||||
zones[zone_idx].leds_min = 0;
|
||||
zones[zone_idx].leds_max = 40;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[zone_idx].leds_count = controller->channel_leds[zone_idx];
|
||||
zones[zone_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Set up LEDs |
|
||||
\*-------------------------------------------------*/
|
||||
for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
for(unsigned int led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[zone_idx].name = "NZXT Hue+ RGB Header ";
|
||||
zones[zone_idx].name.append(std::to_string(zone_idx + 1));
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[zone_idx].leds_count = controller->channel_leds[zone_idx];
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[zone_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[zone_idx].matrix_map.width = 0;
|
||||
zones[zone_idx].matrix_map.height = 0;
|
||||
zones[zone_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[zone_idx].leds_count; led_ch_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = "Hue+ Channel ";
|
||||
new_led.name.append(std::to_string(zone_idx + 1));
|
||||
new_led.name.append(", LED ");
|
||||
new_led.name.append(std::to_string(led_idx + 1));
|
||||
new_led.value = zone_idx;
|
||||
new_led.name = zones[zone_idx].name + ", LED " + std::to_string(led_ch_idx + 1);
|
||||
|
||||
leds.push_back(new_led);
|
||||
leds_channel.push_back(zone_idx);
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_HuePlus::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_HuePlus::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
void SetupModes();
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -22,6 +22,21 @@ NollieController::NollieController(hid_device* dev_handle, const char* path, uns
|
||||
name = dev_name;
|
||||
usb_vid = vid;
|
||||
usb_pid = pid;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Loop through all known devices to look for a PID |
|
||||
| match |
|
||||
\*-----------------------------------------------------*/
|
||||
for(unsigned int i = 0; i < NOLLIE_NUM_DEVICES; i++)
|
||||
{
|
||||
if((nollie_device_list[i]->vid == vid) && (nollie_device_list[i]->pid == pid))
|
||||
{
|
||||
/*---------------------------------------------*\
|
||||
| Set device index |
|
||||
\*---------------------------------------------*/
|
||||
device_index = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string NollieController::GetLocationString()
|
||||
@@ -57,7 +72,46 @@ unsigned short NollieController::GetUSBVID()
|
||||
return(usb_vid);
|
||||
}
|
||||
|
||||
void NollieController::InitChLEDs(int *led_num_list,int ch_num)
|
||||
unsigned short NollieController::GetNumChannels()
|
||||
{
|
||||
return(nollie_device_list[device_index]->channels);
|
||||
}
|
||||
|
||||
unsigned short NollieController::GetLEDsPerChannel()
|
||||
{
|
||||
return(nollie_device_list[device_index]->leds_per_channel);
|
||||
}
|
||||
|
||||
const int* NollieController::GetChannelIndex()
|
||||
{
|
||||
return(nollie_device_list[device_index]->channel_index);
|
||||
}
|
||||
|
||||
std::string NollieController::GetChannelName(unsigned short channel)
|
||||
{
|
||||
std::string channel_name;
|
||||
|
||||
if(channel > 27 )
|
||||
{
|
||||
channel_name = "Channel EXT " + std::to_string(channel + 1 - 28);
|
||||
}
|
||||
else if(channel > 21 )
|
||||
{
|
||||
channel_name = "Channel GPU " + std::to_string(channel + 1 - 22);
|
||||
}
|
||||
else if(channel > 15 )
|
||||
{
|
||||
channel_name = "Channel ATX " + std::to_string(channel + 1 - 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
channel_name = "Channel " + std::to_string(channel + 1);
|
||||
}
|
||||
|
||||
return(channel_name);
|
||||
}
|
||||
|
||||
void NollieController::InitChLEDs(unsigned int *led_num_list,int ch_num)
|
||||
{
|
||||
unsigned char usb_buf[65];
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
@@ -14,38 +14,9 @@
|
||||
#include <chrono>
|
||||
#include <vector>
|
||||
#include <hidapi.h>
|
||||
#include "NollieDevices.h"
|
||||
#include "RGBController.h"
|
||||
|
||||
#define NOLLIE_12_CH_LED_NUM 42
|
||||
#define NOLLIE_8_CH_LED_NUM 126
|
||||
#define NOLLIE_1_CH_LED_NUM 630
|
||||
#define NOLLIE_HS_CH_LED_NUM 256
|
||||
#define NOLLIE_FS_CH_LED_NUM 525
|
||||
|
||||
#define NOLLIERGBOS_2_VID 0x16D5
|
||||
|
||||
#define NOLLIE32_CHANNELS_NUM 32
|
||||
#define NOLLIE32_PID 0x4714
|
||||
#define NOLLIE32_VID 0x3061
|
||||
|
||||
#define NOLLIE16_CHANNELS_NUM 16
|
||||
#define NOLLIE16_PID 0x4716
|
||||
#define NOLLIE16_VID 0x3061
|
||||
|
||||
#define NOLLIE8_CHANNELS_NUM 8
|
||||
#define NOLLIE8_PID 0x1F01
|
||||
#define NOLLIE8_VID 0x16D2
|
||||
|
||||
#define NOLLIE1_CHANNELS_NUM 1
|
||||
#define NOLLIE1_PID 0x1F11
|
||||
#define NOLLIE1_VID 0x16D2
|
||||
|
||||
#define NOLLIE28_12_CHANNELS_NUM 12
|
||||
#define NOLLIE28_12_VID 0x16D2
|
||||
#define NOLLIE28_12_PID 0x1616
|
||||
#define NOLLIE28_L1_PID 0x1617
|
||||
#define NOLLIE28_L2_PID 0x1618
|
||||
|
||||
#define NOLLIE32_MOS_TRIGGER_CH 26
|
||||
#define NOLLIE32_MOS_TRIGGER_LED 20
|
||||
#define NOLLIE32_FLAG1_CHANNEL 15
|
||||
@@ -59,11 +30,17 @@ public:
|
||||
std::string GetLocationString();
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
|
||||
unsigned short GetUSBVID();
|
||||
unsigned short GetUSBPID();
|
||||
unsigned short GetNumChannels();
|
||||
unsigned short GetLEDsPerChannel();
|
||||
|
||||
const int* GetChannelIndex();
|
||||
std::string GetChannelName(unsigned short channel);
|
||||
|
||||
void SetMos(bool mos);
|
||||
void InitChLEDs(int *led_num_list,int ch_num);
|
||||
void InitChLEDs(unsigned int *led_num_list,int ch_num);
|
||||
void SendUpdate();
|
||||
void SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors);
|
||||
|
||||
@@ -73,6 +50,7 @@ private:
|
||||
std::string name;
|
||||
unsigned short usb_vid;
|
||||
unsigned short usb_pid;
|
||||
unsigned int device_index;
|
||||
|
||||
void SendPacket(unsigned char channel,RGBColor * colors,unsigned int num_colors);
|
||||
void SendPacketFS(unsigned char channel,unsigned char packet_id,RGBColor * colors,unsigned int num_colors);
|
||||
|
||||
@@ -23,11 +23,6 @@ DetectedControllers DetectNollieControllers(hid_device_info* info, const std::st
|
||||
|
||||
if(dev)
|
||||
{
|
||||
wchar_t product[128];
|
||||
hid_get_product_string(dev, product, 128);
|
||||
|
||||
std::wstring product_str(product);
|
||||
|
||||
NollieController* controller = new NollieController(dev, info->path, info->vendor_id, info->product_id, name);
|
||||
RGBController_Nollie* rgb_controller = new RGBController_Nollie(controller);
|
||||
|
||||
|
||||
143
Controllers/NollieController/NollieDevices.cpp
Normal file
143
Controllers/NollieController/NollieDevices.cpp
Normal file
@@ -0,0 +1,143 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| NollieDevices.cpp |
|
||||
| |
|
||||
| Device list for Nollie devices |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 20 Mar 2026 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "NollieDevices.h"
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Channel Index Maps |
|
||||
\*---------------------------------------------------------*/
|
||||
static const int dflt[32] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31};
|
||||
static const int ch32[32] = {5, 4, 3, 2, 1, 0, 15, 14, 26, 27, 28, 29, 30, 31, 8, 9, 19, 18, 17, 16, 7, 6, 25, 24, 23, 22, 21, 20, 13, 12, 11, 10};
|
||||
static const int ch16[32] = {19, 18, 17, 16, 24, 25, 26, 27, 20, 21, 22, 23, 31, 30, 29, 28, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
|
||||
static const int n16[16] = {3, 2, 1, 0, 8, 9, 10, 11, 4, 5, 6, 7, 15, 14, 13, 12};
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Nollie Devices |
|
||||
\*---------------------------------------------------------*/
|
||||
static const nollie_device nollie32 =
|
||||
{
|
||||
NOLLIE32_VID,
|
||||
NOLLIE32_PID,
|
||||
32,
|
||||
NOLLIE_HS_CH_LED_NUM,
|
||||
ch32
|
||||
};
|
||||
|
||||
static const nollie_device nollie16 =
|
||||
{
|
||||
NOLLIE16_VID,
|
||||
NOLLIE16_PID,
|
||||
16,
|
||||
NOLLIE_HS_CH_LED_NUM,
|
||||
ch16
|
||||
};
|
||||
|
||||
static const nollie_device nollie8 =
|
||||
{
|
||||
NOLLIE8_VID,
|
||||
NOLLIE8_PID,
|
||||
8,
|
||||
126,
|
||||
dflt
|
||||
};
|
||||
|
||||
static const nollie_device nollie1 =
|
||||
{
|
||||
NOLLIE1_VID,
|
||||
NOLLIE1_PID,
|
||||
1,
|
||||
630,
|
||||
dflt
|
||||
};
|
||||
|
||||
static const nollie_device nollie28_12 =
|
||||
{
|
||||
NOLLIE28_12_VID,
|
||||
NOLLIE28_12_PID,
|
||||
1,
|
||||
42,
|
||||
dflt
|
||||
};
|
||||
|
||||
static const nollie_device nollie28_l1 =
|
||||
{
|
||||
NOLLIE28_12_VID,
|
||||
NOLLIE28_L1_PID,
|
||||
8,
|
||||
NOLLIE_FS_CH_LED_NUM,
|
||||
dflt
|
||||
};
|
||||
|
||||
static const nollie_device nollie28_l2 =
|
||||
{
|
||||
NOLLIE28_12_VID,
|
||||
NOLLIE28_L2_PID,
|
||||
8,
|
||||
NOLLIE_FS_CH_LED_NUM,
|
||||
dflt
|
||||
};
|
||||
|
||||
static const nollie_device nollie32_os2 =
|
||||
{
|
||||
NOLLIERGBOS_2_VID,
|
||||
NOLLIE32_PID,
|
||||
32,
|
||||
NOLLIE_HS_CH_LED_NUM,
|
||||
ch32
|
||||
};
|
||||
|
||||
static const nollie_device nollie16_os2 =
|
||||
{
|
||||
NOLLIERGBOS_2_VID,
|
||||
NOLLIE16_PID,
|
||||
16,
|
||||
NOLLIE_HS_CH_LED_NUM,
|
||||
n16
|
||||
};
|
||||
|
||||
static const nollie_device nollie8_os2 =
|
||||
{
|
||||
NOLLIERGBOS_2_VID,
|
||||
NOLLIE8_PID,
|
||||
8,
|
||||
126,
|
||||
dflt
|
||||
};
|
||||
|
||||
static const nollie_device nollie1_os2 =
|
||||
{
|
||||
NOLLIERGBOS_2_VID,
|
||||
NOLLIE1_PID,
|
||||
1,
|
||||
630,
|
||||
dflt
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Nollie Device List |
|
||||
\*---------------------------------------------------------*/
|
||||
static const nollie_device* device_list[] =
|
||||
{
|
||||
&nollie32,
|
||||
&nollie16,
|
||||
&nollie8,
|
||||
&nollie1,
|
||||
&nollie28_12,
|
||||
&nollie28_l1,
|
||||
&nollie28_l2,
|
||||
&nollie32_os2,
|
||||
&nollie16_os2,
|
||||
&nollie8_os2,
|
||||
&nollie1_os2,
|
||||
};
|
||||
|
||||
const unsigned int NOLLIE_NUM_DEVICES = (sizeof(device_list) / sizeof(device_list[ 0 ]));
|
||||
const nollie_device** nollie_device_list = device_list;
|
||||
56
Controllers/NollieController/NollieDevices.h
Normal file
56
Controllers/NollieController/NollieDevices.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| NollieDevices.h |
|
||||
| |
|
||||
| Device list for Nollie devices |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 20 Mar 2026 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "NollieController.h"
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Nollie vendor IDs |
|
||||
\*---------------------------------------------------------*/
|
||||
#define NOLLIERGBOS_2_VID 0x16D5
|
||||
#define NOLLIE32_VID 0x3061
|
||||
#define NOLLIE16_VID 0x3061
|
||||
#define NOLLIE8_VID 0x16D2
|
||||
#define NOLLIE1_VID 0x16D2
|
||||
#define NOLLIE28_12_VID 0x16D2
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Nollie product IDs |
|
||||
\*---------------------------------------------------------*/
|
||||
#define NOLLIE32_PID 0x4714
|
||||
#define NOLLIE16_PID 0x4716
|
||||
#define NOLLIE8_PID 0x1F01
|
||||
#define NOLLIE1_PID 0x1F11
|
||||
#define NOLLIE28_12_PID 0x1616
|
||||
#define NOLLIE28_L1_PID 0x1617
|
||||
#define NOLLIE28_L2_PID 0x1618
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Common Nollie LED counts |
|
||||
\*---------------------------------------------------------*/
|
||||
#define NOLLIE_HS_CH_LED_NUM 256
|
||||
#define NOLLIE_FS_CH_LED_NUM 525
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short vid;
|
||||
unsigned short pid;
|
||||
unsigned short channels;
|
||||
unsigned short leds_per_channel;
|
||||
const int* channel_index;
|
||||
} nollie_device;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| These constant values are defined in NollieDevices.cpp |
|
||||
\*---------------------------------------------------------*/
|
||||
extern const unsigned int NOLLIE_NUM_DEVICES;
|
||||
extern const nollie_device** nollie_device_list;
|
||||
@@ -54,95 +54,65 @@ RGBController_Nollie::~RGBController_Nollie()
|
||||
|
||||
void RGBController_Nollie::SetupZones()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
unsigned int channels_num = 0;
|
||||
unsigned int ch_led_num = 0;
|
||||
|
||||
if(zones.size() == 0)
|
||||
{
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-----------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
switch(controller->GetUSBPID())
|
||||
zones.resize(controller->GetNumChannels());
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up zones |
|
||||
\*-----------------------------------------------------*/
|
||||
for(std::size_t channel_idx = 0; channel_idx < zones.size(); channel_idx++)
|
||||
{
|
||||
case NOLLIE32_PID:
|
||||
channels_num = NOLLIE32_CHANNELS_NUM;
|
||||
ch_led_num = NOLLIE_HS_CH_LED_NUM;
|
||||
channel_index = ch32;
|
||||
break;
|
||||
case NOLLIE16_PID:
|
||||
channels_num = NOLLIE16_CHANNELS_NUM;
|
||||
ch_led_num = NOLLIE_HS_CH_LED_NUM;
|
||||
channel_index = ch16;
|
||||
if (controller->GetUSBVID() == NOLLIERGBOS_2_VID)
|
||||
channel_index = n16;
|
||||
break;
|
||||
case NOLLIE28_12_PID:
|
||||
channels_num = NOLLIE28_12_CHANNELS_NUM;
|
||||
ch_led_num = NOLLIE_12_CH_LED_NUM;
|
||||
break;
|
||||
case NOLLIE8_PID:
|
||||
channels_num = NOLLIE8_CHANNELS_NUM;
|
||||
ch_led_num = NOLLIE_8_CH_LED_NUM;
|
||||
break;
|
||||
case NOLLIE1_PID:
|
||||
channels_num = NOLLIE1_CHANNELS_NUM;
|
||||
ch_led_num = NOLLIE_1_CH_LED_NUM;
|
||||
break;
|
||||
default:
|
||||
channels_num = NOLLIE8_CHANNELS_NUM;
|
||||
ch_led_num = NOLLIE_FS_CH_LED_NUM;
|
||||
break;
|
||||
}
|
||||
zones.resize(channels_num);
|
||||
for(unsigned int channel_idx = 0; channel_idx < channels_num; channel_idx++)
|
||||
{
|
||||
if(channel_idx > 27 )
|
||||
{
|
||||
char ch_idx_string[4];
|
||||
snprintf(ch_idx_string, 4, "%d", channel_idx + 1 - 28);
|
||||
zones[channel_idx].name = "Channel EXT ";
|
||||
zones[channel_idx].name.append(ch_idx_string);
|
||||
}
|
||||
else if(channel_idx > 21 )
|
||||
{
|
||||
char ch_idx_string[4];
|
||||
snprintf(ch_idx_string, 4, "%d", channel_idx + 1 - 22);
|
||||
zones[channel_idx].name = "Channel GPU ";
|
||||
zones[channel_idx].name.append(ch_idx_string);
|
||||
}
|
||||
else if(channel_idx > 15 )
|
||||
{
|
||||
char ch_idx_string[4];
|
||||
snprintf(ch_idx_string, 4, "%d", channel_idx + 1 - 16);
|
||||
zones[channel_idx].name = "Channel ATX ";
|
||||
zones[channel_idx].name.append(ch_idx_string);
|
||||
}
|
||||
else
|
||||
{
|
||||
char ch_idx_string[4];
|
||||
snprintf(ch_idx_string, 4, "%d", channel_idx + 1);
|
||||
zones[channel_idx].name = "Channel ";
|
||||
zones[channel_idx].name.append(ch_idx_string);
|
||||
}
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = ch_led_num;
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = controller->GetLEDsPerChannel();
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
zones[channel_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[channel_idx].name = controller->GetChannelName((unsigned char)channel_idx);
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[channel_idx].matrix_map.width = 0;
|
||||
zones[channel_idx].matrix_map.height = 0;
|
||||
zones[channel_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
{
|
||||
char led_idx_string[4];
|
||||
snprintf(led_idx_string, 4, "%d", led_ch_idx + 1);
|
||||
|
||||
led new_led;
|
||||
new_led.name = "LED ";
|
||||
new_led.name.append(led_idx_string);
|
||||
|
||||
new_led.name = zones[channel_idx].name + ", LED " + std::to_string(led_ch_idx);
|
||||
leds.push_back(new_led);
|
||||
leds_channel.push_back(channel_idx);
|
||||
}
|
||||
@@ -151,39 +121,32 @@ void RGBController_Nollie::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_Nollie::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_Nollie::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Set whether MOS is enabled or not |
|
||||
\*-----------------------------------------------------*/
|
||||
if(controller->GetUSBVID() == NOLLIE32_VID && NOLLIE32_PID == controller->GetUSBPID())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
if(zone == NOLLIE32_MOS_TRIGGER_CH && new_size > NOLLIE32_MOS_TRIGGER_LED)
|
||||
/*-------------------------------------------------*\
|
||||
| Set whether MOS is enabled or not |
|
||||
\*-------------------------------------------------*/
|
||||
if(controller->GetUSBVID() == NOLLIE32_VID && NOLLIE32_PID == controller->GetUSBPID())
|
||||
{
|
||||
controller->SetMos(false);
|
||||
if(zone_idx == NOLLIE32_MOS_TRIGGER_CH && zones[zone_idx].leds_count > NOLLIE32_MOS_TRIGGER_LED)
|
||||
{
|
||||
controller->SetMos(false);
|
||||
}
|
||||
else if(zone_idx == NOLLIE32_MOS_TRIGGER_CH)
|
||||
{
|
||||
controller->SetMos(true);
|
||||
}
|
||||
}
|
||||
else if(zone == NOLLIE32_MOS_TRIGGER_CH)
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Nollie1 needs to report the number of LEDs |
|
||||
\*-------------------------------------------------*/
|
||||
if(controller->GetUSBVID() == NOLLIE1_VID && controller->GetUSBPID() == NOLLIE1_PID)
|
||||
{
|
||||
controller->SetMos(true);
|
||||
controller->InitChLEDs(&zones[zone_idx].leds_count, controller->GetNumChannels());
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Nollie1 needs to report the number of LEDs |
|
||||
\*-----------------------------------------------------*/
|
||||
if(controller->GetUSBVID() == NOLLIE1_VID && controller->GetUSBPID() == NOLLIE1_PID)
|
||||
{
|
||||
controller->InitChLEDs(&new_size,NOLLIE1_CHANNELS_NUM);
|
||||
}
|
||||
|
||||
if((size_t) zone >= zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
@@ -194,6 +157,7 @@ void RGBController_Nollie::DeviceUpdateLEDs()
|
||||
unsigned int DevPid = controller->GetUSBPID();
|
||||
if(DevPid == NOLLIE32_PID || DevPid == NOLLIE16_PID)
|
||||
{
|
||||
const int* channel_index = controller->GetChannelIndex();
|
||||
std::vector<int> ChSort;
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
@@ -210,7 +174,7 @@ void RGBController_Nollie::DeviceUpdateLEDs()
|
||||
std::sort(ChSort.begin(), ChSort.end());
|
||||
for(std::size_t i = 0; i < ChSort.size(); i++)
|
||||
{
|
||||
int* ptr = std::find(channel_index, channel_index + 32, ChSort[i]);
|
||||
const int* ptr = std::find(channel_index, channel_index + 32, ChSort[i]);
|
||||
int zone_idx = (int)(ptr - channel_index);
|
||||
controller->SetChannelLEDs(ChSort[i], zones[zone_idx].colors, zones[zone_idx].leds_count);
|
||||
}
|
||||
@@ -231,13 +195,13 @@ void RGBController_Nollie::DeviceUpdateLEDs()
|
||||
|
||||
void RGBController_Nollie::DeviceUpdateZoneLEDs(int zone)
|
||||
{
|
||||
controller->SetChannelLEDs(channel_index[zone], zones[zone].colors, zones[zone].leds_count);
|
||||
controller->SetChannelLEDs(controller->GetChannelIndex()[zone], zones[zone].colors, zones[zone].leds_count);
|
||||
}
|
||||
|
||||
void RGBController_Nollie::DeviceUpdateSingleLED(int led)
|
||||
{
|
||||
unsigned int channel = leds_channel[led];
|
||||
controller->SetChannelLEDs(channel_index[channel], zones[channel].colors, zones[channel].leds_count);
|
||||
controller->SetChannelLEDs(controller->GetChannelIndex()[channel], zones[channel].colors, zones[channel].leds_count);
|
||||
}
|
||||
|
||||
void RGBController_Nollie::DeviceUpdateMode()
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
~RGBController_Nollie();
|
||||
|
||||
void SetupZones();
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
@@ -32,11 +32,4 @@ public:
|
||||
private:
|
||||
NollieController* controller;
|
||||
std::vector<unsigned int> leds_channel;
|
||||
std::vector<unsigned int> zones_channel;
|
||||
|
||||
int* channel_index;
|
||||
|
||||
int ch32[32] = {5, 4, 3, 2, 1, 0, 15, 14, 26, 27, 28, 29, 30, 31, 8, 9, 19, 18, 17, 16, 7, 6, 25, 24, 23, 22, 21, 20, 13, 12, 11, 10};
|
||||
int ch16[32] = {19, 18, 17, 16, 24, 25, 26, 27, 20, 21, 22, 23, 31, 30, 29, 28, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
|
||||
int n16[16] = {3, 2, 1, 0, 8, 9, 10, 11, 4, 5, 6, 7, 15, 14, 13, 12};
|
||||
};
|
||||
|
||||
@@ -132,11 +132,10 @@ RGBController_RazerAddressable::~RGBController_RazerAddressable()
|
||||
void RGBController_RazerAddressable::SetupZones()
|
||||
{
|
||||
unsigned int device_index = controller->GetDeviceIndex();
|
||||
unsigned int zone_count = 0;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
@@ -144,69 +143,86 @@ void RGBController_RazerAddressable::SetupZones()
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Count the number of zones for this device |
|
||||
\*-------------------------------------------------*/
|
||||
for(unsigned int zone_id = 0; zone_id < RAZER_MAX_ZONES; zone_id++)
|
||||
/*-----------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-----------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Count number of zones to resize zones vector |
|
||||
\*-----------------------------------------------------*/
|
||||
unsigned int num_zones;
|
||||
|
||||
for(num_zones = 0; num_zones < RAZER_MAX_ZONES; num_zones++)
|
||||
{
|
||||
if(device_list[device_index]->zones[zone_id] != NULL)
|
||||
if(!device_list[device_index]->zones[num_zones])
|
||||
{
|
||||
zone_count++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(zone_count);
|
||||
zones.resize(num_zones);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Fill in zone information based on device table |
|
||||
\*---------------------------------------------------------*/
|
||||
zone_count = 0;
|
||||
|
||||
for(unsigned int zone_id = 0; zone_id < RAZER_MAX_ZONES; zone_id++)
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up zones |
|
||||
\*-----------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
if(device_list[device_index]->zones[zone_id] != NULL)
|
||||
zones[zone_idx].leds_min = 0;
|
||||
zones[zone_idx].leds_max = device_list[device_index]->zones[zone_idx]->rows * device_list[device_index]->zones[zone_idx]->cols;;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[zone_count].name = device_list[device_index]->zones[zone_id]->name;
|
||||
zones[zone_count].type = device_list[device_index]->zones[zone_id]->type;
|
||||
zones[zone_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
zones[zone_count].leds_min = 0;
|
||||
zones[zone_count].leds_max = device_list[device_index]->zones[zone_id]->rows * device_list[device_index]->zones[zone_id]->cols;
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[zone_idx].name = device_list[device_index]->zones[zone_idx]->name;;
|
||||
}
|
||||
|
||||
if(first_run)
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[zone_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[zone_idx].type = device_list[device_index]->zones[zone_idx]->type;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
if(device_list[device_index]->zones[zone_idx]->type == ZONE_TYPE_MATRIX)
|
||||
{
|
||||
zones[zone_count].leds_count = 0;
|
||||
}
|
||||
zones[zone_idx].matrix_map.height = device_list[device_index]->zones[zone_idx]->rows;
|
||||
zones[zone_idx].matrix_map.width = device_list[device_index]->zones[zone_idx]->cols;
|
||||
zones[zone_idx].matrix_map.map.resize(zones[zone_idx].matrix_map.height * zones[zone_idx].matrix_map.width);
|
||||
|
||||
if(zones[zone_count].type == ZONE_TYPE_MATRIX)
|
||||
{
|
||||
zones[zone_count].matrix_map.height = device_list[device_index]->zones[zone_id]->rows;
|
||||
zones[zone_count].matrix_map.width = device_list[device_index]->zones[zone_id]->cols;
|
||||
zones[zone_count].matrix_map.map.resize(zones[zone_count].matrix_map.height * zones[zone_count].matrix_map.width);
|
||||
|
||||
for(unsigned int y = 0; y < zones[zone_count].matrix_map.height; y++)
|
||||
for(unsigned int y = 0; y < zones[zone_idx].matrix_map.height; y++)
|
||||
{
|
||||
for(unsigned int x = 0; x < zones[zone_count].matrix_map.width; x++)
|
||||
for(unsigned int x = 0; x < zones[zone_idx].matrix_map.width; x++)
|
||||
{
|
||||
zones[zone_count].matrix_map.map[(y * zones[zone_count].matrix_map.width) + x] = (y * zones[zone_count].matrix_map.width) + x;
|
||||
zones[zone_idx].matrix_map.map[(y * zones[zone_idx].matrix_map.width) + x] = (y * zones[zone_idx].matrix_map.width) + x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
zone_count++;
|
||||
else
|
||||
{
|
||||
zones[zone_idx].matrix_map.width = 0;
|
||||
zones[zone_idx].matrix_map.height = 0;
|
||||
zones[zone_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(unsigned int zone_id = 0; zone_id < zones.size(); zone_id++)
|
||||
{
|
||||
for(unsigned int led_id = 0; led_id < zones[zone_id].leds_count; led_id++)
|
||||
for(unsigned int led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = "Channel " + std::to_string(zone_id + 1) + ", LED " + std::to_string(led_id + 1);
|
||||
new_led.name = zones[zone_idx].name + + ", LED " + std::to_string(led_idx + 1);
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
@@ -215,21 +231,10 @@ void RGBController_RazerAddressable::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_RazerAddressable::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_RazerAddressable::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Only the Razer Chroma Addressable RGB Controller supports |
|
||||
| zone resizing |
|
||||
\*---------------------------------------------------------*/
|
||||
if((size_t) zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
controller->SetAddressableZoneSizes(zones[0].leds_count,
|
||||
zones[1].leds_count,
|
||||
zones[2].leds_count,
|
||||
@@ -243,10 +248,6 @@ void RGBController_RazerAddressable::DeviceResizeZone(int zone, int new_size)
|
||||
|
||||
void RGBController_RazerAddressable::DeviceUpdateLEDs()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Only the Razer Chroma Addressable RGB Controller supports |
|
||||
| zone resizing |
|
||||
\*---------------------------------------------------------*/
|
||||
RGBColor colors_buf[80 * 6];
|
||||
|
||||
for(unsigned int zone_id = 0; zone_id < zones.size(); zone_id++)
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -94,9 +94,9 @@ RGBController_SRGBmodsLEDControllerV1::~RGBController_SRGBmodsLEDControllerV1()
|
||||
|
||||
void RGBController_SRGBmodsLEDControllerV1::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
@@ -104,65 +104,73 @@ void RGBController_SRGBmodsLEDControllerV1::SetupZones()
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-----------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(SRGBMODS_LED_CONTROLLER_V1_NUM_CHANNELS);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-------------------------------------------------*/
|
||||
for(unsigned int channel_idx = 0; channel_idx < SRGBMODS_LED_CONTROLLER_V1_NUM_CHANNELS; channel_idx++)
|
||||
/*-----------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-----------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
char ch_idx_string[2];
|
||||
snprintf(ch_idx_string, 2, "%d", channel_idx + 1);
|
||||
|
||||
zones[channel_idx].name = "Channel ";
|
||||
zones[channel_idx].name.append(ch_idx_string);
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| The maximum number of LEDs per channel is 800 |
|
||||
| according to https://srgbmods.net/lcv1/ |
|
||||
\*-------------------------------------------------*/
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = 800;
|
||||
zones[zone_idx].leds_min = 0;
|
||||
zones[zone_idx].leds_max = 800;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
zones[zone_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
char led_idx_string[4];
|
||||
snprintf(led_idx_string, 4, "%d", led_ch_idx + 1);
|
||||
zones[zone_idx].name = "Addressable RGB Header ";
|
||||
zones[zone_idx].name.append(std::to_string(zone_idx + 1));
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[zone_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[zone_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[zone_idx].matrix_map.width = 0;
|
||||
zones[zone_idx].matrix_map.height = 0;
|
||||
zones[zone_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[zone_idx].leds_count; led_ch_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = "LED ";
|
||||
new_led.name.append(led_idx_string);
|
||||
new_led.name = zones[zone_idx].name + ", LED " + std::to_string(led_ch_idx + 1);
|
||||
|
||||
leds.push_back(new_led);
|
||||
leds_channel.push_back(channel_idx);
|
||||
leds_channel.push_back(zone_idx);
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_SRGBmodsLEDControllerV1::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_SRGBmodsLEDControllerV1::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t)zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
~RGBController_SRGBmodsLEDControllerV1();
|
||||
|
||||
void SetupZones();
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -53,9 +53,9 @@ RGBController_SRGBmodsPico::~RGBController_SRGBmodsPico()
|
||||
|
||||
void RGBController_SRGBmodsPico::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
@@ -63,65 +63,73 @@ void RGBController_SRGBmodsPico::SetupZones()
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-----------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(SRGBMODS_PICO_NUM_CHANNELS);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-------------------------------------------------*/
|
||||
for(unsigned int channel_idx = 0; channel_idx < SRGBMODS_PICO_NUM_CHANNELS; channel_idx++)
|
||||
/*-----------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-----------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
char ch_idx_string[2];
|
||||
snprintf(ch_idx_string, 2, "%d", channel_idx + 1);
|
||||
|
||||
zones[channel_idx].name = "Channel ";
|
||||
zones[channel_idx].name.append(ch_idx_string);
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| The maximum number of LEDs per channel is 512 |
|
||||
| according to https://srgbmods.net/picoled/ |
|
||||
\*-------------------------------------------------*/
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = 512;
|
||||
zones[zone_idx].leds_min = 0;
|
||||
zones[zone_idx].leds_max = 512;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
zones[zone_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
char led_idx_string[4];
|
||||
snprintf(led_idx_string, 4, "%d", led_ch_idx + 1);
|
||||
zones[zone_idx].name = "Addressable RGB Header ";
|
||||
zones[zone_idx].name.append(std::to_string(zone_idx + 1));
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[zone_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[zone_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[zone_idx].matrix_map.width = 0;
|
||||
zones[zone_idx].matrix_map.height = 0;
|
||||
zones[zone_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[zone_idx].leds_count; led_ch_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = "LED ";
|
||||
new_led.name.append(led_idx_string);
|
||||
new_led.name = zones[zone_idx].name + ", LED " + std::to_string(led_ch_idx + 1);
|
||||
|
||||
leds.push_back(new_led);
|
||||
leds_channel.push_back(channel_idx);
|
||||
leds_channel.push_back(zone_idx);
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_SRGBmodsPico::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_SRGBmodsPico::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t)zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
~RGBController_SRGBmodsPico();
|
||||
|
||||
void SetupZones();
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -129,9 +129,9 @@ RGBController_ThermaltakeRiing::~RGBController_ThermaltakeRiing()
|
||||
|
||||
void RGBController_ThermaltakeRiing::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
@@ -139,67 +139,73 @@ void RGBController_ThermaltakeRiing::SetupZones()
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-----------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(THERMALTAKE_NUM_CHANNELS);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-------------------------------------------------*/
|
||||
for (unsigned int channel_idx = 0; channel_idx < THERMALTAKE_NUM_CHANNELS; channel_idx++)
|
||||
/*-----------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-----------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
char ch_idx_string[2];
|
||||
snprintf(ch_idx_string, 2, "%d", channel_idx + 1);
|
||||
|
||||
zones[channel_idx].name = "Riing Channel ";
|
||||
zones[channel_idx].name.append(ch_idx_string);
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| The maximum number of colors that would fit in the|
|
||||
| Riing protocol is 20 |
|
||||
\*-------------------------------------------------*/
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = 20;
|
||||
zones[zone_idx].leds_min = 0;
|
||||
zones[zone_idx].leds_max = 20;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
zones[zone_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
for (unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
char led_idx_string[3];
|
||||
snprintf(led_idx_string, 3, "%d", led_ch_idx + 1);
|
||||
zones[zone_idx].name = "Thermaltake Fan Header ";
|
||||
zones[zone_idx].name.append(std::to_string(zone_idx + 1));
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[zone_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[zone_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[zone_idx].matrix_map.width = 0;
|
||||
zones[zone_idx].matrix_map.height = 0;
|
||||
zones[zone_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[zone_idx].leds_count; led_ch_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = "Riing Channel ";
|
||||
new_led.name.append(ch_idx_string);
|
||||
new_led.name.append(", LED ");
|
||||
new_led.name.append(led_idx_string);
|
||||
new_led.name = zones[zone_idx].name + ", LED " + std::to_string(led_ch_idx + 1);
|
||||
|
||||
leds.push_back(new_led);
|
||||
leds_channel.push_back(channel_idx);
|
||||
leds_channel.push_back(zone_idx);
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_ThermaltakeRiing::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_ThermaltakeRiing::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
~RGBController_ThermaltakeRiing();
|
||||
|
||||
void SetupZones();
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -55,9 +55,9 @@ RGBController_ThermaltakeRiingQuad::~RGBController_ThermaltakeRiingQuad()
|
||||
|
||||
void RGBController_ThermaltakeRiingQuad::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
@@ -65,67 +65,73 @@ void RGBController_ThermaltakeRiingQuad::SetupZones()
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-----------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(THERMALTAKE_QUAD_NUM_CHANNELS);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-------------------------------------------------*/
|
||||
for (unsigned int channel_idx = 0; channel_idx < THERMALTAKE_QUAD_NUM_CHANNELS; channel_idx++)
|
||||
/*-----------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-----------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
char ch_idx_string[2];
|
||||
snprintf(ch_idx_string, 2, "%d", channel_idx + 1);
|
||||
|
||||
zones[channel_idx].name = "Riing Channel ";
|
||||
zones[channel_idx].name.append(ch_idx_string);
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| The maximum number of colors that would fit in the|
|
||||
| Riing Quad protocol is 54 |
|
||||
\*-------------------------------------------------*/
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = 60;
|
||||
zones[zone_idx].leds_min = 0;
|
||||
zones[zone_idx].leds_max = 60;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
zones[zone_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
for (unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
char led_idx_string[3];
|
||||
snprintf(led_idx_string, 3, "%d", led_ch_idx + 1);
|
||||
zones[zone_idx].name = "Thermaltake Fan Header ";
|
||||
zones[zone_idx].name.append(std::to_string(zone_idx + 1));
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[zone_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[zone_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[zone_idx].matrix_map.width = 0;
|
||||
zones[zone_idx].matrix_map.height = 0;
|
||||
zones[zone_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[zone_idx].leds_count; led_ch_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = "Riing Channel ";
|
||||
new_led.name.append(ch_idx_string);
|
||||
new_led.name.append(", LED ");
|
||||
new_led.name.append(led_idx_string);
|
||||
new_led.name = zones[zone_idx].name + ", LED " + std::to_string(led_ch_idx + 1);
|
||||
|
||||
leds.push_back(new_led);
|
||||
leds_channel.push_back(channel_idx);
|
||||
leds_channel.push_back(zone_idx);
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_ThermaltakeRiingQuad::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_ThermaltakeRiingQuad::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
~RGBController_ThermaltakeRiingQuad();
|
||||
|
||||
void SetupZones();
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -55,9 +55,9 @@ RGBController_ThermaltakeRiingTrio::~RGBController_ThermaltakeRiingTrio()
|
||||
|
||||
void RGBController_ThermaltakeRiingTrio::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
@@ -65,67 +65,73 @@ void RGBController_ThermaltakeRiingTrio::SetupZones()
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-----------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(THERMALTAKE_TRIO_NUM_CHANNELS);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-------------------------------------------------*/
|
||||
for (unsigned int channel_idx = 0; channel_idx < THERMALTAKE_TRIO_NUM_CHANNELS; channel_idx++)
|
||||
/*-----------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-----------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
char ch_idx_string[2];
|
||||
snprintf(ch_idx_string, 2, "%d", channel_idx + 1);
|
||||
|
||||
zones[channel_idx].name = "Riing Channel ";
|
||||
zones[channel_idx].name.append(ch_idx_string);
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| The maximum number of colors that would fit in the|
|
||||
| Riing Trio protocol is 54 |
|
||||
\*-------------------------------------------------*/
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = 54;
|
||||
zones[zone_idx].leds_min = 0;
|
||||
zones[zone_idx].leds_max = 54;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
zones[zone_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
for (unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
char led_idx_string[3];
|
||||
snprintf(led_idx_string, 3, "%d", led_ch_idx + 1);
|
||||
zones[zone_idx].name = "Thermaltake Fan Header ";
|
||||
zones[zone_idx].name.append(std::to_string(zone_idx + 1));
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[zone_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[zone_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[zone_idx].matrix_map.width = 0;
|
||||
zones[zone_idx].matrix_map.height = 0;
|
||||
zones[zone_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[zone_idx].leds_count; led_ch_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = "Riing Channel ";
|
||||
new_led.name.append(ch_idx_string);
|
||||
new_led.name.append(", LED ");
|
||||
new_led.name.append(led_idx_string);
|
||||
new_led.name = zones[zone_idx].name + ", LED " + std::to_string(led_ch_idx + 1);
|
||||
|
||||
leds.push_back(new_led);
|
||||
leds_channel.push_back(channel_idx);
|
||||
leds_channel.push_back(zone_idx);
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_ThermaltakeRiingTrio::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_ThermaltakeRiingTrio::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
~RGBController_ThermaltakeRiingTrio();
|
||||
|
||||
void SetupZones();
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -236,9 +236,9 @@ void RGBController_ZalmanZSync::SetupModes()
|
||||
|
||||
void RGBController_ZalmanZSync::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
@@ -246,66 +246,69 @@ void RGBController_ZalmanZSync::SetupZones()
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-----------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(ZALMAN_Z_SYNC_NUM_CHANNELS);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-------------------------------------------------*/
|
||||
for (unsigned int channel_idx = 0; channel_idx < ZALMAN_Z_SYNC_NUM_CHANNELS; channel_idx++)
|
||||
/*-----------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-----------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
char ch_idx_string[2];
|
||||
snprintf(ch_idx_string, 2, "%d", channel_idx + 1);
|
||||
|
||||
zones[channel_idx].name = "Channel ";
|
||||
zones[channel_idx].name.append(ch_idx_string);
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| I did some experimenting and determined that the |
|
||||
| maximum number of LEDs the Corsair Commander Pro |
|
||||
| can support is 200. |
|
||||
\*-------------------------------------------------*/
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = 40;
|
||||
zones[zone_idx].leds_min = 0;
|
||||
zones[zone_idx].leds_max = 40;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
zones[zone_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP;
|
||||
}
|
||||
|
||||
for (unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
char led_idx_string[4];
|
||||
snprintf(led_idx_string, 4, "%d", led_ch_idx + 1);
|
||||
zones[zone_idx].name = "Addressable RGB Header ";
|
||||
zones[zone_idx].name.append(std::to_string(zone_idx + 1));
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[zone_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[zone_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[zone_idx].matrix_map.width = 0;
|
||||
zones[zone_idx].matrix_map.height = 0;
|
||||
zones[zone_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[zone_idx].leds_count; led_ch_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = "LED ";
|
||||
new_led.name.append(led_idx_string);
|
||||
new_led.name = zones[zone_idx].name + ", LED " + std::to_string(led_ch_idx + 1);
|
||||
|
||||
leds.push_back(new_led);
|
||||
leds_channel.push_back(channel_idx);
|
||||
leds_channel.push_back(zone_idx);
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_ZalmanZSync::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_ZalmanZSync::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
void SetupModes();
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -72,6 +72,7 @@ The following IDs represent different SDK commands. Each ID packet has a certai
|
||||
| 1000 | [NET_PACKET_ID_RGBCONTROLLER_RESIZEZONE](#net_packet_id_rgbcontroller_resizezone) | RGBController::ResizeZone() | 0 |
|
||||
| 1001 | [NET_PACKET_ID_RGBCONTROLLER_CLEARSEGMENTS](#net_packet_id_rgbcontroller_clearsegments) | RGBController::ClearSegments() | 5 |
|
||||
| 1002 | [NET_PACKET_ID_RGBCONTROLLER_ADDSEGMENT](#net_packet_id_rgbcontroller_addsegment) | RGBController::AddSegment() | 5 |
|
||||
| 1003 | [NET_PACKET_ID_RGBCONTROLLER_CONFIGUREZONE](#net_packet_id_rgbcontroller_configurezone) | RGBController::ConfigureZone() | 6 |
|
||||
| 1050 | [NET_PACKET_ID_RGBCONTROLLER_UPDATELEDS](#net_packet_id_rgbcontroller_updateleds) | RGBController::UpdateLEDs() | 0 |
|
||||
| 1051 | [NET_PACKET_ID_RGBCONTROLLER_UPDATEZONELEDS](#net_packet_id_rgbcontroller_updatezoneleds) | RGBController::UpdateZoneLEDs() | 0 |
|
||||
| 1052 | [NET_PACKET_ID_RGBCONTROLLER_UPDATESINGLELED](#net_packet_id_rgbcontroller_updatesingleled) | RGBController::UpdateSingleLED() | 0 |
|
||||
@@ -436,6 +437,16 @@ The client uses this ID to call the AddSegment() function of an RGBController de
|
||||
| 4 | unsigned int | zone_idx | Zone index to add segment to |
|
||||
| Variable | Segment Data | segment | See [Segment Data](#segment-data) block format table. |
|
||||
|
||||
## NET_PACKET_ID_RGBCONTROLLER_CONFIGUREZONE
|
||||
|
||||
The client uses this ID to call the ConfigureZone() function of an RGBController device. The packet contains a data block. The format of the block is shown below. The `pkt_dev_id` of this request's header indicates which controller you are calling ConfigureZone() on. See the [Device IDs](#device-ids) section for more information.
|
||||
|
||||
| Size | Format | Name | Description |
|
||||
| ---------------- | ---------------------- | ---------------- | --------------------------------------------------------- |
|
||||
| 4 | unsigned int | data_size | Size of all data in packet |
|
||||
| 4 | unsigned int | zone_idx | Zone index to configure |
|
||||
| Variable | Zone Data | zone | See [Zone Data](#zone-data) block format table. |
|
||||
|
||||
## NET_PACKET_ID_RGBCONTROLLER_UPDATELEDS
|
||||
|
||||
### Client Only [Size: Variable]
|
||||
|
||||
@@ -562,6 +562,23 @@ void NetworkClient::SendRequest_RGBController_AddSegment(unsigned int dev_idx, u
|
||||
send_in_progress.unlock();
|
||||
}
|
||||
|
||||
void NetworkClient::SendRequest_RGBController_ConfigureZone(unsigned int dev_idx, unsigned char * data, unsigned int size)
|
||||
{
|
||||
if(change_in_progress)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
NetPacketHeader request_hdr;
|
||||
|
||||
InitNetPacketHeader(&request_hdr, dev_idx, NET_PACKET_ID_RGBCONTROLLER_CONFIGUREZONE, size);
|
||||
|
||||
send_in_progress.lock();
|
||||
send(client_sock, (char *)&request_hdr, sizeof(NetPacketHeader), MSG_NOSIGNAL);
|
||||
send(client_sock, (char *)data, size, 0);
|
||||
send_in_progress.unlock();
|
||||
}
|
||||
|
||||
void NetworkClient::SendRequest_RGBController_ResizeZone(unsigned int dev_idx, int zone, int new_size)
|
||||
{
|
||||
if(change_in_progress)
|
||||
|
||||
@@ -119,6 +119,7 @@ public:
|
||||
|
||||
void SendRequest_RGBController_ClearSegments(unsigned int dev_idx, int zone);
|
||||
void SendRequest_RGBController_AddSegment(unsigned int dev_idx, unsigned char * data, unsigned int size);
|
||||
void SendRequest_RGBController_ConfigureZone(unsigned int dev_idx, unsigned char * data, unsigned int size);
|
||||
void SendRequest_RGBController_ResizeZone(unsigned int dev_idx, int zone, int new_size);
|
||||
|
||||
void SendRequest_RGBController_UpdateLEDs(unsigned int dev_idx, unsigned char * data, unsigned int size);
|
||||
|
||||
@@ -136,6 +136,7 @@ enum
|
||||
NET_PACKET_ID_RGBCONTROLLER_RESIZEZONE = 1000, /* RGBController::ResizeZone() */
|
||||
NET_PACKET_ID_RGBCONTROLLER_CLEARSEGMENTS = 1001, /* RGBController::ClearSegments() */
|
||||
NET_PACKET_ID_RGBCONTROLLER_ADDSEGMENT = 1002, /* RGBController::AddSegment() */
|
||||
NET_PACKET_ID_RGBCONTROLLER_CONFIGUREZONE = 1003, /* RGBController::ConfigureZone() */
|
||||
|
||||
NET_PACKET_ID_RGBCONTROLLER_UPDATELEDS = 1050, /* RGBController::UpdateLEDs() */
|
||||
NET_PACKET_ID_RGBCONTROLLER_UPDATEZONELEDS = 1051, /* RGBController::UpdateZoneLEDs() */
|
||||
|
||||
@@ -1412,6 +1412,25 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
||||
goto listen_done;
|
||||
}
|
||||
break;
|
||||
|
||||
case NET_PACKET_ID_RGBCONTROLLER_CONFIGUREZONE:
|
||||
/*-----------------------------------------*\
|
||||
| Verify the packet size in the packet data |
|
||||
| (first 4 bytes of data) matches the |
|
||||
| packet size in the header |
|
||||
\*-----------------------------------------*/
|
||||
if((data != NULL)
|
||||
&& (header.pkt_size >= sizeof(unsigned int))
|
||||
&& (header.pkt_size == *((unsigned int*)data)))
|
||||
{
|
||||
ProcessRequest_RGBController_ConfigureZone(header.pkt_dev_id, (unsigned char *)data, client_info->client_protocol_version);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("[%s] ConfigureZone packet has invalid size. Packet size: %d", header.pkt_size, NETWORKSERVER);
|
||||
goto listen_done;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(delete_data)
|
||||
@@ -1727,6 +1746,49 @@ void NetworkServer::ProcessRequest_RGBController_ClearSegments(unsigned int cont
|
||||
profile_manager->SaveSizes();
|
||||
}
|
||||
|
||||
void NetworkServer::ProcessRequest_RGBController_ConfigureZone(unsigned int controller_id, unsigned char * data_ptr, unsigned int protocol_version)
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Convert ID to index |
|
||||
\*-----------------------------------------------------*/
|
||||
bool idx_valid;
|
||||
unsigned int controller_idx = index_from_id(controller_id, protocol_version, &idx_valid);
|
||||
int zone_idx;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| If controller ID is invalid, return |
|
||||
\*-----------------------------------------------------*/
|
||||
if(!idx_valid)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Skip data size |
|
||||
\*-----------------------------------------------------*/
|
||||
data_ptr += sizeof(unsigned int);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Copy in zone index |
|
||||
\*-----------------------------------------------------*/
|
||||
memcpy(&zone_idx, data_ptr, sizeof(zone_idx));
|
||||
data_ptr += sizeof(zone_idx);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Configure zone |
|
||||
\*-----------------------------------------------------*/
|
||||
zone new_zone;
|
||||
|
||||
data_ptr = controllers[controller_idx]->SetZoneDescription(data_ptr, &new_zone, protocol_version);
|
||||
|
||||
controllers[controller_idx]->ConfigureZone(zone_idx, new_zone);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Save sizes |
|
||||
\*-----------------------------------------------------*/
|
||||
profile_manager->SaveSizes();
|
||||
}
|
||||
|
||||
void NetworkServer::ProcessRequest_RGBController_ResizeZone(unsigned int controller_id, unsigned char * data_ptr, unsigned int protocol_version)
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
|
||||
@@ -239,6 +239,7 @@ private:
|
||||
|
||||
void ProcessRequest_RGBController_AddSegment(unsigned int controller_id, unsigned char * data_ptr, unsigned int protocol_version);
|
||||
void ProcessRequest_RGBController_ClearSegments(unsigned int controller_id, unsigned char * data_ptr, unsigned int protocol_version);
|
||||
void ProcessRequest_RGBController_ConfigureZone(unsigned int controller_id, unsigned char * data_ptr, unsigned int protocol_version);
|
||||
void ProcessRequest_RGBController_ResizeZone(unsigned int controller_id, unsigned char * data_ptr, unsigned int protocol_version);
|
||||
void ProcessRequest_RGBController_SetCustomMode(unsigned int controller_id, unsigned int protocol_version);
|
||||
void ProcessRequest_RGBController_UpdateLEDs(unsigned int controller_id, unsigned char * data_ptr, unsigned int protocol_version);
|
||||
|
||||
@@ -213,11 +213,32 @@ bool ProfileManager::CompareControllers(RGBController* controller_1, RGBControll
|
||||
{
|
||||
for(std::size_t zone_index = 0; zone_index < controller_1->zones.size(); zone_index++)
|
||||
{
|
||||
if((controller_1->GetZoneName(zone_index) != controller_2->GetZoneName(zone_index) )
|
||||
|| (controller_1->GetZoneType(zone_index) != controller_2->GetZoneType(zone_index) )
|
||||
|| (controller_1->GetZoneLEDsMin(zone_index) != controller_2->GetZoneLEDsMin(zone_index) )
|
||||
|| (controller_1->GetZoneLEDsMax(zone_index) != controller_2->GetZoneLEDsMax(zone_index) )
|
||||
|| (controller_1->GetZoneModeCount(zone_index) != controller_2->GetZoneModeCount(zone_index)))
|
||||
bool check_zone_name = true;
|
||||
bool check_zone_type = true;
|
||||
|
||||
/*---------------------------------------------*\
|
||||
| Do not check zone name if manually configured |
|
||||
\*---------------------------------------------*/
|
||||
if((controller_1->GetZoneFlags(zone_index) & ZONE_FLAG_MANUALLY_CONFIGURED_NAME)
|
||||
|| (controller_2->GetZoneFlags(zone_index) & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
check_zone_name = false;
|
||||
}
|
||||
|
||||
/*---------------------------------------------*\
|
||||
| Do not check zone type if manually configured |
|
||||
\*---------------------------------------------*/
|
||||
if((controller_1->GetZoneFlags(zone_index) & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE)
|
||||
|| (controller_2->GetZoneFlags(zone_index) & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
check_zone_type = false;
|
||||
}
|
||||
|
||||
if((check_zone_name && (controller_1->GetZoneName(zone_index) != controller_2->GetZoneName(zone_index) ))
|
||||
|| (check_zone_type && (controller_1->GetZoneType(zone_index) != controller_2->GetZoneType(zone_index) ))
|
||||
|| (controller_1->GetZoneLEDsMin(zone_index) != controller_2->GetZoneLEDsMin(zone_index) )
|
||||
|| (controller_1->GetZoneLEDsMax(zone_index) != controller_2->GetZoneLEDsMax(zone_index) )
|
||||
|| (controller_1->GetZoneModeCount(zone_index) != controller_2->GetZoneModeCount(zone_index)))
|
||||
{
|
||||
return(false);
|
||||
}
|
||||
@@ -828,7 +849,7 @@ bool ProfileManager::SaveSizes()
|
||||
|
||||
for(std::size_t zone_index = 0; zone_index < controllers[controller_index]->GetZoneCount(); zone_index++)
|
||||
{
|
||||
if(controllers[controller_index]->GetZoneFlags(zone_index) & ZONE_FLAG_MANUALLY_CONFIGURED)
|
||||
if(controllers[controller_index]->GetZoneFlags(zone_index) & ZONE_FLAGS_MANUALLY_CONFIGURED)
|
||||
{
|
||||
/*---------------------------------------------*\
|
||||
| Read the controller data for this controller |
|
||||
@@ -1100,17 +1121,37 @@ bool ProfileManager::LoadControllerFromListWithOptions
|
||||
{
|
||||
for(std::size_t zone_idx = 0; zone_idx < profile_controller->zones.size(); zone_idx++)
|
||||
{
|
||||
if((profile_controller->GetZoneName(zone_idx) == load_controller->GetZoneName(zone_idx) )
|
||||
&&(profile_controller->GetZoneType(zone_idx) == load_controller->GetZoneType(zone_idx) )
|
||||
&&(profile_controller->GetZoneLEDsMin(zone_idx) == load_controller->GetZoneLEDsMin(zone_idx) )
|
||||
&&(profile_controller->GetZoneLEDsMax(zone_idx) == load_controller->GetZoneLEDsMax(zone_idx) ))
|
||||
{
|
||||
if(profile_controller->GetZoneLEDsCount(zone_idx) != load_controller->GetZoneLEDsCount(zone_idx))
|
||||
{
|
||||
load_controller->ResizeZone((int)zone_idx, profile_controller->zones[zone_idx].leds_count);
|
||||
}
|
||||
bool check_zone_name = true;
|
||||
bool check_zone_type = true;
|
||||
|
||||
if(profile_controller->zones[zone_idx].segments.size() != load_controller->zones[zone_idx].segments.size())
|
||||
/*---------------------------------*\
|
||||
| Do not check zone name if |
|
||||
| manually configured |
|
||||
\*---------------------------------*/
|
||||
if((profile_controller->GetZoneFlags(zone_idx) & ZONE_FLAG_MANUALLY_CONFIGURED_NAME)
|
||||
|| (load_controller->GetZoneFlags(zone_idx) & ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME))
|
||||
{
|
||||
check_zone_name = false;
|
||||
}
|
||||
|
||||
/*---------------------------------*\
|
||||
| Do not check zone type if |
|
||||
| manually configured |
|
||||
\*---------------------------------*/
|
||||
if((profile_controller->GetZoneFlags(zone_idx) & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE)
|
||||
|| (load_controller->GetZoneFlags(zone_idx) & ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE))
|
||||
{
|
||||
check_zone_type = false;
|
||||
}
|
||||
|
||||
if((!check_zone_name || (profile_controller->GetZoneName(zone_idx) == load_controller->GetZoneName(zone_idx) ))
|
||||
&& (!check_zone_type || (profile_controller->GetZoneType(zone_idx) == load_controller->GetZoneType(zone_idx) ))
|
||||
&& (profile_controller->GetZoneLEDsMin(zone_idx) == load_controller->GetZoneLEDsMin(zone_idx) )
|
||||
&& (profile_controller->GetZoneLEDsMax(zone_idx) == load_controller->GetZoneLEDsMax(zone_idx) ))
|
||||
{
|
||||
load_controller->ConfigureZone(zone_idx, profile_controller->zones[zone_idx]);
|
||||
|
||||
if(profile_controller->GetZoneFlags(zone_idx) & ZONE_FLAG_MANUALLY_CONFIGURED_SEGMENTS)
|
||||
{
|
||||
load_controller->zones[zone_idx].segments.clear();
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ segment::segment()
|
||||
type = 0;
|
||||
start_idx = 0;
|
||||
leds_count = 0;
|
||||
flags = 0;
|
||||
}
|
||||
|
||||
segment::~segment()
|
||||
@@ -229,6 +230,20 @@ void RGBController::SetHidden(bool hidden)
|
||||
/*---------------------------------------------------------*\
|
||||
| Zone Functions |
|
||||
\*---------------------------------------------------------*/
|
||||
zone RGBController::GetZone(unsigned int zone_idx)
|
||||
{
|
||||
zone zone_copy;
|
||||
|
||||
AccessMutex.lock_shared();
|
||||
if(zone_idx < zones.size())
|
||||
{
|
||||
zone_copy = zones[zone_idx];
|
||||
}
|
||||
AccessMutex.unlock_shared();
|
||||
|
||||
return(zone_copy);
|
||||
}
|
||||
|
||||
int RGBController::GetZoneActiveMode(unsigned int zone)
|
||||
{
|
||||
int active_mode;
|
||||
@@ -1797,7 +1812,7 @@ void RGBController::ClearSegments(int zone)
|
||||
zones[zone].segments.clear();
|
||||
AccessMutex.unlock();
|
||||
|
||||
zones[zone].flags |= ZONE_FLAG_MANUALLY_CONFIGURED;
|
||||
zones[zone].flags &= ~ZONE_FLAG_MANUALLY_CONFIGURED_SEGMENTS;
|
||||
|
||||
SignalUpdate(RGBCONTROLLER_UPDATE_REASON_CLEARSEGMENTS);
|
||||
}
|
||||
@@ -1808,18 +1823,83 @@ void RGBController::AddSegment(int zone, segment new_segment)
|
||||
zones[zone].segments.push_back(new_segment);
|
||||
AccessMutex.unlock();
|
||||
|
||||
zones[zone].flags |= ZONE_FLAG_MANUALLY_CONFIGURED;
|
||||
zones[zone].flags |= ZONE_FLAG_MANUALLY_CONFIGURED_SEGMENTS;
|
||||
|
||||
SignalUpdate(RGBCONTROLLER_UPDATE_REASON_ADDSEGMENT);
|
||||
}
|
||||
|
||||
void RGBController::ResizeZone(int zone, int new_size)
|
||||
void RGBController::ConfigureZone(int zone_idx, zone new_zone)
|
||||
{
|
||||
AccessMutex.lock();
|
||||
DeviceResizeZone(zone, new_size);
|
||||
|
||||
if(new_zone.flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE)
|
||||
{
|
||||
zones[zone_idx].flags |= ZONE_FLAG_MANUALLY_CONFIGURED_SIZE;
|
||||
zones[zone_idx].leds_count = new_zone.leds_count;
|
||||
}
|
||||
else
|
||||
{
|
||||
zones[zone_idx].flags &= ~ZONE_FLAG_MANUALLY_CONFIGURED_SIZE;
|
||||
new_zone.leds_count = 0;
|
||||
}
|
||||
|
||||
if(new_zone.flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME)
|
||||
{
|
||||
zones[zone_idx].flags |= ZONE_FLAG_MANUALLY_CONFIGURED_NAME;
|
||||
zones[zone_idx].name = new_zone.name;
|
||||
}
|
||||
else
|
||||
{
|
||||
zones[zone_idx].flags &= ~ZONE_FLAG_MANUALLY_CONFIGURED_NAME;
|
||||
}
|
||||
|
||||
if(new_zone.flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE)
|
||||
{
|
||||
zones[zone_idx].flags |= ZONE_FLAG_MANUALLY_CONFIGURED_TYPE;
|
||||
zones[zone_idx].type = new_zone.type;
|
||||
}
|
||||
else
|
||||
{
|
||||
zones[zone_idx].flags &= ~ZONE_FLAG_MANUALLY_CONFIGURED_TYPE;
|
||||
}
|
||||
|
||||
if(new_zone.flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP)
|
||||
{
|
||||
zones[zone_idx].flags |= ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP;
|
||||
zones[zone_idx].matrix_map = new_zone.matrix_map;
|
||||
}
|
||||
else
|
||||
{
|
||||
zones[zone_idx].flags &= ~ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP;
|
||||
}
|
||||
|
||||
if(new_zone.flags & ZONE_FLAG_MANUALLY_CONFIGURED_COLOR_ORDER)
|
||||
{
|
||||
zones[zone_idx].flags |= ZONE_FLAG_MANUALLY_CONFIGURED_COLOR_ORDER;
|
||||
zones[zone_idx].color_order = new_zone.color_order;
|
||||
}
|
||||
else
|
||||
{
|
||||
zones[zone_idx].flags &= ~ZONE_FLAG_MANUALLY_CONFIGURED_COLOR_ORDER;
|
||||
}
|
||||
|
||||
DeviceConfigureZone(zone_idx);
|
||||
|
||||
AccessMutex.unlock();
|
||||
|
||||
zones[zone].flags |= ZONE_FLAG_MANUALLY_CONFIGURED;
|
||||
SignalUpdate(RGBCONTROLLER_UPDATE_REASON_RESIZEZONE);
|
||||
}
|
||||
|
||||
void RGBController::ResizeZone(int zone_idx, int new_size)
|
||||
{
|
||||
zone new_zone = zones[zone_idx];
|
||||
|
||||
new_zone.leds_count = new_size;
|
||||
new_zone.flags |= ZONE_FLAG_MANUALLY_CONFIGURED_SIZE;
|
||||
|
||||
AccessMutex.lock();
|
||||
ConfigureZone(zone_idx, new_zone);
|
||||
AccessMutex.unlock();
|
||||
|
||||
SignalUpdate(RGBCONTROLLER_UPDATE_REASON_RESIZEZONE);
|
||||
}
|
||||
@@ -1833,7 +1913,7 @@ unsigned int RGBController::LEDsInZone(unsigned int zone)
|
||||
|
||||
leds_count = zones[zone].leds_count;
|
||||
|
||||
if(zones[zone].flags & ZONE_FLAG_RESIZE_EFFECTS_ONLY)
|
||||
if(zones[zone].flags & ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE_EFFECTS_ONLY)
|
||||
{
|
||||
if(leds_count > 1)
|
||||
{
|
||||
@@ -1905,7 +1985,7 @@ void RGBController::UpdateLEDsInternal()
|
||||
/*---------------------------------------------------------*\
|
||||
| Functions to be implemented in device implementation |
|
||||
\*---------------------------------------------------------*/
|
||||
void RGBController::DeviceResizeZone(int /*zone*/, int /*new_size*/)
|
||||
void RGBController::DeviceConfigureZone(int /*zone_idx*/)
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| If not implemented by controller, does nothing |
|
||||
@@ -2535,7 +2615,7 @@ unsigned char * RGBController::GetSegmentDescriptionData(unsigned char* data_ptr
|
||||
data_ptr += sizeof(segment.leds_count);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Segment matrix map data |
|
||||
| Segment matrix map data and segment flags |
|
||||
\*-----------------------------------------------------*/
|
||||
if(protocol_version >= 6)
|
||||
{
|
||||
@@ -2545,6 +2625,9 @@ unsigned char * RGBController::GetSegmentDescriptionData(unsigned char* data_ptr
|
||||
data_ptr += sizeof(matrix_map_size);
|
||||
|
||||
data_ptr = GetMatrixMapDescriptionData(data_ptr, segment.matrix_map, protocol_version);
|
||||
|
||||
memcpy(data_ptr, &segment.flags, sizeof(segment.flags));
|
||||
data_ptr += sizeof(segment.flags);
|
||||
}
|
||||
|
||||
return(data_ptr);
|
||||
@@ -2568,12 +2651,13 @@ unsigned int RGBController::GetSegmentDescriptionSize(segment segment, unsigned
|
||||
data_size += sizeof(segment.leds_count);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Matrix map size |
|
||||
| Matrix map size and segment flags size |
|
||||
\*-----------------------------------------------------*/
|
||||
if(protocol_version >= 6)
|
||||
{
|
||||
data_size += sizeof(unsigned short);
|
||||
data_size += GetMatrixMapDescriptionSize(segment.matrix_map, protocol_version);
|
||||
data_size += sizeof(segment.flags);
|
||||
}
|
||||
|
||||
return(data_size);
|
||||
@@ -2607,7 +2691,7 @@ unsigned char * RGBController::GetZoneDescriptionData(unsigned char* data_ptr, z
|
||||
| overwrite the leds_min/max/count parameters to 1 so |
|
||||
| that the zone appears a fixed size to older clients. |
|
||||
\*-----------------------------------------------------*/
|
||||
if((zone.flags & ZONE_FLAG_RESIZE_EFFECTS_ONLY) && (protocol_version < 5))
|
||||
if((zone.flags & ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE_EFFECTS_ONLY) && (protocol_version < 5))
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Create a temporary variable to hold the fixed |
|
||||
@@ -2718,6 +2802,12 @@ unsigned char * RGBController::GetZoneDescriptionData(unsigned char* data_ptr, z
|
||||
{
|
||||
data_ptr = GetModeDescriptionData(data_ptr, zone.modes[mode_index], protocol_version);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Copy in color order |
|
||||
\*-------------------------------------------------*/
|
||||
memcpy(data_ptr, &zone.color_order, sizeof(zone.color_order));
|
||||
data_ptr += sizeof(zone.color_order);
|
||||
}
|
||||
|
||||
return(data_ptr);
|
||||
@@ -2782,6 +2872,8 @@ unsigned int RGBController::GetZoneDescriptionSize(zone zone, unsigned int proto
|
||||
{
|
||||
data_size += GetModeDescriptionSize(zone.modes[mode_index], protocol_version);
|
||||
}
|
||||
|
||||
data_size += sizeof(zone.color_order);
|
||||
}
|
||||
|
||||
return(data_size);
|
||||
@@ -3200,6 +3292,12 @@ unsigned char* RGBController::SetSegmentDescription(unsigned char* data_ptr, seg
|
||||
{
|
||||
data_ptr = SetMatrixMapDescription(data_ptr, &segment->matrix_map, protocol_version);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Copy in segment flags |
|
||||
\*-------------------------------------------------*/
|
||||
memcpy(&segment->flags, data_ptr, sizeof(segment->flags));
|
||||
data_ptr += sizeof(segment->flags);
|
||||
}
|
||||
|
||||
return(data_ptr);
|
||||
@@ -3342,6 +3440,12 @@ unsigned char* RGBController::SetZoneDescription(unsigned char* data_ptr, zone*
|
||||
{
|
||||
data_ptr = SetModeDescription(data_ptr, &zone->modes[mode_index], protocol_version);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Copy in color order |
|
||||
\*-------------------------------------------------*/
|
||||
memcpy(&zone->color_order, data_ptr, sizeof(zone->color_order));
|
||||
data_ptr += sizeof(zone->color_order);
|
||||
}
|
||||
|
||||
return(data_ptr);
|
||||
@@ -3497,6 +3601,7 @@ nlohmann::json RGBController::GetSegmentDescriptionJSON(segment segment)
|
||||
segment_json["start_idx"] = segment.start_idx;
|
||||
segment_json["leds_count"] = segment.leds_count;
|
||||
segment_json["matrix_map"] = GetMatrixMapDescriptionJSON(segment.matrix_map);
|
||||
segment_json["flags"] = segment.flags;
|
||||
|
||||
return(segment_json);
|
||||
}
|
||||
@@ -3532,6 +3637,8 @@ nlohmann::json RGBController::GetZoneDescriptionJSON(zone zone)
|
||||
zone_json["active_mode"] = zone.active_mode;
|
||||
}
|
||||
|
||||
zone_json["color_order"] = zone.color_order;
|
||||
|
||||
return(zone_json);
|
||||
}
|
||||
|
||||
@@ -3831,6 +3938,11 @@ segment RGBController::SetSegmentDescriptionJSON(nlohmann::json segment_json)
|
||||
new_segment.matrix_map = SetMatrixMapDescriptionJSON(segment_json["matrix_map"]);
|
||||
}
|
||||
|
||||
if(segment_json.contains("flags"))
|
||||
{
|
||||
new_segment.flags = segment_json["flags"];
|
||||
}
|
||||
|
||||
return(new_segment);
|
||||
}
|
||||
|
||||
@@ -3901,6 +4013,11 @@ zone RGBController::SetZoneDescriptionJSON(nlohmann::json zone_json)
|
||||
new_zone.active_mode = zone_json["active_mode"];
|
||||
}
|
||||
|
||||
if(zone_json.contains("color_order"))
|
||||
{
|
||||
new_zone.color_order = zone_json["color_order"];
|
||||
}
|
||||
|
||||
return(new_zone);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user