Add matrix map support
This commit is contained in:
parent
54ab57cea6
commit
105f5642ef
35 changed files with 212 additions and 42 deletions
|
|
@ -1,23 +1,6 @@
|
|||
#include "RGBController.h"
|
||||
#include <cstring>
|
||||
|
||||
//Include thread libraries for Windows or Linux
|
||||
#ifdef WIN32
|
||||
#include <process.h>
|
||||
#else
|
||||
#include "pthread.h"
|
||||
#include "unistd.h"
|
||||
#endif
|
||||
|
||||
//Thread functions have different types in Windows and Linux
|
||||
#ifdef WIN32
|
||||
#define THREAD static void
|
||||
#define THREADRETURN
|
||||
#else
|
||||
#define THREAD static void*
|
||||
#define THREADRETURN return(NULL);
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Windows.h>
|
||||
#else
|
||||
|
|
@ -29,25 +12,16 @@ static void Sleep(unsigned int milliseconds)
|
|||
}
|
||||
#endif
|
||||
|
||||
THREAD devicecallthread_thread(void *param)
|
||||
{
|
||||
RGBController* controller = static_cast<RGBController*>(param);
|
||||
controller->DeviceCallThread();
|
||||
THREADRETURN
|
||||
}
|
||||
|
||||
RGBController::RGBController()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| The RGBController class starts a thread to handle |
|
||||
| asynchronous device updating |
|
||||
\*-----------------------------------------------------*/
|
||||
#ifdef WIN32
|
||||
_beginthread(keepalive_thread, 0, this);
|
||||
#else
|
||||
pthread_t thread;
|
||||
pthread_create(&thread, NULL, &devicecallthread_thread, this);
|
||||
#endif
|
||||
DeviceThreadRunning = true;
|
||||
DeviceCallThread = new std::thread(&RGBController::DeviceCallThreadFunction, this);
|
||||
}
|
||||
|
||||
RGBController::~RGBController()
|
||||
{
|
||||
DeviceThreadRunning = false;
|
||||
DeviceCallThread->join();
|
||||
}
|
||||
|
||||
unsigned char * RGBController::GetDeviceDescription()
|
||||
|
|
@ -72,6 +46,7 @@ unsigned char * RGBController::GetDeviceDescription()
|
|||
unsigned short *zone_name_len = new unsigned short[num_zones];
|
||||
unsigned short *led_name_len = new unsigned short[num_leds];
|
||||
|
||||
unsigned short *zone_matrix_len = new unsigned short[num_zones];
|
||||
unsigned short *mode_num_colors = new unsigned short[num_modes];
|
||||
|
||||
data_size += sizeof(data_size);
|
||||
|
|
@ -115,6 +90,18 @@ unsigned char * RGBController::GetDeviceDescription()
|
|||
data_size += sizeof(zones[zone_index].leds_min);
|
||||
data_size += sizeof(zones[zone_index].leds_max);
|
||||
data_size += sizeof(zones[zone_index].leds_count);
|
||||
|
||||
if(zones[zone_index].matrix_map == NULL)
|
||||
{
|
||||
zone_matrix_len[zone_index] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
zone_matrix_len[zone_index] = (2 * sizeof(unsigned int)) + (zones[zone_index].matrix_map->height * zones[zone_index].matrix_map->width * sizeof(unsigned int));
|
||||
}
|
||||
|
||||
data_size += sizeof(zone_matrix_len[zone_index]);
|
||||
data_size += zone_matrix_len[zone_index];
|
||||
}
|
||||
|
||||
data_size += sizeof(num_leds);
|
||||
|
|
@ -335,6 +322,39 @@ unsigned char * RGBController::GetDeviceDescription()
|
|||
\*---------------------------------------------------------*/
|
||||
memcpy(&data_buf[data_ptr], &zones[zone_index].leds_count, sizeof(zones[zone_index].leds_count));
|
||||
data_ptr += sizeof(zones[zone_index].leds_count);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Copy in size of zone matrix |
|
||||
\*---------------------------------------------------------*/
|
||||
memcpy(&data_buf[data_ptr], &zone_matrix_len[zone_index], sizeof(zone_matrix_len[zone_index]));
|
||||
data_ptr += sizeof(zone_matrix_len[zone_index]);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Copy in matrix data if size is nonzero |
|
||||
\*---------------------------------------------------------*/
|
||||
if(zone_matrix_len[zone_index] > 0)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Copy in matrix height |
|
||||
\*---------------------------------------------------------*/
|
||||
memcpy(&data_buf[data_ptr], &zones[zone_index].matrix_map->height, sizeof(zones[zone_index].matrix_map->height));
|
||||
data_ptr += sizeof(zones[zone_index].matrix_map->height);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Copy in matrix width |
|
||||
\*---------------------------------------------------------*/
|
||||
memcpy(&data_buf[data_ptr], &zones[zone_index].matrix_map->width, sizeof(zones[zone_index].matrix_map->width));
|
||||
data_ptr += sizeof(zones[zone_index].matrix_map->width);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Copy in matrix map |
|
||||
\*---------------------------------------------------------*/
|
||||
for(int matrix_idx = 0; matrix_idx < (zones[zone_index].matrix_map->height * zones[zone_index].matrix_map->width); matrix_idx++)
|
||||
{
|
||||
memcpy(&data_buf[data_ptr], &zones[zone_index].matrix_map->map[matrix_idx], sizeof(zones[zone_index].matrix_map->map[matrix_idx]));
|
||||
data_ptr += sizeof(zones[zone_index].matrix_map->map[matrix_idx]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
|
|
@ -383,11 +403,11 @@ unsigned char * RGBController::GetDeviceDescription()
|
|||
data_ptr += sizeof(colors[color_index]);
|
||||
}
|
||||
|
||||
|
||||
delete[] mode_name_len;
|
||||
delete[] zone_name_len;
|
||||
delete[] led_name_len;
|
||||
|
||||
delete[] zone_matrix_len;
|
||||
delete[] mode_num_colors;
|
||||
|
||||
return(data_buf);
|
||||
|
|
@ -612,6 +632,54 @@ void RGBController::ReadDeviceDescription(unsigned char* data_buf)
|
|||
memcpy(&new_zone.leds_count, &data_buf[data_ptr], sizeof(new_zone.leds_count));
|
||||
data_ptr += sizeof(new_zone.leds_count);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Copy in size of zone matrix |
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned short zone_matrix_len;
|
||||
memcpy(&zone_matrix_len, &data_buf[data_ptr], sizeof(zone_matrix_len));
|
||||
data_ptr += sizeof(zone_matrix_len);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Copy in matrix data if size is nonzero |
|
||||
\*---------------------------------------------------------*/
|
||||
if(zone_matrix_len > 0)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Create a map data structure to fill in and attach it to |
|
||||
| the new zone |
|
||||
\*---------------------------------------------------------*/
|
||||
matrix_map_type * new_map = new matrix_map_type;
|
||||
|
||||
new_zone.matrix_map = new_map;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Copy in matrix height |
|
||||
\*---------------------------------------------------------*/
|
||||
memcpy(&new_map->height, &data_buf[data_ptr], sizeof(new_map->height));
|
||||
data_ptr += sizeof(new_map->height);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Copy in matrix width |
|
||||
\*---------------------------------------------------------*/
|
||||
memcpy(&new_map->width, &data_buf[data_ptr], sizeof(new_map->width));
|
||||
data_ptr += sizeof(new_map->width);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Copy in matrix map |
|
||||
\*---------------------------------------------------------*/
|
||||
new_map->map = new unsigned int[new_map->height * new_map->width];
|
||||
|
||||
for(int matrix_idx = 0; matrix_idx < (new_map->height * new_map->width); matrix_idx++)
|
||||
{
|
||||
memcpy(&new_map->map[matrix_idx], &data_buf[data_ptr], sizeof(new_map->map[matrix_idx]));
|
||||
data_ptr += sizeof(new_map->map[matrix_idx]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
new_zone.matrix_map = NULL;
|
||||
}
|
||||
|
||||
zones.push_back(new_zone);
|
||||
}
|
||||
|
||||
|
|
@ -1238,12 +1306,13 @@ void RGBController::DeviceUpdateLEDs()
|
|||
|
||||
}
|
||||
|
||||
void RGBController::DeviceCallThread()
|
||||
void RGBController::DeviceCallThreadFunction()
|
||||
{
|
||||
CallFlag_UpdateLEDs = false;
|
||||
while(1)
|
||||
|
||||
while(DeviceThreadRunning.load() == true)
|
||||
{
|
||||
if(CallFlag_UpdateLEDs)
|
||||
if(CallFlag_UpdateLEDs.load() == true)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
CallFlag_UpdateLEDs = false;
|
||||
|
|
|
|||
|
|
@ -9,8 +9,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
typedef unsigned int RGBColor;
|
||||
|
||||
|
|
@ -115,6 +117,13 @@ enum
|
|||
|
||||
std::string device_type_to_str(device_type type);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int height;
|
||||
unsigned int width;
|
||||
unsigned int * map;
|
||||
} matrix_map_type;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
std::string name; /* Zone name */
|
||||
|
|
@ -125,6 +134,7 @@ typedef struct
|
|||
unsigned int leds_count; /* Number of LEDs in zone */
|
||||
unsigned int leds_min; /* Minimum number of LEDs */
|
||||
unsigned int leds_max; /* Maximum number of LEDs */
|
||||
matrix_map_type * matrix_map; /* Matrix map pointer */
|
||||
} zone;
|
||||
|
||||
class RGBController
|
||||
|
|
@ -146,6 +156,7 @@ public:
|
|||
| RGBController base class constructor |
|
||||
\*---------------------------------------------------------*/
|
||||
RGBController();
|
||||
~RGBController();
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Generic functions implemented in RGBController.cpp |
|
||||
|
|
@ -181,7 +192,7 @@ public:
|
|||
|
||||
//void UpdateMode();
|
||||
|
||||
void DeviceCallThread();
|
||||
void DeviceCallThreadFunction();
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Functions to be implemented in device implementation |
|
||||
|
|
@ -199,7 +210,9 @@ public:
|
|||
virtual void SetCustomMode() = 0;
|
||||
|
||||
private:
|
||||
bool CallFlag_UpdateLEDs = false;
|
||||
std::thread* DeviceCallThread;
|
||||
std::atomic<bool> CallFlag_UpdateLEDs;
|
||||
std::atomic<bool> DeviceThreadRunning;
|
||||
//bool CallFlag_UpdateZoneLEDs = false;
|
||||
//bool CallFlag_UpdateSingleLED = false;
|
||||
//bool CallFlag_UpdateMode = false;
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ void RGBController_AMDWraithPrism::SetupZones()
|
|||
logo_zone.leds_min = 1;
|
||||
logo_zone.leds_max = 1;
|
||||
logo_zone.leds_count = 1;
|
||||
logo_zone.matrix_map = NULL;
|
||||
zones.push_back(logo_zone);
|
||||
|
||||
zone fan_zone;
|
||||
|
|
@ -112,6 +113,7 @@ void RGBController_AMDWraithPrism::SetupZones()
|
|||
fan_zone.leds_min = 1;
|
||||
fan_zone.leds_max = 1;
|
||||
fan_zone.leds_count = 1;
|
||||
fan_zone.matrix_map = NULL;
|
||||
zones.push_back(fan_zone);
|
||||
|
||||
zone ring_zone;
|
||||
|
|
@ -120,6 +122,7 @@ void RGBController_AMDWraithPrism::SetupZones()
|
|||
ring_zone.leds_min = 1;
|
||||
ring_zone.leds_max = 1;
|
||||
ring_zone.leds_count = 1;
|
||||
ring_zone.matrix_map = NULL;
|
||||
zones.push_back(ring_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
|
|
|
|||
|
|
@ -157,6 +157,8 @@ void RGBController_AuraAddressable::SetupZones()
|
|||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
zones[channel_idx].matrix_map = NULL;
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ void RGBController_AuraCore::SetupZones()
|
|||
Keyboard.leds_min = 4;
|
||||
Keyboard.leds_max = 4;
|
||||
Keyboard.leds_count = 4;
|
||||
Keyboard.matrix_map = NULL;
|
||||
zones.push_back(Keyboard);
|
||||
|
||||
for(int led_idx = 0; led_idx < Keyboard.leds_count; led_idx++)
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ void RGBController_AuraGPU::SetupZones()
|
|||
aura_gpu_zone.leds_min = 1;
|
||||
aura_gpu_zone.leds_max = 1;
|
||||
aura_gpu_zone.leds_count = 1;
|
||||
aura_gpu_zone.matrix_map = NULL;
|
||||
zones.push_back(aura_gpu_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
|
|
|
|||
|
|
@ -275,6 +275,8 @@ void RGBController_AuraSMBus::SetupZones()
|
|||
new_zone->type = ZONE_TYPE_SINGLE;
|
||||
}
|
||||
|
||||
new_zone->matrix_map = NULL;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Push new zone to zones vector |
|
||||
\*---------------------------------------------------------*/
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ void RGBController_CMMP750Controller::SetupZones()
|
|||
MP_zone.leds_min = 1;
|
||||
MP_zone.leds_max = 1;
|
||||
MP_zone.leds_count = 1;
|
||||
MP_zone.matrix_map = NULL;
|
||||
zones.push_back(MP_zone);
|
||||
|
||||
led MP_led;
|
||||
|
|
|
|||
|
|
@ -208,6 +208,8 @@ void RGBController_CorsairLightingNode::SetupZones()
|
|||
zones[channel_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
zones[channel_idx].matrix_map = NULL;
|
||||
|
||||
for (unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
{
|
||||
char led_idx_string[4];
|
||||
|
|
|
|||
|
|
@ -195,6 +195,7 @@ void RGBController_CorsairPeripheral::SetupZones()
|
|||
new_zone.leds_min = zone_sizes[zone_idx];
|
||||
new_zone.leds_max = zone_sizes[zone_idx];
|
||||
new_zone.leds_count = zone_sizes[zone_idx];
|
||||
new_zone.matrix_map = NULL;
|
||||
break;
|
||||
|
||||
case DEVICE_TYPE_MOUSE:
|
||||
|
|
@ -203,6 +204,7 @@ void RGBController_CorsairPeripheral::SetupZones()
|
|||
new_zone.leds_min = 15;
|
||||
new_zone.leds_max = 15;
|
||||
new_zone.leds_count = 15;
|
||||
new_zone.matrix_map = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ void RGBController_CorsairVengeance::SetupZones()
|
|||
new_zone.leds_min = corsair->GetLEDCount();
|
||||
new_zone.leds_max = corsair->GetLEDCount();
|
||||
new_zone.leds_count = corsair->GetLEDCount();
|
||||
new_zone.matrix_map = NULL;
|
||||
zones.push_back(new_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@ void RGBController_CorsairVengeancePro::SetupZones()
|
|||
new_zone.leds_min = corsair->GetLEDCount();
|
||||
new_zone.leds_max = corsair->GetLEDCount();
|
||||
new_zone.leds_count = corsair->GetLEDCount();
|
||||
new_zone.matrix_map = NULL;
|
||||
zones.push_back(new_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ void RGBController_Crucial::SetupZones()
|
|||
new_zone.leds_min = 8;
|
||||
new_zone.leds_max = 8;
|
||||
new_zone.leds_count = 8;
|
||||
new_zone.matrix_map = NULL;
|
||||
zones.push_back(new_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ void RGBController_E131::SetupZones()
|
|||
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.matrix_map = NULL;
|
||||
|
||||
zones.push_back(led_zone);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ void RGBController_Faustus::SetupZones()
|
|||
zones[0].leds_min = 1;
|
||||
zones[0].leds_max = 1;
|
||||
zones[0].leds_count = 1;
|
||||
zones[0].matrix_map = NULL;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up LED |
|
||||
|
|
|
|||
|
|
@ -144,6 +144,7 @@ void RGBController_Hue2::SetupZones()
|
|||
new_zone->leds_min = 0;
|
||||
new_zone->leds_max = 40;
|
||||
new_zone->leds_count = hue2->channel_leds[zone_idx];
|
||||
new_zone->matrix_map = NULL;
|
||||
|
||||
zones.push_back(*new_zone);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,6 +189,7 @@ void RGBController_HuePlus::SetupZones()
|
|||
zones[zone_idx].type = ZONE_TYPE_LINEAR;
|
||||
zones[zone_idx].leds_min = 0;
|
||||
zones[zone_idx].leds_max = 40;
|
||||
zones[zone_idx].matrix_map = NULL;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ void RGBController_HyperXDRAM::SetupZones()
|
|||
new_zone->leds_min = 5;
|
||||
new_zone->leds_max = 5;
|
||||
new_zone->leds_count = 5;
|
||||
new_zone->matrix_map = NULL;
|
||||
|
||||
zones.push_back(*new_zone);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -276,6 +276,7 @@ void RGBController_HyperXKeyboard::SetupZones()
|
|||
new_zone.leds_min = zone_sizes[zone_idx];
|
||||
new_zone.leds_max = zone_sizes[zone_idx];
|
||||
new_zone.leds_count = zone_sizes[zone_idx];
|
||||
new_zone.matrix_map = NULL;
|
||||
zones.push_back(new_zone);
|
||||
|
||||
total_led_count += zone_sizes[zone_idx];
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ void RGBController_LEDStrip::SetupZones()
|
|||
led_zone.leds_min = strip->num_leds;
|
||||
led_zone.leds_max = strip->num_leds;
|
||||
led_zone.leds_count = strip->num_leds;
|
||||
led_zone.matrix_map = NULL;
|
||||
zones.push_back(led_zone);
|
||||
|
||||
for(int led_idx = 0; led_idx < strip->num_leds; led_idx++)
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ void RGBController_MSI3Zone::SetupZones()
|
|||
keyboard_zone.leds_min = 3;
|
||||
keyboard_zone.leds_max = 3;
|
||||
keyboard_zone.leds_count = 3;
|
||||
keyboard_zone.matrix_map = NULL;
|
||||
zones.push_back(keyboard_zone);
|
||||
|
||||
led left_led;
|
||||
|
|
@ -66,6 +67,7 @@ void RGBController_MSI3Zone::SetupZones()
|
|||
aux_zone.leds_min = 1;
|
||||
aux_zone.leds_max = 1;
|
||||
aux_zone.leds_count = 1;
|
||||
aux_zone.matrix_map = NULL;
|
||||
zones.push_back(aux_zone);
|
||||
|
||||
led aux_led;
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ void RGBController_MSIMysticLight::SetupZones()
|
|||
new_zone.leds_min = controller->GetZoneMinLedCount(zd.value);
|
||||
new_zone.leds_max = controller->GetZoneMaxLedCount(zd.value);
|
||||
new_zone.leds_count = controller->GetZoneLedCount(zd.value);
|
||||
new_zone.matrix_map = NULL;
|
||||
zones.push_back(new_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ void RGBController_MSIRGB::SetupZones()
|
|||
msi_zone.leds_min = 1;
|
||||
msi_zone.leds_max = 1;
|
||||
msi_zone.leds_count = 1;
|
||||
msi_zone.matrix_map = NULL;
|
||||
zones.push_back(msi_zone);
|
||||
|
||||
led msi_led;
|
||||
|
|
|
|||
|
|
@ -199,6 +199,7 @@ void RGBController_NZXTKraken::SetupZones()
|
|||
logo_zone.leds_min = 1;
|
||||
logo_zone.leds_max = 1;
|
||||
logo_zone.leds_count = 1;
|
||||
logo_zone.matrix_map = NULL;
|
||||
zones.push_back(logo_zone);
|
||||
|
||||
zone ring_zone;
|
||||
|
|
@ -207,6 +208,7 @@ void RGBController_NZXTKraken::SetupZones()
|
|||
ring_zone.leds_min = 8;
|
||||
ring_zone.leds_max = 8;
|
||||
ring_zone.leds_count = 8;
|
||||
ring_zone.matrix_map = NULL;
|
||||
zones.push_back(ring_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
|
|
|
|||
|
|
@ -383,6 +383,30 @@ void RGBController_OpenRazer::SetupZones()
|
|||
new_zone.leds_min = new_zone.leds_count;
|
||||
new_zone.leds_max = new_zone.leds_count;
|
||||
|
||||
if(new_zone.type == ZONE_TYPE_MATRIX)
|
||||
{
|
||||
matrix_map_type * new_map = new matrix_map_type;
|
||||
new_zone.matrix_map = new_map;
|
||||
|
||||
new_map->height = device_list[device_index]->zones[zone_id]->rows;
|
||||
new_map->width = device_list[device_index]->zones[zone_id]->cols;
|
||||
|
||||
new_map->map = new unsigned int[new_map->height * new_map->width];
|
||||
|
||||
for(int y = 0; y < new_map->height; y++)
|
||||
{
|
||||
for(int x = 0; x < new_map->width; x++)
|
||||
{
|
||||
new_map->map[(y * new_map->width) + x] = (y * new_map->width) + x;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
new_zone.matrix_map = NULL;
|
||||
}
|
||||
|
||||
|
||||
zones.push_back(new_zone);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -332,6 +332,29 @@ void RGBController_OpenRazer::SetupZones()
|
|||
new_zone.leds_min = new_zone.leds_count;
|
||||
new_zone.leds_max = new_zone.leds_count;
|
||||
|
||||
if(new_zone.type == ZONE_TYPE_MATRIX)
|
||||
{
|
||||
matrix_map_type * new_map = new matrix_map_type;
|
||||
new_zone.matrix_map = new_map;
|
||||
|
||||
new_map->height = device_list[device_index]->zones[zone_id]->rows;
|
||||
new_map->width = device_list[device_index]->zones[zone_id]->cols;
|
||||
|
||||
new_map->map = new unsigned int[new_map->height * new_map->width];
|
||||
|
||||
for(int y = 0; y < new_map->height; y++)
|
||||
{
|
||||
for(int x = 0; x < new_map->width; x++)
|
||||
{
|
||||
new_map->map[(y * new_map->width) + x] = (y * new_map->width) + x;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
new_zone.matrix_map = NULL;
|
||||
}
|
||||
|
||||
zones.push_back(new_zone);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@ void RGBController_PatriotViper::SetupZones()
|
|||
new_zone->leds_min = 5;
|
||||
new_zone->leds_max = 5;
|
||||
new_zone->leds_count = 5;
|
||||
new_zone->matrix_map = NULL;
|
||||
zones.push_back(*new_zone);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -197,9 +197,11 @@ void RGBController_Polychrome::SetupZones()
|
|||
| Set zone name to channel name |
|
||||
\*---------------------------------------------------------*/
|
||||
new_zone->name = polychrome_zone_names[i];
|
||||
new_zone->type = ZONE_TYPE_SINGLE;
|
||||
new_zone->leds_min = 1;
|
||||
new_zone->leds_max = 1;
|
||||
new_zone->leds_count = 1;
|
||||
new_zone->matrix_map = NULL;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Push new zone to zones vector |
|
||||
|
|
|
|||
|
|
@ -201,6 +201,7 @@ void RGBController_PoseidonZRGB::SetupZones()
|
|||
new_zone.leds_min = zone_sizes[zone_idx];
|
||||
new_zone.leds_max = zone_sizes[zone_idx];
|
||||
new_zone.leds_count = zone_sizes[zone_idx];
|
||||
new_zone.matrix_map = NULL;
|
||||
zones.push_back(new_zone);
|
||||
|
||||
total_led_count += zone_sizes[zone_idx];
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ void RGBController_RGBFusion::SetupZones()
|
|||
new_zone->leds_min = 1;
|
||||
new_zone->leds_max = 1;
|
||||
new_zone->leds_count = 1;
|
||||
new_zone->matrix_map = NULL;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Push new zone to zones vector |
|
||||
|
|
|
|||
|
|
@ -193,7 +193,8 @@ void RGBController_RGBFusion2USB::SetupZones()
|
|||
{
|
||||
zones[zone_idx].name = led_zones[zone_idx];
|
||||
zones[zone_idx].type = ZONE_TYPE_LINEAR;
|
||||
|
||||
zones[zone_idx].matrix_map = NULL;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Zone index 0 is motherboard LEDs and has fixed size |
|
||||
\*---------------------------------------------------------*/
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ void RGBController_RGBFusionGPU::SetupZones()
|
|||
new_zone->leds_min = 1;
|
||||
new_zone->leds_max = 1;
|
||||
new_zone->leds_count = 1;
|
||||
new_zone->matrix_map = NULL;
|
||||
|
||||
new_led->name = "GPU LED";
|
||||
|
||||
|
|
|
|||
|
|
@ -203,7 +203,8 @@ void RGBController_RedragonK556::SetupZones()
|
|||
new_zone.leds_min = 126;
|
||||
new_zone.leds_max = 126;
|
||||
new_zone.leds_count = 126;
|
||||
|
||||
new_zone.matrix_map = NULL;
|
||||
|
||||
zones.push_back(new_zone);
|
||||
|
||||
for(int led_idx = 0; led_idx < 126; led_idx++)
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ void RGBController_RedragonM711::SetupZones()
|
|||
m711_zone.leds_min = 1;
|
||||
m711_zone.leds_max = 1;
|
||||
m711_zone.leds_count = 1;
|
||||
m711_zone.matrix_map = NULL;
|
||||
zones.push_back(m711_zone);
|
||||
|
||||
led m711_led;
|
||||
|
|
|
|||
|
|
@ -147,6 +147,8 @@ void RGBController_ThermaltakeRiing::SetupZones()
|
|||
zones[channel_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
zones[channel_idx].matrix_map = NULL;
|
||||
|
||||
for (unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
{
|
||||
char led_idx_string[3];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue