mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-05-13 09:04:36 -04:00
Code cleanup round 2
This commit is contained in:
@@ -63,7 +63,6 @@
|
||||
#define AURA_ROG_THRONE_PID 0x18D9
|
||||
#define AURA_ROG_THRONE_QI_PID 0x18C5
|
||||
|
||||
|
||||
AuraKeyboardMappingLayoutType GetKeyboardMappingLayoutType(int pid)
|
||||
{
|
||||
switch(pid)
|
||||
@@ -96,8 +95,8 @@ void DetectAsusAuraUSBTerminal(hid_device_info* info, const std::string& name)
|
||||
|
||||
if(dev)
|
||||
{
|
||||
AuraAddressableController* controller = new AuraAddressableController(dev, info->path);
|
||||
RGBController_AuraUSB* rgb_controller = new RGBController_AuraUSB(controller);
|
||||
AuraAddressableController* controller = new AuraAddressableController(dev, info->path);
|
||||
RGBController_AuraUSB* rgb_controller = new RGBController_AuraUSB(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
@@ -110,8 +109,8 @@ void DetectAsusAuraUSBAddressable(hid_device_info* info, const std::string& /*na
|
||||
if(dev)
|
||||
{
|
||||
DMIInfo dmi;
|
||||
AuraAddressableController* controller = new AuraAddressableController(dev, info->path);
|
||||
RGBController_AuraUSB* rgb_controller = new RGBController_AuraUSB(controller);
|
||||
AuraAddressableController* controller = new AuraAddressableController(dev, info->path);
|
||||
RGBController_AuraUSB* rgb_controller = new RGBController_AuraUSB(controller);
|
||||
rgb_controller->name = "ASUS " + dmi.getMainboard() + " Addressable";
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
@@ -120,13 +119,14 @@ void DetectAsusAuraUSBAddressable(hid_device_info* info, const std::string& /*na
|
||||
void DetectAsusAuraUSBMotherboards(hid_device_info* info, const std::string& /*name*/)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
try
|
||||
{
|
||||
DMIInfo dmi;
|
||||
AuraMainboardController* controller = new AuraMainboardController(dev, info->path);
|
||||
RGBController_AuraUSB* rgb_controller = new RGBController_AuraUSB(controller);
|
||||
AuraMainboardController* controller = new AuraMainboardController(dev, info->path);
|
||||
RGBController_AuraUSB* rgb_controller = new RGBController_AuraUSB(controller);
|
||||
rgb_controller->name = "ASUS " + dmi.getMainboard();
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
@@ -140,11 +140,12 @@ void DetectAsusAuraUSBMotherboards(hid_device_info* info, const std::string& /*n
|
||||
void DetectAsusAuraUSBKeyboards(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
AuraKeyboardController* controller = new AuraKeyboardController(dev, info->path);
|
||||
AuraKeyboardMappingLayoutType layout = GetKeyboardMappingLayoutType(info->product_id);
|
||||
RGBController_AuraKeyboard* rgb_controller = new RGBController_AuraKeyboard(controller, layout);
|
||||
AuraKeyboardController* controller = new AuraKeyboardController(dev, info->path);
|
||||
AuraKeyboardMappingLayoutType layout = GetKeyboardMappingLayoutType(info->product_id);
|
||||
RGBController_AuraKeyboard* rgb_controller = new RGBController_AuraKeyboard(controller, layout);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
@@ -153,9 +154,10 @@ void DetectAsusAuraUSBKeyboards(hid_device_info* info, const std::string& name)
|
||||
void DetectAsusAuraUSBMice(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
AuraMouseController* controller = new AuraMouseController(dev, info->path, info->product_id);
|
||||
AuraMouseController* controller = new AuraMouseController(dev, info->path, info->product_id);
|
||||
RGBController_AuraMouse* rgb_controller = new RGBController_AuraMouse(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
@@ -165,9 +167,10 @@ void DetectAsusAuraUSBMice(hid_device_info* info, const std::string& name)
|
||||
void DetectAsusAuraUSBMousemats(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
AuraMousematController* controller = new AuraMousematController(dev, info->path);
|
||||
AuraMousematController* controller = new AuraMousematController(dev, info->path);
|
||||
RGBController_AuraMousemat* rgb_controller = new RGBController_AuraMousemat(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
@@ -177,9 +180,10 @@ void DetectAsusAuraUSBMousemats(hid_device_info* info, const std::string& name)
|
||||
void DetectAsusAuraUSBStrixEvolve(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
AuraStrixEvolveController* controller = new AuraStrixEvolveController(dev, info->path, info->product_id);
|
||||
AuraStrixEvolveController* controller = new AuraStrixEvolveController(dev, info->path, info->product_id);
|
||||
RGBController_AuraStrixEvolve* rgb_controller = new RGBController_AuraStrixEvolve(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
@@ -189,9 +193,10 @@ void DetectAsusAuraUSBStrixEvolve(hid_device_info* info, const std::string& name
|
||||
void DetectAsusAuraUSBHeadsetStand(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
AuraHeadsetStandController* controller = new AuraHeadsetStandController(dev, info->path);
|
||||
AuraHeadsetStandController* controller = new AuraHeadsetStandController(dev, info->path);
|
||||
RGBController_AuraHeadsetStand* rgb_controller = new RGBController_AuraHeadsetStand(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
@@ -201,9 +206,10 @@ void DetectAsusAuraUSBHeadsetStand(hid_device_info* info, const std::string& nam
|
||||
void DetectAsusAuraTUFUSBKeyboard(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
AuraTUFKeyboardController* controller = new AuraTUFKeyboardController(dev, info->path);
|
||||
AuraTUFKeyboardController* controller = new AuraTUFKeyboardController(dev, info->path);
|
||||
RGBController_AuraTUFKeyboard* rgb_controller = new RGBController_AuraTUFKeyboard(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
|
||||
@@ -9,17 +9,17 @@
|
||||
|
||||
#include "RGBController_AsusAuraHeadsetStand.h"
|
||||
|
||||
RGBController_AuraHeadsetStand::RGBController_AuraHeadsetStand(AuraHeadsetStandController* aura_ptr)
|
||||
RGBController_AuraHeadsetStand::RGBController_AuraHeadsetStand(AuraHeadsetStandController* controller_ptr)
|
||||
{
|
||||
aura = aura_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "ASUS Aura Headset Stand";
|
||||
vendor = "ASUS";
|
||||
type = DEVICE_TYPE_HEADSET_STAND;
|
||||
description = "ASUS Aura Headset Stand Device";
|
||||
version = aura->GetVersion();
|
||||
location = aura->GetDeviceLocation();
|
||||
serial = aura->GetSerialString();
|
||||
version = controller->GetVersion();
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
@@ -99,7 +99,7 @@ RGBController_AuraHeadsetStand::RGBController_AuraHeadsetStand(AuraHeadsetStandC
|
||||
|
||||
RGBController_AuraHeadsetStand::~RGBController_AuraHeadsetStand()
|
||||
{
|
||||
delete aura;
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_AuraHeadsetStand::SetupZones()
|
||||
@@ -153,7 +153,7 @@ void RGBController_AuraHeadsetStand::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
|
||||
void RGBController_AuraHeadsetStand::DeviceUpdateLEDs()
|
||||
{
|
||||
aura->UpdateLeds(std::vector<RGBColor>(colors));
|
||||
controller->UpdateLeds(std::vector<RGBColor>(colors));
|
||||
}
|
||||
|
||||
void RGBController_AuraHeadsetStand::UpdateZoneLEDs(int /*zone*/)
|
||||
@@ -180,7 +180,7 @@ void RGBController_AuraHeadsetStand::DeviceUpdateMode()
|
||||
switch(modes[active_mode].value)
|
||||
{
|
||||
case 0:
|
||||
aura->UpdateLeds(std::vector<RGBColor>(colors));
|
||||
controller->UpdateLeds(std::vector<RGBColor>(colors));
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
@@ -188,11 +188,11 @@ void RGBController_AuraHeadsetStand::DeviceUpdateMode()
|
||||
red = RGBGetRValue(modes[active_mode].colors[0]);
|
||||
grn = RGBGetGValue(modes[active_mode].colors[0]);
|
||||
blu = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
aura->UpdateDevice(modes[active_mode].value, red, grn, blu, modes[active_mode].speed, modes[active_mode].brightness);
|
||||
controller->UpdateDevice(modes[active_mode].value, red, grn, blu, modes[active_mode].speed, modes[active_mode].brightness);
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
aura->UpdateDevice(modes[active_mode].value, red, grn, blu, modes[active_mode].speed, modes[active_mode].brightness);
|
||||
controller->UpdateDevice(modes[active_mode].value, red, grn, blu, modes[active_mode].speed, modes[active_mode].brightness);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -200,5 +200,5 @@ void RGBController_AuraHeadsetStand::DeviceUpdateMode()
|
||||
void RGBController_AuraHeadsetStand::DeviceSaveMode()
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
aura->SaveMode();
|
||||
controller->SaveMode();
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ enum
|
||||
class RGBController_AuraHeadsetStand : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_AuraHeadsetStand(AuraHeadsetStandController* aura_ptr);
|
||||
RGBController_AuraHeadsetStand(AuraHeadsetStandController* controller_ptr);
|
||||
~RGBController_AuraHeadsetStand();
|
||||
|
||||
void SetupZones();
|
||||
@@ -40,5 +40,5 @@ public:
|
||||
void DeviceSaveMode();
|
||||
|
||||
private:
|
||||
AuraHeadsetStandController* aura;
|
||||
AuraHeadsetStandController* controller;
|
||||
};
|
||||
|
||||
@@ -342,17 +342,17 @@ static const std::vector<led_type> default_65pct_led_names =
|
||||
{ "Key: Right Arrow", 0x74 },
|
||||
};
|
||||
|
||||
RGBController_AuraKeyboard::RGBController_AuraKeyboard(AuraKeyboardController* aura_ptr, AuraKeyboardMappingLayoutType keyboard_layout)
|
||||
RGBController_AuraKeyboard::RGBController_AuraKeyboard(AuraKeyboardController* controller_ptr, AuraKeyboardMappingLayoutType keyboard_layout)
|
||||
{
|
||||
aura = aura_ptr;
|
||||
controller = controller_ptr;
|
||||
layout = keyboard_layout;
|
||||
|
||||
name = "ASUS Aura Keyboard";
|
||||
vendor = "ASUS";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "ASUS Aura Keyboard Device";
|
||||
location = aura->GetDeviceLocation();
|
||||
serial = aura->GetSerialString();
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
@@ -373,7 +373,8 @@ RGBController_AuraKeyboard::~RGBController_AuraKeyboard()
|
||||
delete zones[zone_idx].matrix_map;
|
||||
}
|
||||
}
|
||||
delete aura;
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_AuraKeyboard::SetupZones()
|
||||
@@ -501,7 +502,7 @@ void RGBController_AuraKeyboard::DeviceUpdateLEDs()
|
||||
frame_buf[(led_idx * 4) + 3] = RGBGetBValue(colors[led_idx]);
|
||||
}
|
||||
|
||||
aura->SendDirect(leds.size(), frame_buf.data());
|
||||
controller->SendDirect(leds.size(), frame_buf.data());
|
||||
}
|
||||
|
||||
void RGBController_AuraKeyboard::UpdateZoneLEDs(int /*zone*/)
|
||||
|
||||
@@ -37,7 +37,7 @@ typedef struct
|
||||
class RGBController_AuraKeyboard : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_AuraKeyboard(AuraKeyboardController* aura_ptr, AuraKeyboardMappingLayoutType keyboard_layout);
|
||||
RGBController_AuraKeyboard(AuraKeyboardController* controller_ptr, AuraKeyboardMappingLayoutType keyboard_layout);
|
||||
~RGBController_AuraKeyboard();
|
||||
|
||||
void SetupZones();
|
||||
@@ -52,6 +52,6 @@ public:
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
AuraKeyboardController* aura;
|
||||
AuraKeyboardController* controller;
|
||||
AuraKeyboardMappingLayoutType layout;
|
||||
};
|
||||
|
||||
@@ -16,19 +16,19 @@ static std::string aura_mouse_zone_names[3]
|
||||
"Underglow"
|
||||
};
|
||||
|
||||
RGBController_AuraMouse::RGBController_AuraMouse(AuraMouseController* aura_ptr)
|
||||
RGBController_AuraMouse::RGBController_AuraMouse(AuraMouseController* controller_ptr)
|
||||
{
|
||||
aura = aura_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
uint16_t pid = aura->device_pid;
|
||||
uint16_t pid = controller->device_pid;
|
||||
|
||||
name = "ASUS Aura Mouse";
|
||||
vendor = "ASUS";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = "ASUS Aura Mouse Device";
|
||||
version = aura->GetVersion(aura_mouse_devices[pid].wireless, aura_mouse_devices[pid].version_protocol);
|
||||
location = aura->GetDeviceLocation();
|
||||
serial = aura->GetSerialString();
|
||||
version = controller->GetVersion(aura_mouse_devices[pid].wireless, aura_mouse_devices[pid].version_protocol);
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
std::vector<uint8_t> mm = aura_mouse_devices[pid].mouse_modes;
|
||||
|
||||
@@ -152,13 +152,12 @@ RGBController_AuraMouse::RGBController_AuraMouse(AuraMouseController* aura_ptr)
|
||||
|
||||
RGBController_AuraMouse::~RGBController_AuraMouse()
|
||||
{
|
||||
delete aura;
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_AuraMouse::SetupZones()
|
||||
{
|
||||
|
||||
uint16_t pid = aura->device_pid;
|
||||
uint16_t pid = controller->device_pid;
|
||||
|
||||
for(std::vector<uint8_t>::iterator zone_it = aura_mouse_devices[pid].mouse_zones.begin(); zone_it != aura_mouse_devices[pid].mouse_zones.end(); zone_it++)
|
||||
{
|
||||
@@ -208,7 +207,7 @@ void RGBController_AuraMouse::UpdateSingleLED(int led)
|
||||
uint8_t grn = RGBGetGValue(colors[led]);
|
||||
uint8_t blu = RGBGetBValue(colors[led]);
|
||||
|
||||
aura->SendUpdate(leds[led].value, modes[active_mode].value, red, grn, blu, 0, false, 0, modes[active_mode].brightness);
|
||||
controller->SendUpdate(leds[led].value, modes[active_mode].value, red, grn, blu, 0, false, 0, modes[active_mode].brightness);
|
||||
}
|
||||
|
||||
void RGBController_AuraMouse::SetCustomMode()
|
||||
@@ -235,12 +234,12 @@ void RGBController_AuraMouse::DeviceUpdateMode()
|
||||
blu = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
}
|
||||
|
||||
aura->SendUpdate(AURA_MOUSE_ZONE_ALL, modes[active_mode].value, red, grn, blu, modes[active_mode].direction, modes[active_mode].color_mode == MODE_COLORS_RANDOM, modes[active_mode].speed, modes[active_mode].brightness);
|
||||
controller->SendUpdate(AURA_MOUSE_ZONE_ALL, modes[active_mode].value, red, grn, blu, modes[active_mode].direction, modes[active_mode].color_mode == MODE_COLORS_RANDOM, modes[active_mode].speed, modes[active_mode].brightness);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_AuraMouse::DeviceSaveMode()
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
aura->SaveMode();
|
||||
controller->SaveMode();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ enum {
|
||||
class RGBController_AuraMouse : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_AuraMouse(AuraMouseController* aura_ptr);
|
||||
RGBController_AuraMouse(AuraMouseController* controller_ptr);
|
||||
~RGBController_AuraMouse();
|
||||
|
||||
void SetupZones();
|
||||
@@ -36,5 +36,5 @@ public:
|
||||
void DeviceSaveMode();
|
||||
|
||||
private:
|
||||
AuraMouseController* aura;
|
||||
AuraMouseController* controller;
|
||||
};
|
||||
|
||||
@@ -11,17 +11,17 @@
|
||||
#include <vector>
|
||||
#include <cmath>
|
||||
|
||||
RGBController_AuraTUFKeyboard::RGBController_AuraTUFKeyboard(AuraTUFKeyboardController* aura_ptr)
|
||||
RGBController_AuraTUFKeyboard::RGBController_AuraTUFKeyboard(AuraTUFKeyboardController* controller_ptr)
|
||||
{
|
||||
aura = aura_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "ASUS Aura Keyboard";
|
||||
vendor = "ASUS";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "ASUS Aura Keyboard Device";
|
||||
version = aura->GetVersion();
|
||||
location = aura->GetDeviceLocation();
|
||||
serial = aura->GetSerialString();
|
||||
version = controller->GetVersion();
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
@@ -191,12 +191,12 @@ RGBController_AuraTUFKeyboard::RGBController_AuraTUFKeyboard(AuraTUFKeyboardCont
|
||||
|
||||
RGBController_AuraTUFKeyboard::~RGBController_AuraTUFKeyboard()
|
||||
{
|
||||
delete aura;
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_AuraTUFKeyboard::SetupZones()
|
||||
{
|
||||
int layout = aura->GetLayout();
|
||||
int layout = controller->GetLayout();
|
||||
|
||||
if(AsusTUFK7Layouts.find(layout % 100) == AsusTUFK7Layouts.end())
|
||||
{
|
||||
@@ -248,7 +248,7 @@ void RGBController_AuraTUFKeyboard::DeviceUpdateLEDs()
|
||||
|
||||
void RGBController_AuraTUFKeyboard::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
aura->UpdateLeds(colors);
|
||||
controller->UpdateLeds(colors);
|
||||
}
|
||||
|
||||
void RGBController_AuraTUFKeyboard::UpdateSingleLED(int led)
|
||||
@@ -256,7 +256,8 @@ void RGBController_AuraTUFKeyboard::UpdateSingleLED(int led)
|
||||
unsigned char red = RGBGetRValue(colors[led]);
|
||||
unsigned char green = RGBGetGValue(colors[led]);
|
||||
unsigned char blue = RGBGetBValue(colors[led]);
|
||||
aura->UpdateSingleLed(led, red, green, blue);
|
||||
|
||||
controller->UpdateSingleLed(led, red, green, blue);
|
||||
}
|
||||
|
||||
void RGBController_AuraTUFKeyboard::SetCustomMode()
|
||||
@@ -271,7 +272,7 @@ void RGBController_AuraTUFKeyboard::DeviceUpdateMode()
|
||||
|
||||
if(modes[active_mode].value == AURA_KEYBOARD_MODE_DIRECT)
|
||||
{
|
||||
aura->UpdateLeds(colors);
|
||||
controller->UpdateLeds(colors);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -319,14 +320,14 @@ void RGBController_AuraTUFKeyboard::DeviceUpdateMode()
|
||||
|
||||
mode_colors = modes[active_mode].color_mode == MODE_COLORS_PER_LED ? std::vector<RGBColor>(colors) : std::vector<RGBColor>(modes[active_mode].colors);
|
||||
|
||||
aura->UpdateDevice(modes[active_mode].value, mode_colors, direction, color_mode, (15 - modes[active_mode].speed), modes[active_mode].brightness * 25);
|
||||
controller->UpdateDevice(modes[active_mode].value, mode_colors, direction, color_mode, (15 - modes[active_mode].speed), modes[active_mode].brightness * 25);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_AuraTUFKeyboard::DeviceSaveMode()
|
||||
{
|
||||
aura->ClearResponses();
|
||||
controller->ClearResponses();
|
||||
DeviceUpdateMode();
|
||||
aura->AwaitResponse();
|
||||
aura->SaveMode();
|
||||
controller->AwaitResponse();
|
||||
controller->SaveMode();
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ enum
|
||||
class RGBController_AuraTUFKeyboard : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_AuraTUFKeyboard(AuraTUFKeyboardController* aura_ptr);
|
||||
RGBController_AuraTUFKeyboard(AuraTUFKeyboardController* controller_ptr);
|
||||
~RGBController_AuraTUFKeyboard();
|
||||
|
||||
void SetupZones();
|
||||
@@ -40,5 +40,5 @@ public:
|
||||
void DeviceSaveMode();
|
||||
|
||||
private:
|
||||
AuraTUFKeyboardController* aura;
|
||||
AuraTUFKeyboardController* controller;
|
||||
};
|
||||
|
||||
@@ -1,264 +1,266 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_AsusAuraUSB.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for Asus Aura |
|
||||
| USB controller driver |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 1/18/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_AsusAuraUSB.h"
|
||||
|
||||
RGBController_AuraUSB::RGBController_AuraUSB(AuraUSBController* aura_ptr) :
|
||||
initializedMode(false)
|
||||
{
|
||||
aura = aura_ptr;
|
||||
|
||||
name = "ASUS Aura USB";
|
||||
vendor = "ASUS";
|
||||
version = aura->GetDeviceName();
|
||||
type = DEVICE_TYPE_MOTHERBOARD;
|
||||
description = "ASUS Aura USB Device";
|
||||
location = aura->GetDeviceLocation();
|
||||
serial = aura->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = AURA_MODE_DIRECT;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = AURA_MODE_OFF;
|
||||
Off.flags = 0;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = AURA_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Static.colors_min = 1;
|
||||
Static.colors_max = 1;
|
||||
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Static.colors.resize(1);
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = AURA_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Breathing.colors_min = 1;
|
||||
Breathing.colors_max = 1;
|
||||
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Breathing.colors.resize(1);
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Flashing;
|
||||
Flashing.name = "Flashing";
|
||||
Flashing.value = AURA_MODE_FLASHING;
|
||||
Flashing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Flashing.colors_min = 1;
|
||||
Flashing.colors_max = 1;
|
||||
Flashing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Flashing.colors.resize(1);
|
||||
modes.push_back(Flashing);
|
||||
|
||||
mode SpectrumCycle;
|
||||
SpectrumCycle.name = "Spectrum Cycle";
|
||||
SpectrumCycle.value = AURA_MODE_SPECTRUM_CYCLE;
|
||||
SpectrumCycle.flags = 0;
|
||||
SpectrumCycle.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(SpectrumCycle);
|
||||
|
||||
mode Rainbow;
|
||||
Rainbow.name = "Rainbow";
|
||||
Rainbow.value = AURA_MODE_RAINBOW;
|
||||
Rainbow.flags = 0;
|
||||
Rainbow.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Rainbow);
|
||||
|
||||
mode ChaseFade;
|
||||
ChaseFade.name = "Chase Fade";
|
||||
ChaseFade.value = AURA_MODE_CHASE_FADE;
|
||||
ChaseFade.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
ChaseFade.colors_min = 1;
|
||||
ChaseFade.colors_max = 1;
|
||||
ChaseFade.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
ChaseFade.colors.resize(1);
|
||||
modes.push_back(ChaseFade);
|
||||
|
||||
mode Chase;
|
||||
Chase.name = "Chase";
|
||||
Chase.value = AURA_MODE_CHASE;
|
||||
Chase.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Chase.colors_min = 1;
|
||||
Chase.colors_max = 1;
|
||||
Chase.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Chase.colors.resize(1);
|
||||
modes.push_back(Chase);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_AuraUSB::~RGBController_AuraUSB()
|
||||
{
|
||||
delete aura;
|
||||
}
|
||||
|
||||
void RGBController_AuraUSB::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 |
|
||||
\*-------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(aura->GetChannelCount());
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-------------------------------------------------*/
|
||||
int addressableCounter = 1;
|
||||
for (unsigned int channel_idx = 0; channel_idx < zones.size(); channel_idx++)
|
||||
{
|
||||
AuraDeviceInfo device_info = aura->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;
|
||||
}
|
||||
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++;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
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++)
|
||||
{
|
||||
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 ");
|
||||
led_idx -= num_mainboard_leds;
|
||||
}
|
||||
else
|
||||
{
|
||||
new_led.name.append(", LED ");
|
||||
}
|
||||
new_led.name.append(std::to_string(led_idx));
|
||||
|
||||
new_led.value = channel_idx;
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
zones[channel_idx].matrix_map = NULL;
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_AuraUSB::ResizeZone(int zone, int new_size)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_AuraUSB::DeviceUpdateLEDs()
|
||||
{
|
||||
if(!initializedMode)
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
}
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
aura->SetChannelLEDs(zone_idx, zones[zone_idx].colors, zones[zone_idx].leds_count);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_AuraUSB::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
if(!initializedMode)
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
}
|
||||
aura->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count);
|
||||
}
|
||||
|
||||
void RGBController_AuraUSB::UpdateSingleLED(int led)
|
||||
{
|
||||
if(!initializedMode)
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
}
|
||||
unsigned int channel = leds[led].value;
|
||||
|
||||
aura->SetChannelLEDs(channel, zones[channel].colors, zones[channel].leds_count);
|
||||
}
|
||||
|
||||
void RGBController_AuraUSB::SetCustomMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_AuraUSB::DeviceUpdateMode()
|
||||
{
|
||||
initializedMode = true;
|
||||
unsigned char red = 0;
|
||||
unsigned char grn = 0;
|
||||
unsigned char blu = 0;
|
||||
|
||||
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
|
||||
{
|
||||
red = RGBGetRValue(modes[active_mode].colors[0]);
|
||||
grn = RGBGetGValue(modes[active_mode].colors[0]);
|
||||
blu = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
}
|
||||
|
||||
for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
if(zones[zone_idx].leds_count > 0)
|
||||
{
|
||||
aura->SetMode(zone_idx, modes[active_mode].value, red, grn, blu);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_AsusAuraUSB.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for Asus Aura |
|
||||
| USB controller driver |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 1/18/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_AsusAuraUSB.h"
|
||||
|
||||
RGBController_AuraUSB::RGBController_AuraUSB(AuraUSBController* controller_ptr) :
|
||||
initializedMode(false)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "ASUS Aura USB";
|
||||
vendor = "ASUS";
|
||||
version = controller->GetDeviceName();
|
||||
type = DEVICE_TYPE_MOTHERBOARD;
|
||||
description = "ASUS Aura USB Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = AURA_MODE_DIRECT;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = AURA_MODE_OFF;
|
||||
Off.flags = 0;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = AURA_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Static.colors_min = 1;
|
||||
Static.colors_max = 1;
|
||||
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Static.colors.resize(1);
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = AURA_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Breathing.colors_min = 1;
|
||||
Breathing.colors_max = 1;
|
||||
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Breathing.colors.resize(1);
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Flashing;
|
||||
Flashing.name = "Flashing";
|
||||
Flashing.value = AURA_MODE_FLASHING;
|
||||
Flashing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Flashing.colors_min = 1;
|
||||
Flashing.colors_max = 1;
|
||||
Flashing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Flashing.colors.resize(1);
|
||||
modes.push_back(Flashing);
|
||||
|
||||
mode SpectrumCycle;
|
||||
SpectrumCycle.name = "Spectrum Cycle";
|
||||
SpectrumCycle.value = AURA_MODE_SPECTRUM_CYCLE;
|
||||
SpectrumCycle.flags = 0;
|
||||
SpectrumCycle.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(SpectrumCycle);
|
||||
|
||||
mode Rainbow;
|
||||
Rainbow.name = "Rainbow";
|
||||
Rainbow.value = AURA_MODE_RAINBOW;
|
||||
Rainbow.flags = 0;
|
||||
Rainbow.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Rainbow);
|
||||
|
||||
mode ChaseFade;
|
||||
ChaseFade.name = "Chase Fade";
|
||||
ChaseFade.value = AURA_MODE_CHASE_FADE;
|
||||
ChaseFade.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
ChaseFade.colors_min = 1;
|
||||
ChaseFade.colors_max = 1;
|
||||
ChaseFade.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
ChaseFade.colors.resize(1);
|
||||
modes.push_back(ChaseFade);
|
||||
|
||||
mode Chase;
|
||||
Chase.name = "Chase";
|
||||
Chase.value = AURA_MODE_CHASE;
|
||||
Chase.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Chase.colors_min = 1;
|
||||
Chase.colors_max = 1;
|
||||
Chase.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Chase.colors.resize(1);
|
||||
modes.push_back(Chase);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_AuraUSB::~RGBController_AuraUSB()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_AuraUSB::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 |
|
||||
\*-------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(controller->GetChannelCount());
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-------------------------------------------------*/
|
||||
int addressableCounter = 1;
|
||||
for (unsigned int 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;
|
||||
}
|
||||
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++;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
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++)
|
||||
{
|
||||
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 ");
|
||||
led_idx -= num_mainboard_leds;
|
||||
}
|
||||
else
|
||||
{
|
||||
new_led.name.append(", LED ");
|
||||
}
|
||||
new_led.name.append(std::to_string(led_idx));
|
||||
|
||||
new_led.value = channel_idx;
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
zones[channel_idx].matrix_map = NULL;
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_AuraUSB::ResizeZone(int zone, int new_size)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_AuraUSB::DeviceUpdateLEDs()
|
||||
{
|
||||
if(!initializedMode)
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
}
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
controller->SetChannelLEDs(zone_idx, zones[zone_idx].colors, zones[zone_idx].leds_count);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_AuraUSB::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
if(!initializedMode)
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
}
|
||||
|
||||
controller->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count);
|
||||
}
|
||||
|
||||
void RGBController_AuraUSB::UpdateSingleLED(int led)
|
||||
{
|
||||
if(!initializedMode)
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
}
|
||||
|
||||
unsigned int channel = leds[led].value;
|
||||
|
||||
controller->SetChannelLEDs(channel, zones[channel].colors, zones[channel].leds_count);
|
||||
}
|
||||
|
||||
void RGBController_AuraUSB::SetCustomMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_AuraUSB::DeviceUpdateMode()
|
||||
{
|
||||
initializedMode = true;
|
||||
unsigned char red = 0;
|
||||
unsigned char grn = 0;
|
||||
unsigned char blu = 0;
|
||||
|
||||
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
|
||||
{
|
||||
red = RGBGetRValue(modes[active_mode].colors[0]);
|
||||
grn = RGBGetGValue(modes[active_mode].colors[0]);
|
||||
blu = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
}
|
||||
|
||||
for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
if(zones[zone_idx].leds_count > 0)
|
||||
{
|
||||
controller->SetMode(zone_idx, modes[active_mode].value, red, grn, blu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_AsusAuraUSB.h |
|
||||
| |
|
||||
| Generic RGB Interface for Asus Aura |
|
||||
| USB controller driver |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 1/18/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "AsusAuraUSBController.h"
|
||||
|
||||
#define AURA_ADDRESSABLE_MAX_LEDS 120
|
||||
|
||||
class RGBController_AuraUSB : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_AuraUSB(AuraUSBController* aura_ptr);
|
||||
~RGBController_AuraUSB();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
AuraUSBController* aura;
|
||||
std::vector<unsigned int> leds_channel;
|
||||
std::vector<unsigned int> zones_channel;
|
||||
bool initializedMode;
|
||||
};
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_AsusAuraUSB.h |
|
||||
| |
|
||||
| Generic RGB Interface for Asus Aura |
|
||||
| USB controller driver |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 1/18/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "AsusAuraUSBController.h"
|
||||
|
||||
#define AURA_ADDRESSABLE_MAX_LEDS 120
|
||||
|
||||
class RGBController_AuraUSB : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_AuraUSB(AuraUSBController* controller_ptr);
|
||||
~RGBController_AuraUSB();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
AuraUSBController* controller;
|
||||
std::vector<unsigned int> leds_channel;
|
||||
std::vector<unsigned int> zones_channel;
|
||||
bool initializedMode;
|
||||
};
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
void DetectCoolerMasterARGB(hid_device_info* info, const std::string&)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
@@ -55,7 +56,7 @@ void DetectCoolerMasterARGB(hid_device_info* info, const std::string&)
|
||||
|
||||
for(std::size_t i = 0; i < CM_ARGB_HEADER_DATA_SIZE; i++)
|
||||
{
|
||||
CMARGBController* controller = new CMARGBController(dev, info->path, i, cm_mutex);
|
||||
CMARGBController* controller = new CMARGBController(dev, info->path, i, cm_mutex);
|
||||
RGBController_CMARGBController* rgb_controller = new RGBController_CMARGBController(controller);
|
||||
// Constructor sets the name
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
@@ -66,9 +67,10 @@ void DetectCoolerMasterARGB(hid_device_info* info, const std::string&)
|
||||
void DetectCoolerMasterGPU(hid_device_info* info, const std::string&)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
CMR6000Controller* controller = new CMR6000Controller(dev, info->path);
|
||||
CMR6000Controller* controller = new CMR6000Controller(dev, info->path);
|
||||
RGBController_CMR6000Controller* rgb_controller = new RGBController_CMR6000Controller(controller);
|
||||
// Constructor sets the name
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
@@ -77,11 +79,11 @@ void DetectCoolerMasterGPU(hid_device_info* info, const std::string&)
|
||||
|
||||
void DetectCoolerMasterKeyboards(hid_device_info* info, const std::string&)
|
||||
{
|
||||
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
CMMKController* controller = new CMMKController(dev, info);
|
||||
CMMKController* controller = new CMMKController(dev, info);
|
||||
RGBController_CMMKController* rgb_controller = new RGBController_CMMKController(controller);
|
||||
// Constructor sets the name
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
@@ -91,9 +93,10 @@ void DetectCoolerMasterKeyboards(hid_device_info* info, const std::string&)
|
||||
void DetectCoolerMasterMouse(hid_device_info* info, const std::string&)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
CMMM711Controller* controller = new CMMM711Controller(dev, info->path);
|
||||
CMMM711Controller* controller = new CMMM711Controller(dev, info->path);
|
||||
RGBController_CMMM711Controller* rgb_controller = new RGBController_CMMM711Controller(controller);
|
||||
// Constructor sets the name
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
@@ -103,9 +106,10 @@ void DetectCoolerMasterMouse(hid_device_info* info, const std::string&)
|
||||
void DetectCoolerMasterMousemats(hid_device_info* info, const std::string&)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
CMMP750Controller* controller = new CMMP750Controller(dev, info->path);
|
||||
CMMP750Controller* controller = new CMMP750Controller(dev, info->path);
|
||||
RGBController_CMMP750Controller* rgb_controller = new RGBController_CMMP750Controller(controller);
|
||||
// Constructor sets the name
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
@@ -115,9 +119,10 @@ void DetectCoolerMasterMousemats(hid_device_info* info, const std::string&)
|
||||
void DetectCoolerMasterRGB(hid_device_info* info, const std::string&)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
CMRGBController* controller = new CMRGBController(dev, info->path);
|
||||
CMRGBController* controller = new CMRGBController(dev, info->path);
|
||||
RGBController_CMRGBController* rgb_controller = new RGBController_CMRGBController(controller);
|
||||
// Constructor sets the name
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
@@ -127,9 +132,10 @@ void DetectCoolerMasterRGB(hid_device_info* info, const std::string&)
|
||||
void DetectCoolerMasterSmallARGB(hid_device_info* info, const std::string&)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
CMSmallARGBController* controller = new CMSmallARGBController(dev, info->path, 0);
|
||||
CMSmallARGBController* controller = new CMSmallARGBController(dev, info->path, 0);
|
||||
RGBController_CMSmallARGBController* rgb_controller = new RGBController_CMSmallARGBController(controller);
|
||||
// Constructor sets the name
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
|
||||
@@ -9,20 +9,20 @@
|
||||
|
||||
#include "RGBController_CMARGBController.h"
|
||||
|
||||
RGBController_CMARGBController::RGBController_CMARGBController(CMARGBController *cmargb_ptr)
|
||||
RGBController_CMARGBController::RGBController_CMARGBController(CMARGBController* controller_ptr)
|
||||
{
|
||||
cmargb = cmargb_ptr;
|
||||
unsigned char speed = cmargb->GetLedSpeed();
|
||||
controller = controller_ptr;
|
||||
unsigned char speed = controller->GetLedSpeed();
|
||||
|
||||
name = argb_header_data[cmargb->GetZoneIndex()].name;
|
||||
name = argb_header_data[controller->GetZoneIndex()].name;
|
||||
vendor = "Cooler Master";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
description = cmargb->GetDeviceName();
|
||||
description = controller->GetDeviceName();
|
||||
version = "3.0 for FW0028";
|
||||
serial = cmargb->GetSerial();
|
||||
location = cmargb->GetLocation();
|
||||
serial = controller->GetSerial();
|
||||
location = controller->GetLocation();
|
||||
|
||||
if(argb_header_data[cmargb->GetZoneIndex()].digital)
|
||||
if(argb_header_data[controller->GetZoneIndex()].digital)
|
||||
{
|
||||
mode Off;
|
||||
Off.name = "Turn Off";
|
||||
@@ -256,7 +256,7 @@ RGBController_CMARGBController::RGBController_CMARGBController(CMARGBController
|
||||
Init_Controller();
|
||||
SetupZones();
|
||||
|
||||
int temp_mode = cmargb->GetMode();
|
||||
int temp_mode = controller->GetMode();
|
||||
for(std::size_t mode_idx = 0; mode_idx < modes.size() ; mode_idx++)
|
||||
{
|
||||
if (temp_mode == modes[mode_idx].value)
|
||||
@@ -267,23 +267,23 @@ RGBController_CMARGBController::RGBController_CMARGBController(CMARGBController
|
||||
}
|
||||
if (modes[active_mode].flags & MODE_FLAG_HAS_MODE_SPECIFIC_COLOR)
|
||||
{
|
||||
modes[active_mode].colors[0] = ToRGBColor(cmargb->GetLedRed(), cmargb->GetLedGreen(), cmargb->GetLedBlue());
|
||||
modes[active_mode].color_mode = (cmargb->GetRandomColours()) ? MODE_COLORS_RANDOM : MODE_COLORS_MODE_SPECIFIC;
|
||||
modes[active_mode].colors[0] = ToRGBColor(controller->GetLedRed(), controller->GetLedGreen(), controller->GetLedBlue());
|
||||
modes[active_mode].color_mode = (controller->GetRandomColours()) ? MODE_COLORS_RANDOM : MODE_COLORS_MODE_SPECIFIC;
|
||||
}
|
||||
if (modes[active_mode].flags & MODE_FLAG_HAS_SPEED)
|
||||
{
|
||||
modes[active_mode].speed = cmargb->GetLedSpeed();
|
||||
modes[active_mode].speed = controller->GetLedSpeed();
|
||||
}
|
||||
}
|
||||
|
||||
RGBController_CMARGBController::~RGBController_CMARGBController()
|
||||
{
|
||||
delete cmargb;
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CMARGBController::Init_Controller()
|
||||
{
|
||||
int zone_idx = cmargb->GetZoneIndex();
|
||||
int zone_idx = controller->GetZoneIndex();
|
||||
int zone_led_count = argb_header_data[zone_idx].count;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
@@ -319,7 +319,7 @@ void RGBController_CMARGBController::SetupZones()
|
||||
|
||||
if (!boolSingleLED)
|
||||
{
|
||||
cmargb->SetLedCount( std::stoi(zones[zone_idx].name), zones[zone_idx].leds_count);
|
||||
controller->SetLedCount( std::stoi(zones[zone_idx].name), zones[zone_idx].leds_count);
|
||||
}
|
||||
|
||||
for(unsigned int lp_idx = 0; lp_idx < zones[zone_idx].leds_count; lp_idx++)
|
||||
@@ -377,7 +377,7 @@ void RGBController_CMARGBController::DeviceUpdateLEDs()
|
||||
|
||||
void RGBController_CMARGBController::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
cmargb->SetLedsDirect( zones[zone].colors, zones[zone].leds_count );
|
||||
controller->SetLedsDirect( zones[zone].colors, zones[zone].leds_count );
|
||||
}
|
||||
|
||||
void RGBController_CMARGBController::UpdateSingleLED(int led)
|
||||
@@ -399,10 +399,10 @@ void RGBController_CMARGBController::SetCustomMode()
|
||||
|
||||
void RGBController_CMARGBController::DeviceUpdateMode()
|
||||
{
|
||||
bool random_colours = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
|
||||
bool random_colours = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
|
||||
RGBColor colour = (modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC) ? modes[active_mode].colors[0] : 0;
|
||||
|
||||
cmargb->SetMode( modes[active_mode].value, modes[active_mode].speed, modes[active_mode].brightness, colour, random_colours );
|
||||
controller->SetMode( modes[active_mode].value, modes[active_mode].speed, modes[active_mode].brightness, colour, random_colours );
|
||||
}
|
||||
|
||||
int RGBController_CMARGBController::GetLED_Zone(int led_idx)
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_CMARGBController.h |
|
||||
| |
|
||||
| Driver for Coolermaster ARGB Controller |
|
||||
| |
|
||||
| Chris M (Dr_No) 14th Oct 2020 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "CMARGBcontroller.h"
|
||||
#include <vector>
|
||||
|
||||
#define first_zone(zn) ((zones.size() > 1) ? 1 : 0)
|
||||
#define last_zone(zn) ((zones.size() > 1) ? 4 : 1)
|
||||
|
||||
class RGBController_CMARGBController : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CMARGBController(CMARGBController* cmargb_ptr);
|
||||
~RGBController_CMARGBController();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
void Init_Controller();
|
||||
int GetDeviceMode();
|
||||
int GetLED_Zone(int led_idx);
|
||||
|
||||
CMARGBController* cmargb;
|
||||
};
|
||||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_CMARGBController.h |
|
||||
| |
|
||||
| Driver for Coolermaster ARGB Controller |
|
||||
| |
|
||||
| Chris M (Dr_No) 14th Oct 2020 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "CMARGBcontroller.h"
|
||||
#include <vector>
|
||||
|
||||
#define first_zone(zn) ((zones.size() > 1) ? 1 : 0)
|
||||
#define last_zone(zn) ((zones.size() > 1) ? 4 : 1)
|
||||
|
||||
class RGBController_CMARGBController : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CMARGBController(CMARGBController* controller_ptr);
|
||||
~RGBController_CMARGBController();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
void Init_Controller();
|
||||
int GetDeviceMode();
|
||||
int GetLED_Zone(int led_idx);
|
||||
|
||||
CMARGBController* controller;
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
| Driver for Coolermaster MasterKeys keyboards |
|
||||
| |
|
||||
| Lukas N (chmod222) 28th Jun 2020 |
|
||||
| Tam D (too.manyhobbies) 25th Apr 2021 |
|
||||
| Tam D (too.manyhobbies) 25th Apr 2021 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
@@ -20,17 +20,17 @@ using namespace std::chrono_literals;
|
||||
#define CMMK_MODE_FIRMWARE 0xFF
|
||||
#define CMMK_MODE_MANUAL 0x7F
|
||||
|
||||
RGBController_CMMKController::RGBController_CMMKController(CMMKController* cmmk_ctrl)
|
||||
RGBController_CMMKController::RGBController_CMMKController(CMMKController* controller_ptr)
|
||||
{
|
||||
cmmk = cmmk_ctrl;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = cmmk->GetDeviceName();
|
||||
vendor = cmmk->GetDeviceVendor();
|
||||
name = controller->GetDeviceName();
|
||||
vendor = controller->GetDeviceVendor();
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "Cooler Master MasterKeys Device";
|
||||
version = cmmk->GetFirmwareVersion();
|
||||
version = controller->GetFirmwareVersion();
|
||||
serial = "";
|
||||
location = cmmk->GetLocation();
|
||||
location = controller->GetLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
@@ -173,7 +173,7 @@ RGBController_CMMKController::RGBController_CMMKController(CMMKController* cmmk_
|
||||
|
||||
RGBController_CMMKController::~RGBController_CMMKController()
|
||||
{
|
||||
delete cmmk;
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CMMKController::SetupMatrixMap()
|
||||
@@ -199,14 +199,14 @@ void RGBController_CMMKController::SetupMatrixMap()
|
||||
|
||||
void RGBController_CMMKController::SetupZones()
|
||||
{
|
||||
uint8_t row_count = cmmk->GetRowCount();
|
||||
uint8_t column_count = cmmk->GetColumnCount();
|
||||
uint8_t row_count = controller->GetRowCount();
|
||||
uint8_t column_count = controller->GetColumnCount();
|
||||
|
||||
for(int y = 0; y < row_count; y++)
|
||||
{
|
||||
for(int x = 0; x < column_count; x++)
|
||||
{
|
||||
if(!cmmk->PositionValid(y, x))
|
||||
if(!controller->PositionValid(y, x))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -308,7 +308,7 @@ void RGBController_CMMKController::DeviceUpdateLEDs()
|
||||
|
||||
if(force_update.load() || dirty.load())
|
||||
{
|
||||
cmmk->SetAll(current_matrix);
|
||||
controller->SetAll(current_matrix);
|
||||
|
||||
force_update.store(false);
|
||||
}
|
||||
@@ -322,7 +322,7 @@ void RGBController_CMMKController::UpdateZoneLEDs(int zone_idx)
|
||||
|
||||
if(force_update.load() || dirty.load())
|
||||
{
|
||||
cmmk->SetAll(current_matrix);
|
||||
controller->SetAll(current_matrix);
|
||||
|
||||
force_update.store(false);
|
||||
}
|
||||
@@ -337,7 +337,7 @@ void RGBController_CMMKController::UpdateSingleLED(int led_idx)
|
||||
|
||||
current_matrix.data[y][x] = map_to_cmmk_rgb(colors[led_idx]);
|
||||
|
||||
cmmk->SetSingle(y, x, map_to_cmmk_rgb(colors[led_idx]));
|
||||
controller->SetSingle(y, x, map_to_cmmk_rgb(colors[led_idx]));
|
||||
dirty.store(false);
|
||||
}
|
||||
|
||||
@@ -353,11 +353,11 @@ void RGBController_CMMKController::DeviceUpdateMode()
|
||||
switch(modes[active_mode].value)
|
||||
{
|
||||
case CMMK_MODE_FIRMWARE:
|
||||
cmmk->SetFirmwareControl();
|
||||
controller->SetFirmwareControl();
|
||||
break;
|
||||
|
||||
case CMMK_MODE_MANUAL:
|
||||
cmmk->SetManualControl();
|
||||
controller->SetManualControl();
|
||||
break;
|
||||
|
||||
case CMMK_EFFECT_FULLY_LIT:
|
||||
@@ -366,7 +366,7 @@ void RGBController_CMMKController::DeviceUpdateMode()
|
||||
|
||||
fully_lit_effect.color = map_to_cmmk_rgb(modes[active_mode].colors[0]);
|
||||
|
||||
cmmk->SetMode(fully_lit_effect);
|
||||
controller->SetMode(fully_lit_effect);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -377,7 +377,7 @@ void RGBController_CMMKController::DeviceUpdateMode()
|
||||
breathe_effect.speed = (uint8_t)modes[active_mode].speed;
|
||||
breathe_effect.color = map_to_cmmk_rgb(modes[active_mode].colors[0]);
|
||||
|
||||
cmmk->SetMode(breathe_effect);
|
||||
controller->SetMode(breathe_effect);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -387,7 +387,7 @@ void RGBController_CMMKController::DeviceUpdateMode()
|
||||
|
||||
cycle_effect.speed = (uint8_t)modes[active_mode].speed;
|
||||
|
||||
cmmk->SetMode(cycle_effect);
|
||||
controller->SetMode(cycle_effect);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -399,7 +399,7 @@ void RGBController_CMMKController::DeviceUpdateMode()
|
||||
single_effect.active = map_to_cmmk_rgb(modes[active_mode].colors[0]);
|
||||
single_effect.rest = map_to_cmmk_rgb(modes[active_mode].colors[1]);
|
||||
|
||||
cmmk->SetMode(single_effect);
|
||||
controller->SetMode(single_effect);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -411,7 +411,7 @@ void RGBController_CMMKController::DeviceUpdateMode()
|
||||
wave_effect.direction = map_to_cmmk_dir(modes[active_mode].direction);
|
||||
wave_effect.start = map_to_cmmk_rgb(modes[active_mode].colors[0]);
|
||||
|
||||
cmmk->SetMode(wave_effect);
|
||||
controller->SetMode(wave_effect);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -432,7 +432,7 @@ void RGBController_CMMKController::DeviceUpdateMode()
|
||||
ripple_effect.ripple_type = CMMK_RIPPLE_GIVEN_COLOR;
|
||||
}
|
||||
|
||||
cmmk->SetMode(ripple_effect);
|
||||
controller->SetMode(ripple_effect);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -444,7 +444,7 @@ void RGBController_CMMKController::DeviceUpdateMode()
|
||||
cross_effect.active = map_to_cmmk_rgb(modes[active_mode].colors[0]);
|
||||
cross_effect.rest = map_to_cmmk_rgb(modes[active_mode].colors[1]);
|
||||
|
||||
cmmk->SetMode(cross_effect);
|
||||
controller->SetMode(cross_effect);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -457,7 +457,7 @@ void RGBController_CMMKController::DeviceUpdateMode()
|
||||
raindrops_effect.active = map_to_cmmk_rgb(modes[active_mode].colors[0]);
|
||||
raindrops_effect.rest = map_to_cmmk_rgb(modes[active_mode].colors[1]);
|
||||
|
||||
cmmk->SetMode(raindrops_effect);
|
||||
controller->SetMode(raindrops_effect);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -470,7 +470,7 @@ void RGBController_CMMKController::DeviceUpdateMode()
|
||||
stars_effect.active = map_to_cmmk_rgb(modes[active_mode].colors[0]);
|
||||
stars_effect.rest = map_to_cmmk_rgb(modes[active_mode].colors[1]);
|
||||
|
||||
cmmk->SetMode(stars_effect);
|
||||
controller->SetMode(stars_effect);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -480,7 +480,7 @@ void RGBController_CMMKController::DeviceUpdateMode()
|
||||
|
||||
snake_effect.speed = (uint8_t)modes[active_mode].speed;
|
||||
|
||||
cmmk->SetMode(snake_effect);
|
||||
controller->SetMode(snake_effect);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_CMMKController.h |
|
||||
| |
|
||||
| Driver for Coolermaster MasterKeys keyboards |
|
||||
| |
|
||||
| Lukas N (chmod222) 28th Jun 2020 |
|
||||
| Tam D (too.manyhobbies) 25th Apr 2021 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "CMMKController.h"
|
||||
|
||||
class RGBController_CMMKController : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CMMKController(CMMKController* cmmk_ptr);
|
||||
~RGBController_CMMKController();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
void SetupMatrixMap();
|
||||
|
||||
CMMKController* cmmk;
|
||||
|
||||
int matrix_map[CMMK_ROWS_MAX][CMMK_COLS_MAX];
|
||||
struct cmmk_color_matrix current_matrix;
|
||||
|
||||
std::atomic<bool> dirty;
|
||||
std::atomic<bool> force_update;
|
||||
};
|
||||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_CMMKController.h |
|
||||
| |
|
||||
| Driver for Coolermaster MasterKeys keyboards |
|
||||
| |
|
||||
| Lukas N (chmod222) 28th Jun 2020 |
|
||||
| Tam D (too.manyhobbies) 25th Apr 2021 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "CMMKController.h"
|
||||
|
||||
class RGBController_CMMKController : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CMMKController(CMMKController* controller_ptr);
|
||||
~RGBController_CMMKController();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
void SetupMatrixMap();
|
||||
|
||||
CMMKController* controller;
|
||||
|
||||
int matrix_map[CMMK_ROWS_MAX][CMMK_COLS_MAX];
|
||||
struct cmmk_color_matrix current_matrix;
|
||||
|
||||
std::atomic<bool> dirty;
|
||||
std::atomic<bool> force_update;
|
||||
};
|
||||
|
||||
@@ -11,18 +11,17 @@
|
||||
|
||||
#include "RGBController_CMMM711Controller.h"
|
||||
|
||||
RGBController_CMMM711Controller::RGBController_CMMM711Controller(CMMM711Controller *cmmm711_ptr)
|
||||
RGBController_CMMM711Controller::RGBController_CMMM711Controller(CMMM711Controller* controller_ptr)
|
||||
{
|
||||
cmmm711 = cmmm711_ptr;
|
||||
uint8_t speed = cmmm711->GetLedSpeed();
|
||||
controller = controller_ptr;
|
||||
uint8_t speed = controller->GetLedSpeed();
|
||||
|
||||
name = cmmm711->GetDeviceName();
|
||||
name = controller->GetDeviceName();
|
||||
vendor = "Cooler Master";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = cmmm711->GetDeviceName();
|
||||
version = "1.0";
|
||||
serial = cmmm711->GetSerial();
|
||||
location = cmmm711->GetLocation();
|
||||
description = controller->GetDeviceName();
|
||||
serial = controller->GetSerial();
|
||||
location = controller->GetLocation();
|
||||
|
||||
mode Custom;
|
||||
Custom.name = "Direct";
|
||||
@@ -96,26 +95,29 @@ RGBController_CMMM711Controller::RGBController_CMMM711Controller(CMMM711Controll
|
||||
Init_Controller(); //Only processed on first run
|
||||
SetupZones();
|
||||
|
||||
uint8_t temp_mode = cmmm711->GetMode();
|
||||
uint8_t temp_mode = controller->GetMode();
|
||||
|
||||
for(std::size_t mode_index = 0; mode_index < modes.size(); mode_index++)
|
||||
{
|
||||
if (modes[mode_index].value == temp_mode)
|
||||
{
|
||||
active_mode = mode_index;
|
||||
active_mode = mode_index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
|
||||
{
|
||||
modes[active_mode].colors[0] = ToRGBColor(cmmm711->GetLedRed(),cmmm711->GetLedGreen(),cmmm711->GetLedBlue());
|
||||
modes[active_mode].colors[0] = ToRGBColor(controller->GetLedRed(),controller->GetLedGreen(),controller->GetLedBlue());
|
||||
}
|
||||
colors[0] = cmmm711->GetWheelColour();
|
||||
colors[1] = cmmm711->GetLogoColour();
|
||||
|
||||
colors[0] = controller->GetWheelColour();
|
||||
colors[1] = controller->GetLogoColour();
|
||||
}
|
||||
|
||||
RGBController_CMMM711Controller::~RGBController_CMMM711Controller()
|
||||
{
|
||||
delete cmmm711;
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CMMM711Controller::Init_Controller()
|
||||
@@ -157,7 +159,7 @@ void RGBController_CMMM711Controller::DeviceUpdateLEDs()
|
||||
RGBColor wheel = applyBrightness(colors[0], modes[active_mode].brightness);
|
||||
RGBColor logo = applyBrightness(colors[1], modes[active_mode].brightness);
|
||||
|
||||
cmmm711->SetLedsDirect( wheel, logo);
|
||||
controller->SetLedsDirect( wheel, logo);
|
||||
}
|
||||
|
||||
void RGBController_CMMM711Controller::UpdateZoneLEDs(int /*zone*/)
|
||||
@@ -193,12 +195,12 @@ void RGBController_CMMM711Controller::DeviceUpdateMode()
|
||||
colour = modes[active_mode].colors[0];
|
||||
}
|
||||
|
||||
cmmm711->SendUpdate(modes[active_mode].value, modes[active_mode].speed, colour, modes[active_mode].brightness);
|
||||
controller->SendUpdate(modes[active_mode].value, modes[active_mode].speed, colour, modes[active_mode].brightness);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_CMMM711Controller::DeviceSaveMode()
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
cmmm711->SendSavePacket();
|
||||
controller->SendSavePacket();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
class RGBController_CMMM711Controller : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CMMM711Controller(CMMM711Controller* cmargb_ptr);
|
||||
RGBController_CMMM711Controller(CMMM711Controller* controller_ptr);
|
||||
~RGBController_CMMM711Controller();
|
||||
|
||||
void SetupZones();
|
||||
@@ -36,5 +36,5 @@ private:
|
||||
void Init_Controller();
|
||||
int GetDeviceMode();
|
||||
|
||||
CMMM711Controller* cmmm711;
|
||||
CMMM711Controller* controller;
|
||||
};
|
||||
|
||||
@@ -1,168 +1,173 @@
|
||||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_CMMP750Controller.cpp |
|
||||
| |
|
||||
| Driver for Coolermaster MP750 mousepad |
|
||||
| |
|
||||
| Chris M (Dr_No) 18th Apr 2020 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_CMMP750Controller.h"
|
||||
|
||||
RGBController_CMMP750Controller::RGBController_CMMP750Controller(CMMP750Controller* cmmp_ptr)
|
||||
{
|
||||
cmmp750 = cmmp_ptr;
|
||||
unsigned char speed = cmmp750->GetLedSpeed();
|
||||
|
||||
name = cmmp750->GetDeviceName();
|
||||
vendor = "Cooler Master";
|
||||
type = DEVICE_TYPE_MOUSEMAT;
|
||||
description = cmmp750->GetDeviceName();
|
||||
version = "1.0";
|
||||
serial = cmmp750->GetSerial();
|
||||
location = cmmp750->GetLocation();
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = CM_MP750_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Blink;
|
||||
Blink.name = "Blink";
|
||||
Blink.value = CM_MP750_MODE_BLINK;
|
||||
Blink.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Blink.speed_min = MP750_SPEED_SLOWEST;
|
||||
Blink.speed_max = MP750_SPEED_FASTEST;
|
||||
Blink.color_mode = MODE_COLORS_PER_LED;
|
||||
Blink.speed = speed;
|
||||
modes.push_back(Blink);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = CM_MP750_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Breathing.speed_min = MP750_SPEED_SLOWEST;
|
||||
Breathing.speed_max = MP750_SPEED_FASTEST;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed = speed;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode ColorCycle;
|
||||
ColorCycle.name = "Color Cycle";
|
||||
ColorCycle.value = CM_MP750_MODE_COLOR_CYCLE;
|
||||
ColorCycle.flags = MODE_FLAG_HAS_SPEED;
|
||||
ColorCycle.speed_min = MP750_SPEED_SLOWEST;
|
||||
ColorCycle.speed_max = MP750_SPEED_FASTEST;
|
||||
ColorCycle.color_mode = MODE_COLORS_NONE;
|
||||
ColorCycle.speed = speed;
|
||||
modes.push_back(ColorCycle);
|
||||
|
||||
mode BreathCycle;
|
||||
BreathCycle.name = "Breath Cycle";
|
||||
BreathCycle.value = CM_MP750_MODE_BREATH_CYCLE;
|
||||
BreathCycle.flags = MODE_FLAG_HAS_SPEED;
|
||||
BreathCycle.speed_min = MP750_SPEED_SLOWEST;
|
||||
BreathCycle.speed_max = MP750_SPEED_FASTEST;
|
||||
BreathCycle.color_mode = MODE_COLORS_NONE;
|
||||
BreathCycle.speed = speed;
|
||||
modes.push_back(BreathCycle);
|
||||
|
||||
mode Off;
|
||||
Off.name = "Turn Off";
|
||||
Off.value = CM_MP750_MODE_OFF;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
SetupZones();
|
||||
active_mode = GetDeviceMode();
|
||||
}
|
||||
|
||||
RGBController_CMMP750Controller::~RGBController_CMMP750Controller()
|
||||
{
|
||||
delete cmmp750;
|
||||
}
|
||||
|
||||
int RGBController_CMMP750Controller::GetDeviceMode()
|
||||
{
|
||||
int temp_mode = cmmp750->GetMode();
|
||||
for(unsigned int i = 0; i < modes.size(); i++)
|
||||
{
|
||||
if (temp_mode == modes[i].value)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
//If not found return 0
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RGBController_CMMP750Controller::SetupZones()
|
||||
{
|
||||
zone MP_zone;
|
||||
MP_zone.name = "Mousepad";
|
||||
MP_zone.type = ZONE_TYPE_SINGLE;
|
||||
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;
|
||||
MP_led.name = "Mousepad LED";
|
||||
leds.push_back(MP_led);
|
||||
|
||||
SetupColors();
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Initialize colors for each LED |
|
||||
\*---------------------------------------------------------*/
|
||||
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
||||
{
|
||||
unsigned char red = cmmp750->GetLedRed();
|
||||
unsigned char grn = cmmp750->GetLedGreen();
|
||||
unsigned char blu = cmmp750->GetLedBlue();
|
||||
|
||||
colors[led_idx] = ToRGBColor(red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_CMMP750Controller::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_CMMP750Controller::DeviceUpdateLEDs()
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[0]);
|
||||
unsigned char grn = RGBGetGValue(colors[0]);
|
||||
unsigned char blu = RGBGetBValue(colors[0]);
|
||||
cmmp750->SetColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_CMMP750Controller::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
RGBColor color = colors[zone];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
cmmp750->SetColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_CMMP750Controller::UpdateSingleLED(int led)
|
||||
{
|
||||
UpdateZoneLEDs(led);
|
||||
}
|
||||
|
||||
void RGBController_CMMP750Controller::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_CMMP750Controller::DeviceUpdateMode()
|
||||
{
|
||||
cmmp750->SetMode(modes[active_mode].value, modes[active_mode].speed);
|
||||
}
|
||||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_CMMP750Controller.cpp |
|
||||
| |
|
||||
| Driver for Coolermaster MP750 mousepad |
|
||||
| |
|
||||
| Chris M (Dr_No) 18th Apr 2020 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_CMMP750Controller.h"
|
||||
|
||||
RGBController_CMMP750Controller::RGBController_CMMP750Controller(CMMP750Controller* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
unsigned char speed = controller->GetLedSpeed();
|
||||
|
||||
name = controller->GetDeviceName();
|
||||
vendor = "Cooler Master";
|
||||
type = DEVICE_TYPE_MOUSEMAT;
|
||||
description = controller->GetDeviceName();
|
||||
serial = controller->GetSerial();
|
||||
location = controller->GetLocation();
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = CM_MP750_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Blink;
|
||||
Blink.name = "Blink";
|
||||
Blink.value = CM_MP750_MODE_BLINK;
|
||||
Blink.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Blink.speed_min = MP750_SPEED_SLOWEST;
|
||||
Blink.speed_max = MP750_SPEED_FASTEST;
|
||||
Blink.color_mode = MODE_COLORS_PER_LED;
|
||||
Blink.speed = speed;
|
||||
modes.push_back(Blink);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = CM_MP750_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Breathing.speed_min = MP750_SPEED_SLOWEST;
|
||||
Breathing.speed_max = MP750_SPEED_FASTEST;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed = speed;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode ColorCycle;
|
||||
ColorCycle.name = "Color Cycle";
|
||||
ColorCycle.value = CM_MP750_MODE_COLOR_CYCLE;
|
||||
ColorCycle.flags = MODE_FLAG_HAS_SPEED;
|
||||
ColorCycle.speed_min = MP750_SPEED_SLOWEST;
|
||||
ColorCycle.speed_max = MP750_SPEED_FASTEST;
|
||||
ColorCycle.color_mode = MODE_COLORS_NONE;
|
||||
ColorCycle.speed = speed;
|
||||
modes.push_back(ColorCycle);
|
||||
|
||||
mode BreathCycle;
|
||||
BreathCycle.name = "Breath Cycle";
|
||||
BreathCycle.value = CM_MP750_MODE_BREATH_CYCLE;
|
||||
BreathCycle.flags = MODE_FLAG_HAS_SPEED;
|
||||
BreathCycle.speed_min = MP750_SPEED_SLOWEST;
|
||||
BreathCycle.speed_max = MP750_SPEED_FASTEST;
|
||||
BreathCycle.color_mode = MODE_COLORS_NONE;
|
||||
BreathCycle.speed = speed;
|
||||
modes.push_back(BreathCycle);
|
||||
|
||||
mode Off;
|
||||
Off.name = "Turn Off";
|
||||
Off.value = CM_MP750_MODE_OFF;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
SetupZones();
|
||||
active_mode = GetDeviceMode();
|
||||
}
|
||||
|
||||
RGBController_CMMP750Controller::~RGBController_CMMP750Controller()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
int RGBController_CMMP750Controller::GetDeviceMode()
|
||||
{
|
||||
int temp_mode = controller->GetMode();
|
||||
|
||||
for(unsigned int i = 0; i < modes.size(); i++)
|
||||
{
|
||||
if (temp_mode == modes[i].value)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| If not found return 0 |
|
||||
\*---------------------------------------------------------*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RGBController_CMMP750Controller::SetupZones()
|
||||
{
|
||||
zone MP_zone;
|
||||
MP_zone.name = "Mousepad";
|
||||
MP_zone.type = ZONE_TYPE_SINGLE;
|
||||
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;
|
||||
MP_led.name = "Mousepad LED";
|
||||
leds.push_back(MP_led);
|
||||
|
||||
SetupColors();
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Initialize colors for each LED |
|
||||
\*---------------------------------------------------------*/
|
||||
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
||||
{
|
||||
unsigned char red = controller->GetLedRed();
|
||||
unsigned char grn = controller->GetLedGreen();
|
||||
unsigned char blu = controller->GetLedBlue();
|
||||
|
||||
colors[led_idx] = ToRGBColor(red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_CMMP750Controller::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_CMMP750Controller::DeviceUpdateLEDs()
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[0]);
|
||||
unsigned char grn = RGBGetGValue(colors[0]);
|
||||
unsigned char blu = RGBGetBValue(colors[0]);
|
||||
|
||||
controller->SetColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_CMMP750Controller::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
RGBColor color = colors[zone];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
controller->SetColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_CMMP750Controller::UpdateSingleLED(int led)
|
||||
{
|
||||
UpdateZoneLEDs(led);
|
||||
}
|
||||
|
||||
void RGBController_CMMP750Controller::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_CMMP750Controller::DeviceUpdateMode()
|
||||
{
|
||||
controller->SetMode(modes[active_mode].value, modes[active_mode].speed);
|
||||
}
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_CMMP750Controller.h |
|
||||
| |
|
||||
| Driver for Coolermaster MP750 mousepad |
|
||||
| |
|
||||
| Chris M (Dr_No) 18th Apr 2020 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "CMMP750Controller.h"
|
||||
|
||||
class RGBController_CMMP750Controller : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CMMP750Controller(CMMP750Controller* cmmp_ptr);
|
||||
~RGBController_CMMP750Controller();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
private:
|
||||
CMMP750Controller* cmmp750;
|
||||
|
||||
int GetDeviceMode();
|
||||
};
|
||||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_CMMP750Controller.h |
|
||||
| |
|
||||
| Driver for Coolermaster MP750 mousepad |
|
||||
| |
|
||||
| Chris M (Dr_No) 18th Apr 2020 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "CMMP750Controller.h"
|
||||
|
||||
class RGBController_CMMP750Controller : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CMMP750Controller(CMMP750Controller* controller_ptr);
|
||||
~RGBController_CMMP750Controller();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
private:
|
||||
CMMP750Controller* controller;
|
||||
|
||||
int GetDeviceMode();
|
||||
};
|
||||
|
||||
@@ -8,18 +8,17 @@
|
||||
|
||||
#include "RGBController_CMR6000Controller.h"
|
||||
|
||||
RGBController_CMR6000Controller::RGBController_CMR6000Controller(CMR6000Controller* cmmp_ptr)
|
||||
RGBController_CMR6000Controller::RGBController_CMR6000Controller(CMR6000Controller* controller_ptr)
|
||||
{
|
||||
cmr6000 = cmmp_ptr;
|
||||
unsigned char speed = cmr6000->GetLedSpeed();
|
||||
controller = controller_ptr;
|
||||
unsigned char speed = controller->GetLedSpeed();
|
||||
|
||||
name = "AMD RX 6xxx GPU";
|
||||
vendor = "Cooler Master";
|
||||
type = DEVICE_TYPE_GPU;
|
||||
description = cmr6000->GetDeviceName();
|
||||
version = "1.0";
|
||||
serial = cmr6000->GetSerial();
|
||||
location = cmr6000->GetLocation();
|
||||
description = controller->GetDeviceName();
|
||||
serial = controller->GetSerial();
|
||||
location = controller->GetLocation();
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
@@ -29,12 +28,12 @@ RGBController_CMR6000Controller::RGBController_CMR6000Controller(CMR6000Controll
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = CM_MR6000_MODE_DIRECT;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR| MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
Direct.colors_min = 1;
|
||||
Direct.colors_max = 1;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = CM_MR6000_MODE_DIRECT;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR| MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
Direct.colors_min = 1;
|
||||
Direct.colors_max = 1;
|
||||
Direct.colors.resize(1);
|
||||
Direct.brightness_min = 0x00;
|
||||
Direct.brightness_max = 0xFF;
|
||||
@@ -75,27 +74,26 @@ RGBController_CMR6000Controller::RGBController_CMR6000Controller(CMR6000Controll
|
||||
|
||||
RGBController_CMR6000Controller::~RGBController_CMR6000Controller()
|
||||
{
|
||||
delete cmr6000;
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CMR6000Controller::SetupZones()
|
||||
{
|
||||
zone GP_zone;
|
||||
GP_zone.name = "GPU";
|
||||
GP_zone.type = ZONE_TYPE_SINGLE;
|
||||
GP_zone.leds_min = 1;
|
||||
GP_zone.leds_max = 1;
|
||||
GP_zone.leds_count = 1;
|
||||
GP_zone.matrix_map = NULL;
|
||||
GP_zone.name = "GPU";
|
||||
GP_zone.type = ZONE_TYPE_SINGLE;
|
||||
GP_zone.leds_min = 1;
|
||||
GP_zone.leds_max = 1;
|
||||
GP_zone.leds_count = 1;
|
||||
GP_zone.matrix_map = NULL;
|
||||
zones.push_back(GP_zone);
|
||||
|
||||
led GP_led;
|
||||
GP_led.name = "Logo";
|
||||
GP_led.value = 0;
|
||||
GP_led.name = "Logo";
|
||||
GP_led.value = 0;
|
||||
leds.push_back(GP_led);
|
||||
|
||||
SetupColors();
|
||||
|
||||
}
|
||||
|
||||
void RGBController_CMR6000Controller::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
@@ -121,7 +119,7 @@ void RGBController_CMR6000Controller::DeviceUpdateLEDs()
|
||||
unsigned char rnd = (modes[active_mode].color_mode == MODE_COLORS_RANDOM) ? 0xA0 : 0x20;
|
||||
unsigned char bri = (modes[active_mode].flags & MODE_FLAG_HAS_BRIGHTNESS) ? modes[active_mode].brightness : 0xFF;
|
||||
|
||||
cmr6000->SetMode(modes[active_mode].value, modes[active_mode].speed, red, grn, blu, rnd, bri);
|
||||
controller->SetMode(modes[active_mode].value, modes[active_mode].speed, red, grn, blu, rnd, bri);
|
||||
}
|
||||
|
||||
void RGBController_CMR6000Controller::UpdateZoneLEDs(int /*zone*/)
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_CMR6000Controller.h |
|
||||
| |
|
||||
| Driver for Coolermaster based AMD Radeon GPU (6000 series) |
|
||||
| |
|
||||
| Eric S (edbgon) 2nd Feb 2021 |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "CMR6000Controller.h"
|
||||
|
||||
class RGBController_CMR6000Controller : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CMR6000Controller(CMR6000Controller* cmmp_ptr);
|
||||
~RGBController_CMR6000Controller();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
private:
|
||||
CMR6000Controller* cmr6000;
|
||||
|
||||
int GetDeviceMode();
|
||||
};
|
||||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_CMR6000Controller.h |
|
||||
| |
|
||||
| Driver for Coolermaster based AMD Radeon GPU (6000 series) |
|
||||
| |
|
||||
| Eric S (edbgon) 2nd Feb 2021 |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "CMR6000Controller.h"
|
||||
|
||||
class RGBController_CMR6000Controller : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CMR6000Controller(CMR6000Controller* controller_ptr);
|
||||
~RGBController_CMR6000Controller();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
private:
|
||||
CMR6000Controller* controller;
|
||||
|
||||
int GetDeviceMode();
|
||||
};
|
||||
|
||||
@@ -43,17 +43,16 @@
|
||||
| Single color for Star |
|
||||
\*-----------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
RGBController_CMRGBController::RGBController_CMRGBController(CMRGBController *cmrgb_ptr)
|
||||
RGBController_CMRGBController::RGBController_CMRGBController(CMRGBController* controller_ptr)
|
||||
{
|
||||
cmrgb = cmrgb_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "Cooler Master RGB Controller";
|
||||
vendor = "Cooler Master";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
description = cmrgb->GetDeviceName();
|
||||
version = "";
|
||||
serial = cmrgb->GetSerial();
|
||||
location = cmrgb->GetLocation();
|
||||
description = controller->GetDeviceName();
|
||||
serial = controller->GetSerial();
|
||||
location = controller->GetLocation();
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
@@ -128,10 +127,10 @@ RGBController_CMRGBController::RGBController_CMRGBController(CMRGBController *cm
|
||||
modes.push_back(Multiple);
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = CM_RGBC_MODE_OFF;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
Off.flags = 0;
|
||||
Off.name = "Off";
|
||||
Off.value = CM_RGBC_MODE_OFF;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
Off.flags = 0;
|
||||
modes.push_back(Off);
|
||||
|
||||
SetupZones();
|
||||
@@ -141,12 +140,12 @@ RGBController_CMRGBController::RGBController_CMRGBController(CMRGBController *cm
|
||||
|
||||
RGBController_CMRGBController::~RGBController_CMRGBController()
|
||||
{
|
||||
delete cmrgb;
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CMRGBController::ReadAllModeConfigsFromDevice()
|
||||
{
|
||||
int device_mode = cmrgb->GetMode();
|
||||
int device_mode = controller->GetMode();
|
||||
|
||||
for(std::size_t mode_idx = 0; mode_idx < modes.size(); mode_idx++)
|
||||
{
|
||||
@@ -161,7 +160,7 @@ void RGBController_CMRGBController::ReadAllModeConfigsFromDevice()
|
||||
continue;
|
||||
}
|
||||
|
||||
cmrgb->ReadModeConfig(modes[mode_idx].value);
|
||||
controller->ReadModeConfig(modes[mode_idx].value);
|
||||
LoadConfigFromDeviceController(mode_idx);
|
||||
}
|
||||
|
||||
@@ -171,7 +170,7 @@ void RGBController_CMRGBController::ReadAllModeConfigsFromDevice()
|
||||
\*---------------------------------------------------------*/
|
||||
if(active_mode != -1)
|
||||
{
|
||||
cmrgb->ReadModeConfig(modes[active_mode].value);
|
||||
controller->ReadModeConfig(modes[active_mode].value);
|
||||
LoadConfigFromDeviceController(active_mode);
|
||||
}
|
||||
}
|
||||
@@ -180,25 +179,25 @@ void RGBController_CMRGBController::LoadConfigFromDeviceController(int mode_idx)
|
||||
{
|
||||
for(std::size_t color_idx = 0; color_idx < modes[mode_idx].colors.size(); color_idx++)
|
||||
{
|
||||
modes[mode_idx].colors[0] = cmrgb->GetModeColor(color_idx);
|
||||
modes[mode_idx].colors[0] = controller->GetModeColor(color_idx);
|
||||
}
|
||||
|
||||
if(modes[mode_idx].flags & MODE_FLAG_HAS_PER_LED_COLOR)
|
||||
{
|
||||
for (std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
||||
{
|
||||
SetLED(led_idx, cmrgb->GetPortColor(led_idx));
|
||||
SetLED(led_idx, controller->GetPortColor(led_idx));
|
||||
}
|
||||
}
|
||||
|
||||
if(modes[mode_idx].flags & MODE_FLAG_HAS_SPEED)
|
||||
{
|
||||
modes[mode_idx].speed = cmrgb->GetSpeed();
|
||||
modes[mode_idx].speed = controller->GetSpeed();
|
||||
}
|
||||
|
||||
if(modes[mode_idx].flags & MODE_FLAG_HAS_BRIGHTNESS)
|
||||
{
|
||||
modes[active_mode].brightness = cmrgb->GetBrightness();
|
||||
modes[active_mode].brightness = controller->GetBrightness();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,8 +222,8 @@ void RGBController_CMRGBController::SetupZones()
|
||||
|
||||
for(int i = 1; i <= CM_RGBC_NUM_LEDS; i++)
|
||||
{
|
||||
led* new_led = new led();
|
||||
new_led->name = "LED " + std::to_string(i);
|
||||
led* new_led = new led();
|
||||
new_led->name = "LED " + std::to_string(i);
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
|
||||
@@ -246,7 +245,7 @@ void RGBController_CMRGBController::DeviceUpdateLEDs()
|
||||
|
||||
void RGBController_CMRGBController::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
cmrgb->SetLedsDirect(zones[zone].colors[0], zones[zone].colors[1], zones[zone].colors[2], zones[zone].colors[3]);
|
||||
controller->SetLedsDirect(zones[zone].colors[0], zones[zone].colors[1], zones[zone].colors[2], zones[zone].colors[3]);
|
||||
}
|
||||
|
||||
void RGBController_CMRGBController::UpdateSingleLED(int /*led*/)
|
||||
@@ -270,5 +269,5 @@ void RGBController_CMRGBController::DeviceUpdateMode()
|
||||
RGBColor color_1 = (modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC) ? modes[active_mode].colors[0] : 0;
|
||||
RGBColor color_2 = (modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC && modes[active_mode].colors.size() > 1) ? modes[active_mode].colors[1] : 0;
|
||||
|
||||
cmrgb->SetMode(modes[active_mode].value, modes[active_mode].speed, modes[active_mode].brightness, color_1, color_2);
|
||||
controller->SetMode(modes[active_mode].value, modes[active_mode].speed, modes[active_mode].brightness, color_1, color_2);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
class RGBController_CMRGBController : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CMRGBController(CMRGBController* cmrgb_ptr);
|
||||
RGBController_CMRGBController(CMRGBController* controller_ptr);
|
||||
~RGBController_CMRGBController();
|
||||
|
||||
void SetupZones();
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CMRGBController* cmrgb;
|
||||
CMRGBController* controller;
|
||||
void LoadConfigFromDeviceController(int device_mode);
|
||||
void ReadAllModeConfigsFromDevice();
|
||||
};
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
|
||||
#include "RGBController_CMSmallARGBController.h"
|
||||
|
||||
RGBController_CMSmallARGBController::RGBController_CMSmallARGBController(CMSmallARGBController *cmargb_ptr)
|
||||
RGBController_CMSmallARGBController::RGBController_CMSmallARGBController(CMSmallARGBController* controller_ptr)
|
||||
{
|
||||
cmargb = cmargb_ptr;
|
||||
unsigned char speed = cmargb->GetLedSpeed();
|
||||
controller = controller_ptr;
|
||||
unsigned char speed = controller->GetLedSpeed();
|
||||
|
||||
name = small_argb_header_data[cmargb->GetZoneIndex()].name;
|
||||
name = small_argb_header_data[controller->GetZoneIndex()].name;
|
||||
vendor = "Cooler Master";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
description = cmargb->GetDeviceName();
|
||||
description = controller->GetDeviceName();
|
||||
version = "2.0 for FW0012";
|
||||
serial = cmargb->GetSerial();
|
||||
location = cmargb->GetLocation();
|
||||
serial = controller->GetSerial();
|
||||
location = controller->GetLocation();
|
||||
|
||||
mode Off;
|
||||
Off.name = "Turn Off";
|
||||
@@ -137,34 +137,38 @@ RGBController_CMSmallARGBController::RGBController_CMSmallARGBController(CMSmall
|
||||
Init_Controller(); //Only processed on first run
|
||||
SetupZones();
|
||||
|
||||
int temp_mode = cmargb->GetMode();
|
||||
int temp_mode = controller->GetMode();
|
||||
|
||||
for(std::size_t mode_idx = 0; mode_idx < modes.size() ; mode_idx++)
|
||||
{
|
||||
if (temp_mode == modes[mode_idx].value)
|
||||
{
|
||||
active_mode = mode_idx;
|
||||
active_mode = mode_idx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (modes[active_mode].flags & MODE_FLAG_HAS_MODE_SPECIFIC_COLOR)
|
||||
{
|
||||
modes[active_mode].colors[0] = ToRGBColor(cmargb->GetLedRed(), cmargb->GetLedGreen(), cmargb->GetLedBlue());
|
||||
modes[active_mode].colors[0] = ToRGBColor(controller->GetLedRed(), controller->GetLedGreen(), controller->GetLedBlue());
|
||||
}
|
||||
modes[active_mode].color_mode = (cmargb->GetRandomColours()) ? MODE_COLORS_RANDOM : MODE_COLORS_MODE_SPECIFIC;
|
||||
|
||||
modes[active_mode].color_mode = (controller->GetRandomColours()) ? MODE_COLORS_RANDOM : MODE_COLORS_MODE_SPECIFIC;
|
||||
|
||||
if (modes[active_mode].flags & MODE_FLAG_HAS_SPEED)
|
||||
{
|
||||
modes[active_mode].speed = cmargb->GetLedSpeed();
|
||||
modes[active_mode].speed = controller->GetLedSpeed();
|
||||
}
|
||||
}
|
||||
|
||||
RGBController_CMSmallARGBController::~RGBController_CMSmallARGBController()
|
||||
{
|
||||
delete cmargb;
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CMSmallARGBController::Init_Controller()
|
||||
{
|
||||
int zone_idx = cmargb->GetZoneIndex();
|
||||
int zone_idx = controller->GetZoneIndex();
|
||||
int zone_led_count = 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
|
||||
|
||||
@@ -195,7 +199,7 @@ void RGBController_CMSmallARGBController::SetupZones()
|
||||
|
||||
if (!boolSingleLED)
|
||||
{
|
||||
cmargb->SetLedCount(small_argb_header_data[zone_idx].header, zones[zone_idx].leds_count);
|
||||
controller->SetLedCount(small_argb_header_data[zone_idx].header, zones[zone_idx].leds_count);
|
||||
}
|
||||
|
||||
for(unsigned int lp_idx = 0; lp_idx < zones[zone_idx].leds_count; lp_idx++)
|
||||
@@ -249,7 +253,7 @@ void RGBController_CMSmallARGBController::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
if(serial >= CM_SMALL_ARGB_FW0012)
|
||||
{
|
||||
cmargb->SetLedsDirect( zones[zone].colors, zones[zone].leds_count );
|
||||
controller->SetLedsDirect( zones[zone].colors, zones[zone].leds_count );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,13 +264,16 @@ void RGBController_CMSmallARGBController::UpdateSingleLED(int led)
|
||||
|
||||
void RGBController_CMSmallARGBController::SetCustomMode()
|
||||
{
|
||||
active_mode = CM_SMALL_ARGB_MODE_DIRECT; //The small ARGB may not support "Direct" mode
|
||||
/*-------------------------------------------------*\
|
||||
| The small ARGB may not support "Direct" mode |
|
||||
\*-------------------------------------------------*/
|
||||
active_mode = CM_SMALL_ARGB_MODE_DIRECT;
|
||||
}
|
||||
|
||||
void RGBController_CMSmallARGBController::DeviceUpdateMode()
|
||||
{
|
||||
bool random_colours = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
|
||||
bool random_colours = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
|
||||
RGBColor colour = (modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC) ? modes[active_mode].colors[0] : 0;
|
||||
|
||||
cmargb->SetMode( modes[active_mode].value, modes[active_mode].speed, modes[active_mode].brightness, colour, random_colours);
|
||||
controller->SetMode( modes[active_mode].value, modes[active_mode].speed, modes[active_mode].brightness, colour, random_colours);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
class RGBController_CMSmallARGBController : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CMSmallARGBController(CMSmallARGBController* cmargb_ptr);
|
||||
RGBController_CMSmallARGBController(CMSmallARGBController* controller_ptr);
|
||||
~RGBController_CMSmallARGBController();
|
||||
|
||||
void SetupZones();
|
||||
@@ -36,5 +36,5 @@ private:
|
||||
void Init_Controller();
|
||||
int GetDeviceMode();
|
||||
|
||||
CMSmallARGBController* cmargb;
|
||||
CMSmallARGBController* controller;
|
||||
};
|
||||
|
||||
@@ -1,125 +1,125 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_CorsairCapellix.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for Corsair |
|
||||
| Commander Core |
|
||||
| |
|
||||
| Jeff P. |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_CorsairCommanderCore.h"
|
||||
|
||||
RGBController_CorsairCommanderCore::RGBController_CorsairCommanderCore(CorsairCommanderCoreController* corsair_ptr)
|
||||
{
|
||||
corsair = corsair_ptr;
|
||||
|
||||
vendor = "Corsair";
|
||||
description = "Corsair Commander Core";
|
||||
type = DEVICE_TYPE_COOLER;
|
||||
location = corsair->GetLocationString();
|
||||
|
||||
SetupZones();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
RGBController_CorsairCommanderCore::~RGBController_CorsairCommanderCore()
|
||||
{
|
||||
delete corsair;
|
||||
}
|
||||
|
||||
void RGBController_CorsairCommanderCore::SetupZones()
|
||||
{
|
||||
std::atomic<bool> first_run;
|
||||
first_run = 0;
|
||||
|
||||
if(zones.size() == 0)
|
||||
{
|
||||
first_run = 1;
|
||||
}
|
||||
|
||||
zones.resize(7);
|
||||
zones[0].name = "Pump";
|
||||
zones[0].type = ZONE_TYPE_LINEAR;
|
||||
zones[0].leds_min = 0;
|
||||
zones[0].leds_max = 29;
|
||||
|
||||
for(unsigned int i = 1; i < (CORSAIR_COMMANDER_CORE_NUM_CHANNELS + 1); i++)
|
||||
{
|
||||
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;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[i].leds_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
|
||||
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);
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairCommanderCore::ResizeZone(int zone, int new_size)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_CorsairCommanderCore::DeviceUpdateLEDs()
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
}
|
||||
|
||||
void RGBController_CorsairCommanderCore::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CorsairCommanderCore::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CorsairCommanderCore::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_CorsairCommanderCore::DeviceUpdateMode()
|
||||
{
|
||||
switch(modes[active_mode].value)
|
||||
{
|
||||
case CORSAIR_COMMANDER_CORE_MODE_DIRECT:
|
||||
corsair->SetDirectColor(colors, zones);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_CorsairCapellix.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for Corsair |
|
||||
| Commander Core |
|
||||
| |
|
||||
| Jeff P. |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_CorsairCommanderCore.h"
|
||||
|
||||
RGBController_CorsairCommanderCore::RGBController_CorsairCommanderCore(CorsairCommanderCoreController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
vendor = "Corsair";
|
||||
description = "Corsair Commander Core";
|
||||
type = DEVICE_TYPE_COOLER;
|
||||
location = controller->GetLocationString();
|
||||
|
||||
SetupZones();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
RGBController_CorsairCommanderCore::~RGBController_CorsairCommanderCore()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CorsairCommanderCore::SetupZones()
|
||||
{
|
||||
std::atomic<bool> first_run;
|
||||
first_run = 0;
|
||||
|
||||
if(zones.size() == 0)
|
||||
{
|
||||
first_run = 1;
|
||||
}
|
||||
|
||||
zones.resize(7);
|
||||
zones[0].name = "Pump";
|
||||
zones[0].type = ZONE_TYPE_LINEAR;
|
||||
zones[0].leds_min = 0;
|
||||
zones[0].leds_max = 29;
|
||||
|
||||
for(unsigned int i = 1; i < (CORSAIR_COMMANDER_CORE_NUM_CHANNELS + 1); i++)
|
||||
{
|
||||
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;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[i].leds_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
|
||||
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);
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CorsairCommanderCore::ResizeZone(int zone, int new_size)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_CorsairCommanderCore::DeviceUpdateLEDs()
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
}
|
||||
|
||||
void RGBController_CorsairCommanderCore::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CorsairCommanderCore::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CorsairCommanderCore::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_CorsairCommanderCore::DeviceUpdateMode()
|
||||
{
|
||||
switch(modes[active_mode].value)
|
||||
{
|
||||
case CORSAIR_COMMANDER_CORE_MODE_DIRECT:
|
||||
controller->SetDirectColor(colors, zones);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_CorsairCapellix.h |
|
||||
| |
|
||||
| Generic RGB Interface for Corsair |
|
||||
| Commander Core |
|
||||
| |
|
||||
| Jeff P. |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "CorsairCommanderCoreController.h"
|
||||
|
||||
class RGBController_CorsairCommanderCore : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CorsairCommanderCore(CorsairCommanderCoreController* corsair_ptr);
|
||||
~RGBController_CorsairCommanderCore();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CorsairCommanderCoreController* corsair;
|
||||
std::vector<int> fanleds{0};
|
||||
};
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_CorsairCapellix.h |
|
||||
| |
|
||||
| Generic RGB Interface for Corsair |
|
||||
| Commander Core |
|
||||
| |
|
||||
| Jeff P. |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "CorsairCommanderCoreController.h"
|
||||
|
||||
class RGBController_CorsairCommanderCore : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CorsairCommanderCore(CorsairCommanderCoreController* controller_ptr);
|
||||
~RGBController_CorsairCommanderCore();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CorsairCommanderCoreController* controller;
|
||||
std::vector<int> fanleds{0};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user