Code cleanup round 5

This commit is contained in:
Adam Honse 2022-01-18 22:35:13 -06:00
parent e448143377
commit a219ac693c
21 changed files with 815 additions and 808 deletions

View file

@ -6,17 +6,15 @@
#include "RGBController_HPOmen30L.h"
RGBController_HPOmen30L::RGBController_HPOmen30L(HPOmen30LController* omen_ptr)
RGBController_HPOmen30L::RGBController_HPOmen30L(HPOmen30LController* controller_ptr)
{
omen = omen_ptr;
controller = controller_ptr;
name = "HP Omen 30L";
vendor = "HP";
type = DEVICE_TYPE_MOTHERBOARD;
description = "HP Omen 30L Device";
version = "";
location = omen->GetLocationString();
serial = "";
location = controller->GetLocationString();
mode Direct;
Direct.name = "Direct";
@ -91,7 +89,7 @@ RGBController_HPOmen30L::RGBController_HPOmen30L(HPOmen30LController* omen_ptr)
RGBController_HPOmen30L::~RGBController_HPOmen30L()
{
delete omen;
delete controller;
}
void RGBController_HPOmen30L::SetupZones()
@ -109,12 +107,12 @@ void RGBController_HPOmen30L::SetupZones()
zones.push_back(logo_zone);
zone light_bar;
light_bar.name = "Light Bar";
light_bar.type = ZONE_TYPE_SINGLE;
light_bar.leds_min = 1;
light_bar.leds_max = 1;
light_bar.leds_count = 1;
light_bar.matrix_map = NULL;
light_bar.name = "Light Bar";
light_bar.type = ZONE_TYPE_SINGLE;
light_bar.leds_min = 1;
light_bar.leds_max = 1;
light_bar.leds_count = 1;
light_bar.matrix_map = NULL;
zones.push_back(light_bar);
zone ring_zone;
@ -127,31 +125,31 @@ void RGBController_HPOmen30L::SetupZones()
zones.push_back(ring_zone);
zone cpu_zone;
cpu_zone.name = "CPU Cooler";
cpu_zone.type = ZONE_TYPE_SINGLE;
cpu_zone.leds_min = 1;
cpu_zone.leds_max = 1;
cpu_zone.leds_count = 1;
cpu_zone.matrix_map = NULL;
cpu_zone.name = "CPU Cooler";
cpu_zone.type = ZONE_TYPE_SINGLE;
cpu_zone.leds_min = 1;
cpu_zone.leds_max = 1;
cpu_zone.leds_count = 1;
cpu_zone.matrix_map = NULL;
zones.push_back(cpu_zone);
/*---------------------------------------------------------*\
| Set up LEDs |
\*---------------------------------------------------------*/
led logo_led;
logo_led.name = "Logo LED";
logo_led.name = "Logo LED";
leds.push_back(logo_led);
led bar_led;
bar_led.name = "Bar LED";
bar_led.name = "Bar LED";
leds.push_back(bar_led);
led fan_led;
fan_led.name = "Fan LED";
fan_led.name = "Fan LED";
leds.push_back(fan_led);
led cpu_led;
cpu_led.name = "CPU LED";
cpu_led.name = "CPU LED";
leds.push_back(cpu_led);
SetupColors();
@ -170,18 +168,18 @@ void RGBController_HPOmen30L::DeviceUpdateLEDs()
{
if(modes[active_mode].value == HP_OMEN_30L_STATIC || modes[active_mode].value == HP_OMEN_30L_DIRECT)
{
omen->SetZoneColor(i, colors);
controller->SetZoneColor(i, colors);
}
else
{
omen->SetZoneColor(i, modes[active_mode].colors);
controller->SetZoneColor(i, modes[active_mode].colors);
}
}
}
void RGBController_HPOmen30L::UpdateZoneLEDs(int zone)
{
omen->SetZoneColor(zone,colors);
controller->SetZoneColor(zone,colors);
}
void RGBController_HPOmen30L::UpdateSingleLED(int led)
@ -198,7 +196,7 @@ void RGBController_HPOmen30L::DeviceUpdateMode()
{
for(int i = 0; i < zones.size(); i++)
{
omen->SetZoneMode(i, modes[active_mode].value, modes[active_mode].speed, modes[active_mode].brightness);
controller->SetZoneMode(i, modes[active_mode].value, modes[active_mode].speed, modes[active_mode].brightness);
}
DeviceUpdateLEDs();

View file

@ -12,7 +12,7 @@
class RGBController_HPOmen30L : public RGBController
{
public:
RGBController_HPOmen30L(HPOmen30LController* omen_ptr);
RGBController_HPOmen30L(HPOmen30LController* controller_ptr);
~RGBController_HPOmen30L();
void SetupZones();
@ -27,5 +27,5 @@ public:
void DeviceUpdateMode();
private:
HPOmen30LController* omen;
HPOmen30LController* controller;
};

View file

@ -23,11 +23,13 @@
void DetectHoltekControllers(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
HoltekA070Controller* controller = new HoltekA070Controller(dev, info->path);
HoltekA070Controller* controller = new HoltekA070Controller(dev, info->path);
RGBController_HoltekA070* rgb_controller = new RGBController_HoltekA070(controller);
rgb_controller->name = name;
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
} /* DetectHoltekControllers() */
@ -35,14 +37,16 @@ void DetectHoltekControllers(hid_device_info* info, const std::string& name)
void DetectHoltekMousemats(hid_device_info *info, const std::string &name)
{
hid_device *dev = hid_open_path(info->path);
if (dev)
if(dev)
{
HoltekA1FAController *controller = new HoltekA1FAController(dev, info->path);
RGBController_HoltekA1FA *rgb_controller = new RGBController_HoltekA1FA(controller);
rgb_controller->name = name;
HoltekA1FAController* controller = new HoltekA1FAController(dev, info->path);
RGBController_HoltekA1FA* rgb_controller = new RGBController_HoltekA1FA(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
} /* DetectHoltekMousemats() */
REGISTER_HID_DETECTOR_IPU("Holtek USB Gaming Mouse", DetectHoltekControllers, HOLTEK_VID, HOLTEK_A070_PID, 1, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Holtek Mousemat", DetectHoltekMousemats, HOLTEK_VID, HOLTEK_A1FA_PID, 2, 0xFF00, 0xFF00);
REGISTER_HID_DETECTOR_IPU("Holtek Mousemat", DetectHoltekMousemats, HOLTEK_VID, HOLTEK_A1FA_PID, 2, 0xFF00, 0xFF00);

View file

@ -8,16 +8,16 @@
#include "RGBController_HoltekA070.h"
RGBController_HoltekA070::RGBController_HoltekA070(HoltekA070Controller* holtek_ptr)
RGBController_HoltekA070::RGBController_HoltekA070(HoltekA070Controller* controller_ptr)
{
holtek = holtek_ptr;
controller = controller_ptr;
name = "Holtek USB Gaming Mouse Device";
vendor = "Holtek";
type = DEVICE_TYPE_MOUSE;
description = "Holtek USB Gaming Mouse Device";
location = holtek->GetDeviceLocation();
serial = holtek->GetSerialString();
location = controller->GetDeviceLocation();
serial = controller->GetSerialString();
mode Static;
Static.name = "Static";
@ -40,22 +40,22 @@ RGBController_HoltekA070::RGBController_HoltekA070(HoltekA070Controller* holtek_
RGBController_HoltekA070::~RGBController_HoltekA070()
{
delete holtek;
delete controller;
}
void RGBController_HoltekA070::SetupZones()
{
zone mouse_zone;
mouse_zone.name = "Mouse";
mouse_zone.type = ZONE_TYPE_SINGLE;
mouse_zone.leds_min = 1;
mouse_zone.leds_max = 1;
mouse_zone.leds_count = 1;
mouse_zone.matrix_map = NULL;
mouse_zone.name = "Mouse";
mouse_zone.type = ZONE_TYPE_SINGLE;
mouse_zone.leds_min = 1;
mouse_zone.leds_max = 1;
mouse_zone.leds_count = 1;
mouse_zone.matrix_map = NULL;
zones.push_back(mouse_zone);
led mouse_led;
mouse_led.name = "Mouse";
mouse_led.name = "Mouse";
leds.push_back(mouse_led);
SetupColors();
@ -70,11 +70,11 @@ void RGBController_HoltekA070::ResizeZone(int /*zone*/, int /*new_size*/)
void RGBController_HoltekA070::DeviceUpdateLEDs()
{
unsigned char red = RGBGetRValue(colors[0]);
unsigned char red = RGBGetRValue(colors[0]);
unsigned char green = RGBGetGValue(colors[0]);
unsigned char blue = RGBGetBValue(colors[0]);
unsigned char blue = RGBGetBValue(colors[0]);
holtek->SendCustomColor(red, green, blue);
controller->SendCustomColor(red, green, blue);
}
void RGBController_HoltekA070::UpdateZoneLEDs(int /*zone*/)
@ -94,5 +94,5 @@ void RGBController_HoltekA070::SetCustomMode()
void RGBController_HoltekA070::DeviceUpdateMode()
{
holtek->SendMode(modes[active_mode].speed);
controller->SendMode(modes[active_mode].speed);
}

View file

@ -13,7 +13,7 @@
class RGBController_HoltekA070 : public RGBController
{
public:
RGBController_HoltekA070(HoltekA070Controller* holtek_ptr);
RGBController_HoltekA070(HoltekA070Controller* controller_ptr);
~RGBController_HoltekA070();
void SetupZones();
@ -27,5 +27,5 @@ public:
void DeviceUpdateMode();
private:
HoltekA070Controller* holtek;
HoltekA070Controller* controller;
};

View file

@ -8,16 +8,16 @@
#include "RGBController_HoltekA1FA.h"
RGBController_HoltekA1FA::RGBController_HoltekA1FA(HoltekA1FAController* holtek_ptr)
RGBController_HoltekA1FA::RGBController_HoltekA1FA(HoltekA1FAController* controller_ptr)
{
holtek = holtek_ptr;
controller = controller_ptr;
name = "Holtek Mousemat Device";
vendor = "Holtek";
type = DEVICE_TYPE_MOUSEMAT;
description = "Holtek Mousemat Device";
location = holtek->GetDeviceLocation();
serial = holtek->GetSerialString();
location = controller->GetDeviceLocation();
serial = controller->GetSerialString();
mode Static;
Static.name = "Static";
@ -68,22 +68,22 @@ RGBController_HoltekA1FA::RGBController_HoltekA1FA(HoltekA1FAController* holtek_
RGBController_HoltekA1FA::~RGBController_HoltekA1FA()
{
delete holtek;
delete controller;
}
void RGBController_HoltekA1FA::SetupZones()
{
zone mouse_zone;
mouse_zone.name = "Mousemat";
mouse_zone.type = ZONE_TYPE_SINGLE;
mouse_zone.leds_min = 1;
mouse_zone.leds_max = 1;
mouse_zone.leds_count = 1;
mouse_zone.matrix_map = NULL;
mouse_zone.name = "Mousemat";
mouse_zone.type = ZONE_TYPE_SINGLE;
mouse_zone.leds_min = 1;
mouse_zone.leds_max = 1;
mouse_zone.leds_count = 1;
mouse_zone.matrix_map = NULL;
zones.push_back(mouse_zone);
led mouse_led;
mouse_led.name = "Mousemat";
mouse_led.name = "Mousemat";
leds.push_back(mouse_led);
SetupColors();
@ -106,7 +106,7 @@ void RGBController_HoltekA1FA::DeviceUpdateLEDs()
unsigned char green = RGBGetGValue(colors[0]);
unsigned char blue = RGBGetBValue(colors[0]);
holtek->SendData(mode, brightness, speed, preset, red, green, blue);
controller->SendData(mode, brightness, speed, preset, red, green, blue);
}
void RGBController_HoltekA1FA::UpdateZoneLEDs(int /*zone*/)

View file

@ -13,7 +13,7 @@
class RGBController_HoltekA1FA : public RGBController
{
public:
RGBController_HoltekA1FA(HoltekA1FAController* holtek_ptr);
RGBController_HoltekA1FA(HoltekA1FAController* controller_ptr);
~RGBController_HoltekA1FA();
int previous_mode = 0; /* previous mode */
@ -29,5 +29,5 @@ public:
void DeviceUpdateMode();
private:
HoltekA1FAController* holtek;
HoltekA1FAController* controller;
};

View file

@ -61,14 +61,11 @@ bool TestForHyperXDRAMController(i2c_smbus_interface* bus, unsigned char address
void DetectHyperXDRAMControllers(std::vector<i2c_smbus_interface*> &busses)
{
HyperXDRAMController* new_hyperx;
RGBController_HyperXDRAM* new_controller;
for (unsigned int bus = 0; bus < busses.size(); bus++)
for(unsigned int bus = 0; bus < busses.size(); bus++)
{
unsigned char slots_valid = 0x00;
bool fury_detected = false;
bool pred_detected = false;
unsigned char slots_valid = 0x00;
bool fury_detected = false;
bool pred_detected = false;
LOG_DEBUG("[%s] Checking VID/PID on bus %d...", HYPERX_CONTROLLER_NAME, bus);
@ -76,7 +73,8 @@ void DetectHyperXDRAMControllers(std::vector<i2c_smbus_interface*> &busses)
{
// Check for HyperX controller at 0x27
LOG_DEBUG("[%s] Testing bus %d at address 0x27", HYPERX_CONTROLLER_NAME, bus);
if (TestForHyperXDRAMController(busses[bus], 0x27))
if(TestForHyperXDRAMController(busses[bus], 0x27))
{
busses[bus]->i2c_smbus_write_byte_data(0x37, 0x00, 0xFF);
@ -113,8 +111,6 @@ void DetectHyperXDRAMControllers(std::vector<i2c_smbus_interface*> &busses)
LOG_DEBUG("[%s] SPD check failed", HYPERX_CONTROLLER_NAME);
}
std::this_thread::sleep_for(1ms);
}
@ -123,19 +119,19 @@ void DetectHyperXDRAMControllers(std::vector<i2c_smbus_interface*> &busses)
if(slots_valid != 0)
{
new_hyperx = new HyperXDRAMController(busses[bus], 0x27, slots_valid);
new_controller = new RGBController_HyperXDRAM(new_hyperx);
HyperXDRAMController* controller = new HyperXDRAMController(busses[bus], 0x27, slots_valid);
RGBController_HyperXDRAM* rgb_controller = new RGBController_HyperXDRAM(controller);
if(fury_detected && !pred_detected)
{
new_controller->name = "HyperX Fury RGB";
rgb_controller->name = "HyperX Fury RGB";
}
else if(!fury_detected && pred_detected)
{
new_controller->name = "HyperX Predator RGB";
rgb_controller->name = "HyperX Predator RGB";
}
ResourceManager::get()->RegisterRGBController(new_controller);
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
}

View file

@ -10,15 +10,15 @@
#include "RGBController_HyperXDRAM.h"
RGBController_HyperXDRAM::RGBController_HyperXDRAM(HyperXDRAMController* hyperx_ptr)
RGBController_HyperXDRAM::RGBController_HyperXDRAM(HyperXDRAMController* controller_ptr)
{
hyperx = hyperx_ptr;
controller = controller_ptr;
name = "HyperX DRAM";
vendor = "HyperX";
type = DEVICE_TYPE_DRAM;
description = "HyperX DRAM Device";
location = hyperx->GetDeviceLocation();
location = controller->GetDeviceLocation();
mode Direct;
Direct.name = "Direct";
@ -127,14 +127,14 @@ RGBController_HyperXDRAM::RGBController_HyperXDRAM(HyperXDRAMController* hyperx_
RGBController_HyperXDRAM::~RGBController_HyperXDRAM()
{
delete hyperx;
delete controller;
}
void RGBController_HyperXDRAM::SetupZones()
{
for(unsigned int slot = 0; slot < hyperx->GetSlotCount(); slot++)
for(unsigned int slot = 0; slot < controller->GetSlotCount(); slot++)
{
zone* new_zone = new zone;
zone* new_zone = new zone;
new_zone->name = "HyperX Slot ";
new_zone->name.append(std::to_string(slot + 1));
@ -151,14 +151,14 @@ void RGBController_HyperXDRAM::SetupZones()
{
for(std::size_t led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
{
led* new_led = new led();
led* new_led = new led();
new_led->name = "HyperX Slot ";
new_led->name = "HyperX Slot ";
new_led->name.append(std::to_string(zone_idx + 1));
new_led->name.append(", LED ");
new_led->name.append(std::to_string(led_idx + 1));
new_led->value = leds.size();
new_led->value = leds.size();
leds.push_back(*new_led);
}
@ -176,48 +176,52 @@ void RGBController_HyperXDRAM::ResizeZone(int /*zone*/, int /*new_size*/)
void RGBController_HyperXDRAM::DeviceUpdateLEDs()
{
if(hyperx->GetMode() == HYPERX_MODE_DIRECT)
if(controller->GetMode() == HYPERX_MODE_DIRECT)
{
for (std::size_t led_idx = 0; led_idx < colors.size(); led_idx++ )
{
RGBColor color = colors[led_idx];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
hyperx->SetLEDColor(led_idx, red, grn, blu);
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
controller->SetLEDColor(led_idx, red, grn, blu);
}
hyperx->SendApply();
controller->SendApply();
}
else
{
unsigned char red = RGBGetRValue(colors[0]);
unsigned char grn = RGBGetGValue(colors[0]);
unsigned char blu = RGBGetBValue(colors[0]);
hyperx->SetEffectColor(red, grn, blu);
controller->SetEffectColor(red, grn, blu);
}
}
void RGBController_HyperXDRAM::UpdateZoneLEDs(int zone)
{
if(hyperx->GetMode() == HYPERX_MODE_DIRECT)
if(controller->GetMode() == HYPERX_MODE_DIRECT)
{
for (std::size_t led_idx = 0; led_idx < zones[zone].leds_count; led_idx++ )
{
unsigned int led = zones[zone].leds[led_idx].value;
RGBColor color = colors[led];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
hyperx->SetLEDColor(led, red, grn, blu);
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
controller->SetLEDColor(led, red, grn, blu);
}
hyperx->SendApply();
controller->SendApply();
}
else
{
unsigned char red = RGBGetRValue(colors[0]);
unsigned char grn = RGBGetGValue(colors[0]);
unsigned char blu = RGBGetBValue(colors[0]);
hyperx->SetEffectColor(red, grn, blu);
controller->SetEffectColor(red, grn, blu);
}
}
@ -228,15 +232,15 @@ void RGBController_HyperXDRAM::UpdateSingleLED(int led)
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
if(hyperx->GetMode() == HYPERX_MODE_DIRECT)
if(controller->GetMode() == HYPERX_MODE_DIRECT)
{
hyperx->SetLEDColor(led, red, grn, blu);
controller->SetLEDColor(led, red, grn, blu);
}
else
{
hyperx->SetEffectColor(red, grn, blu);
controller->SetEffectColor(red, grn, blu);
}
hyperx->SendApply();
controller->SendApply();
}
void RGBController_HyperXDRAM::SetCustomMode()
@ -248,7 +252,7 @@ void RGBController_HyperXDRAM::DeviceUpdateMode()
{
bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
hyperx->SetMode(modes[active_mode].value, random, modes[active_mode].speed);
controller->SetMode(modes[active_mode].value, random, modes[active_mode].speed);
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
{
@ -256,7 +260,7 @@ void RGBController_HyperXDRAM::DeviceUpdateMode()
unsigned char grn = RGBGetGValue(modes[active_mode].colors[0]);
unsigned char blu = RGBGetBValue(modes[active_mode].colors[0]);
hyperx->SetEffectColor(red, grn, blu);
controller->SetEffectColor(red, grn, blu);
}
}

View file

@ -15,7 +15,7 @@
class RGBController_HyperXDRAM : public RGBController
{
public:
RGBController_HyperXDRAM(HyperXDRAMController* hyperx_ptr);
RGBController_HyperXDRAM(HyperXDRAMController* controller_ptr);
~RGBController_HyperXDRAM();
void SetupZones();
@ -30,5 +30,5 @@ public:
void DeviceUpdateMode();
private:
HyperXDRAMController* hyperx;
HyperXDRAMController* controller;
};

View file

@ -33,7 +33,8 @@ void DetectHyperXAlloyElite(hid_device_info* info, const std::string& name)
{
HyperXAlloyEliteController* controller = new HyperXAlloyEliteController(dev, info->path);
RGBController_HyperXAlloyElite* rgb_controller = new RGBController_HyperXAlloyElite(controller);
rgb_controller->name = name;
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
@ -46,7 +47,8 @@ void DetectHyperXAlloyElite2(hid_device_info* info, const std::string& name)
{
HyperXAlloyElite2Controller* controller = new HyperXAlloyElite2Controller(dev, info->path);
RGBController_HyperXAlloyElite2* rgb_controller = new RGBController_HyperXAlloyElite2(controller);
rgb_controller->name = name;
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
@ -57,9 +59,10 @@ void DetectHyperXAlloyFPS(hid_device_info* info, const std::string& name)
if(dev)
{
HyperXAlloyFPSController* controller = new HyperXAlloyFPSController(dev, info->path);
HyperXAlloyFPSController* controller = new HyperXAlloyFPSController(dev, info->path);
RGBController_HyperXAlloyFPS* rgb_controller = new RGBController_HyperXAlloyFPS(controller);
rgb_controller->name = name;
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
@ -72,7 +75,8 @@ void DetectHyperXAlloyOrigins(hid_device_info* info, const std::string& name)
{
HyperXAlloyOriginsController* controller = new HyperXAlloyOriginsController(dev, info->path);
RGBController_HyperXAlloyOrigins* rgb_controller = new RGBController_HyperXAlloyOrigins(controller);
rgb_controller->name = name;
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
@ -85,7 +89,8 @@ void DetectHyperXAlloyOriginsCore(hid_device_info* info, const std::string& name
{
HyperXAlloyOriginsCoreController* controller = new HyperXAlloyOriginsCoreController(dev, info);
RGBController_HyperXAlloyOriginsCore* rgb_controller = new RGBController_HyperXAlloyOriginsCore(controller);
rgb_controller->name = name;
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}

View file

@ -175,9 +175,9 @@ static const char *led_names[] =
"Key: Media Mute"
};
RGBController_HyperXAlloyElite::RGBController_HyperXAlloyElite(HyperXAlloyEliteController* hyperx_ptr)
RGBController_HyperXAlloyElite::RGBController_HyperXAlloyElite(HyperXAlloyEliteController* controller_ptr)
{
controller = hyperx_ptr;
controller = controller_ptr;
name = "HyperX Alloy Elite";
vendor = "HyperX";
@ -290,7 +290,7 @@ void RGBController_HyperXAlloyElite::SetupZones()
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
{
led new_led;
new_led.name = led_names[led_idx];
new_led.name = led_names[led_idx];
leds.push_back(new_led);
}

View file

@ -18,7 +18,7 @@
class RGBController_HyperXAlloyElite : public RGBController
{
public:
RGBController_HyperXAlloyElite(HyperXAlloyEliteController* hyperx_ptr);
RGBController_HyperXAlloyElite(HyperXAlloyEliteController* controller_ptr);
~RGBController_HyperXAlloyElite();
void SetupZones();

View file

@ -192,16 +192,16 @@ static const char *led_names[] =
"RGB Strip 18",
};
RGBController_HyperXAlloyElite2::RGBController_HyperXAlloyElite2(HyperXAlloyElite2Controller* hyperx_ptr)
RGBController_HyperXAlloyElite2::RGBController_HyperXAlloyElite2(HyperXAlloyElite2Controller* controller_ptr)
{
hyperx = hyperx_ptr;
controller = controller_ptr;
name = "HyperX Alloy Elite 2 Keyboard Device";
vendor = "HyperX";
type = DEVICE_TYPE_KEYBOARD;
description = "HyperX Alloy Elite 2 Keyboard Device";
location = hyperx->GetDeviceLocation();
serial = hyperx->GetSerialString();
location = controller->GetDeviceLocation();
serial = controller->GetSerialString();
mode Direct;
Direct.name = "Direct";
@ -239,7 +239,7 @@ RGBController_HyperXAlloyElite2::~RGBController_HyperXAlloyElite2()
}
}
delete hyperx;
delete controller;
}
void RGBController_HyperXAlloyElite2::SetupZones()
@ -277,7 +277,7 @@ void RGBController_HyperXAlloyElite2::SetupZones()
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
{
led new_led;
new_led.name = led_names[led_idx];
new_led.name = led_names[led_idx];
leds.push_back(new_led);
}
@ -297,7 +297,7 @@ void RGBController_HyperXAlloyElite2::DeviceUpdateLEDs()
if(active_mode == 0)
{
hyperx->SetLEDsDirect(colors);
controller->SetLEDsDirect(colors);
}
}

View file

@ -18,7 +18,7 @@
class RGBController_HyperXAlloyElite2 : public RGBController
{
public:
RGBController_HyperXAlloyElite2(HyperXAlloyElite2Controller* hyperx_ptr);
RGBController_HyperXAlloyElite2(HyperXAlloyElite2Controller* controller_ptr);
~RGBController_HyperXAlloyElite2();
void SetupZones();
@ -35,7 +35,7 @@ public:
void KeepaliveThreadFunction();
private:
HyperXAlloyElite2Controller* hyperx;
HyperXAlloyElite2Controller* controller;
std::atomic<bool> keepalive_thread_run;
std::thread* keepalive_thread;
std::chrono::time_point<std::chrono::steady_clock> last_update_time;

View file

@ -147,9 +147,9 @@ static const char *led_names[] =
"Key: Number Pad ."
};
RGBController_HyperXAlloyFPS::RGBController_HyperXAlloyFPS(HyperXAlloyFPSController* hyperx_ptr)
RGBController_HyperXAlloyFPS::RGBController_HyperXAlloyFPS(HyperXAlloyFPSController* controller_ptr)
{
controller = hyperx_ptr;
controller = controller_ptr;
name = "HyperX Alloy FPS";
vendor = "HyperX";
@ -231,7 +231,7 @@ void RGBController_HyperXAlloyFPS::SetupZones()
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
{
led new_led;
new_led.name = led_names[led_idx];
new_led.name = led_names[led_idx];
leds.push_back(new_led);
}

View file

@ -18,7 +18,7 @@
class RGBController_HyperXAlloyFPS : public RGBController
{
public:
RGBController_HyperXAlloyFPS(HyperXAlloyFPSController* hyperx_ptr);
RGBController_HyperXAlloyFPS(HyperXAlloyFPSController* controller_ptr);
~RGBController_HyperXAlloyFPS();
void SetupZones();

View file

@ -167,16 +167,16 @@ static const char *led_names[] =
"Key: Number Pad Enter",
};
RGBController_HyperXAlloyOrigins::RGBController_HyperXAlloyOrigins(HyperXAlloyOriginsController* hyperx_ptr)
RGBController_HyperXAlloyOrigins::RGBController_HyperXAlloyOrigins(HyperXAlloyOriginsController* controller_ptr)
{
hyperx = hyperx_ptr;
controller = controller_ptr;
name = "HyperX Alloy Origins Keyboard Device";
vendor = "HyperX";
type = DEVICE_TYPE_KEYBOARD;
description = "HyperX Alloy Origins Keyboard Device";
location = hyperx->GetDeviceLocation();
serial = hyperx->GetSerialString();
location = controller->GetDeviceLocation();
serial = controller->GetSerialString();
mode Direct;
Direct.name = "Direct";
@ -214,7 +214,7 @@ RGBController_HyperXAlloyOrigins::~RGBController_HyperXAlloyOrigins()
}
}
delete hyperx;
delete controller;
}
void RGBController_HyperXAlloyOrigins::SetupZones()
@ -268,7 +268,7 @@ void RGBController_HyperXAlloyOrigins::ResizeZone(int /*zone*/, int /*new_size*/
void RGBController_HyperXAlloyOrigins::DeviceUpdateLEDs()
{
hyperx->SetLEDsDirect(colors);
controller->SetLEDsDirect(colors);
}
void RGBController_HyperXAlloyOrigins::UpdateZoneLEDs(int /*zone*/)

View file

@ -16,7 +16,7 @@
class RGBController_HyperXAlloyOrigins : public RGBController
{
public:
RGBController_HyperXAlloyOrigins(HyperXAlloyOriginsController* hyperx_ptr);
RGBController_HyperXAlloyOrigins(HyperXAlloyOriginsController* controller_ptr);
~RGBController_HyperXAlloyOrigins();
void SetupZones();
@ -33,8 +33,8 @@ public:
void KeepaliveThread();
private:
HyperXAlloyOriginsController* hyperx;
std::thread* keepalive_thread;
std::atomic<bool> keepalive_thread_run;
HyperXAlloyOriginsController* controller;
std::thread* keepalive_thread;
std::atomic<bool> keepalive_thread_run;
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
};

View file

@ -145,17 +145,17 @@ static const char *led_names[] =
"Key: Right Arrow"
};
RGBController_HyperXAlloyOriginsCore::RGBController_HyperXAlloyOriginsCore(HyperXAlloyOriginsCoreController* hyperx_ptr)
RGBController_HyperXAlloyOriginsCore::RGBController_HyperXAlloyOriginsCore(HyperXAlloyOriginsCoreController* controller_ptr)
{
hyperx = hyperx_ptr;
controller = controller_ptr;
name = "HyperX Alloy Origins Core Keyboard Device";
vendor = "HyperX";
type = DEVICE_TYPE_KEYBOARD;
description = "HyperX Alloy Origins Core Keyboard Device";
location = hyperx->GetDeviceLocation();
serial = hyperx->GetSerialString();
version = hyperx->GetFirmwareVersion();
location = controller->GetDeviceLocation();
serial = controller->GetSerialString();
version = controller->GetFirmwareVersion();
mode Direct;
Direct.name = "Direct";
@ -193,7 +193,7 @@ RGBController_HyperXAlloyOriginsCore::~RGBController_HyperXAlloyOriginsCore()
}
}
delete hyperx;
delete controller;
}
void RGBController_HyperXAlloyOriginsCore::SetupZones()
@ -244,7 +244,7 @@ void RGBController_HyperXAlloyOriginsCore::ResizeZone(int /*zone*/, int /*new_si
void RGBController_HyperXAlloyOriginsCore::DeviceUpdateLEDs()
{
hyperx->SetLEDsDirect(colors);
controller->SetLEDsDirect(colors);
}
void RGBController_HyperXAlloyOriginsCore::UpdateZoneLEDs(int /*zone*/)

View file

@ -16,7 +16,7 @@
class RGBController_HyperXAlloyOriginsCore : public RGBController
{
public:
RGBController_HyperXAlloyOriginsCore(HyperXAlloyOriginsCoreController* hyperx_ptr);
RGBController_HyperXAlloyOriginsCore(HyperXAlloyOriginsCoreController* controller_ptr);
~RGBController_HyperXAlloyOriginsCore();
void SetupZones();
@ -33,7 +33,7 @@ public:
void KeepaliveThread();
private:
HyperXAlloyOriginsCoreController* hyperx;
HyperXAlloyOriginsCoreController* controller;
std::thread* keepalive_thread;
std::atomic<bool> keepalive_thread_run;
std::chrono::time_point<std::chrono::steady_clock> last_update_time;