Compare commits
294
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
623fdfe522 | ||
|
|
a122ccdc37 | ||
|
|
74219e502a | ||
|
|
73cd84f43c | ||
|
|
f5a8ecc3f4 | ||
|
|
86a6a130e7 | ||
|
|
703afac049 | ||
|
|
2d0ebb7279 | ||
|
|
d9b51e4a02 | ||
|
|
387fed4f79 | ||
|
|
df0137c2b0 | ||
|
|
7c059fa3e3 | ||
|
|
1a62db7246 | ||
|
|
3a0b93c774 | ||
|
|
1afe65d206 | ||
|
|
962754f379 | ||
|
|
e69c9eedae | ||
|
|
9182d1e566 | ||
|
|
893de3f076 | ||
|
|
4f1c623093 | ||
|
|
7846d22bd8 | ||
|
|
68ae9ef9d5 | ||
|
|
44641ca8a6 | ||
|
|
152f16b31c | ||
|
|
b87f7150fc | ||
|
|
831a7cf5eb | ||
|
|
f99843a550 | ||
|
|
35217bce51 | ||
|
|
00077347b4 | ||
|
|
b2c9ace9c8 | ||
|
|
fd7dbd618d | ||
|
|
103b5f27bb | ||
|
|
71c1ffe91c | ||
|
|
0154f3c5dc | ||
|
|
60bc375345 | ||
|
|
5a2dca1ced | ||
|
|
c80f3be283 | ||
|
|
52f757ced2 | ||
|
|
156b7d0f89 | ||
|
|
69a8c84b4d | ||
|
|
d30f3a5f03 | ||
|
|
2868f61766 | ||
|
|
5d1c990b18 | ||
|
|
e6eeb906b8 | ||
|
|
ea00807a06 | ||
|
|
95b1133395 | ||
|
|
d56a9133ab | ||
|
|
8c96bf03f5 | ||
|
|
79e546fa43 | ||
|
|
baed37ecc7 | ||
|
|
c0be211236 | ||
|
|
55506f984e | ||
|
|
d03ca67ae5 | ||
|
|
b7f8eeb034 | ||
|
|
e8e0362d85 | ||
|
|
e9f430d8ed | ||
|
|
a306cf815b | ||
|
|
7c0eba1dc3 | ||
|
|
5d20744653 | ||
|
|
7e74c295a3 | ||
|
|
d145ee38e7 | ||
|
|
0a39673b9d | ||
|
|
6e93443034 | ||
|
|
cb71627d29 | ||
|
|
35f10dfb48 | ||
|
|
04ef7a2c28 | ||
|
|
a58e79ba71 | ||
|
|
3a74c85be8 | ||
|
|
6e71cd39b9 | ||
|
|
248668ea7d | ||
|
|
496a7a3609 | ||
|
|
112b6a2b9b | ||
|
|
7c38dad1ab | ||
|
|
cd1c9c705b | ||
|
|
b7f68379c2 | ||
|
|
43c0fea3be | ||
|
|
39f112bb98 | ||
|
|
3d113dab3c | ||
|
|
92f397544b | ||
|
|
fe4ca34528 | ||
|
|
464ef419e7 | ||
|
|
30e35eb44c | ||
|
|
b92a8996e9 | ||
|
|
c887ea94ff | ||
|
|
25a753b97a | ||
|
|
a86ab2955a | ||
|
|
259e05360e | ||
|
|
36b4f52cbc | ||
|
|
ee6343900b | ||
|
|
3818398d86 | ||
|
|
0973f6149b | ||
|
|
1e1fb09821 | ||
|
|
dfe099fe9b | ||
|
|
3b6450f188 | ||
|
|
971a2cc300 | ||
|
|
6b8db478fb | ||
|
|
3932a9614c | ||
|
|
4dde4fffe3 | ||
|
|
57d38be688 | ||
|
|
b79522a955 | ||
|
|
94333ff2f1 | ||
|
|
d3f4bfe192 | ||
|
|
d130e64f69 | ||
|
|
f7e9cddae9 | ||
|
|
6fbcf62d76 | ||
|
|
1a6943fe17 | ||
|
|
cde2343d09 | ||
|
|
c746b30287 | ||
|
|
3582b96dd9 | ||
|
|
d258065e36 | ||
|
|
7627466891 | ||
|
|
c476ee46f8 | ||
|
|
6fc68f4e62 | ||
|
|
75bac1fd4e | ||
|
|
94042375a7 | ||
|
|
103306c6c8 | ||
|
|
6d37d262ea | ||
|
|
473331dd3a | ||
|
|
bc9d03ef48 | ||
|
|
740c88fe0c | ||
|
|
684ef09168 | ||
|
|
e3b08fc15d | ||
|
|
5c931a61b4 | ||
|
|
ad7534d00d | ||
|
|
c81f8699f1 | ||
|
|
2af03eb0dc | ||
|
|
5064ba3f1d | ||
|
|
c5abe47859 | ||
|
|
8fdd0e40f8 | ||
|
|
a6a07ba0d7 | ||
|
|
614fef4189 | ||
|
|
d3e7dba2b7 | ||
|
|
39343c3e9e | ||
|
|
73865fec59 | ||
|
|
b508818f23 | ||
|
|
bef8ae0a2f | ||
|
|
cce2d41500 | ||
|
|
175f3ed338 | ||
|
|
c2cc7c6163 | ||
|
|
8fee041fad | ||
|
|
dfc1f8524a | ||
|
|
752bd2e35a | ||
|
|
01fe0b4630 | ||
|
|
e7f8bc0136 | ||
|
|
370918e07f | ||
|
|
133966677b | ||
|
|
44f84e4781 | ||
|
|
a8354ee046 | ||
|
|
4550e3073a | ||
|
|
abe7a49092 | ||
|
|
82a486bfb6 | ||
|
|
ad06e733f8 | ||
|
|
4306603a28 | ||
|
|
554f834a90 | ||
|
|
7236bec61f | ||
|
|
c799f1bfe9 | ||
|
|
f15c3c1420 | ||
|
|
aa67045330 | ||
|
|
736640f38d | ||
|
|
e9caf663bc | ||
|
|
8afbea53de | ||
|
|
c3d496ad5b | ||
|
|
06501f528d | ||
|
|
f6a678c1a4 | ||
|
|
30690d0ebd | ||
|
|
7a830cddf9 | ||
|
|
3dc1365d39 | ||
|
|
b03cd94ae8 | ||
|
|
bbf348d273 | ||
|
|
dce48eb415 | ||
|
|
decf14635d | ||
|
|
db4f49bbba | ||
|
|
26824fcb6e | ||
|
|
8afad91b33 | ||
|
|
69de0b13c4 | ||
|
|
967153bc10 | ||
|
|
971d9be1bd | ||
|
|
7a3faef886 | ||
|
|
f67030fcc7 | ||
|
|
7353e99449 | ||
|
|
91d9597c89 | ||
|
|
2eb569912b | ||
|
|
9410d9c066 | ||
|
|
29d8788e25 | ||
|
|
0304c50bc6 | ||
|
|
dd22150cfe | ||
|
|
07e7feca56 | ||
|
|
a93eec8f50 | ||
|
|
88bad762e5 | ||
|
|
18dfe6ca8b | ||
|
|
96dfa7009f | ||
|
|
92a9d8ad11 | ||
|
|
2ab9094b41 | ||
|
|
f6154ccbc4 | ||
|
|
0be01dde19 | ||
|
|
e113e91423 | ||
|
|
28c63b8b9d | ||
|
|
c5aac4c44f | ||
|
|
42e7f2a5c3 | ||
|
|
ae9ae18d31 | ||
|
|
f89cdac198 | ||
|
|
e8f345ff77 | ||
|
|
aff0610df9 | ||
|
|
9199d062d1 | ||
|
|
0ec4aaa629 | ||
|
|
9fca99b4ef | ||
|
|
14853895f3 | ||
|
|
d79a400c8c | ||
|
|
f741385e43 | ||
|
|
840bd92afb | ||
|
|
96e1fb0b10 | ||
|
|
388557e5f9 | ||
|
|
3f32817272 | ||
|
|
056b383536 | ||
|
|
0691f40588 | ||
|
|
800ca0aa7c | ||
|
|
a91679609b | ||
|
|
19f9408990 | ||
|
|
0eea0c9aca | ||
|
|
9f95aa8271 | ||
|
|
0ee04c497b | ||
|
|
2847270c97 | ||
|
|
b98174afba | ||
|
|
3416980849 | ||
|
|
c171bfbf3b | ||
|
|
583a737cb5 | ||
|
|
d2af6289dd | ||
|
|
44e6f455e9 | ||
|
|
b3a50d669e | ||
|
|
0092ea22e2 | ||
|
|
58fb35a9bb | ||
|
|
9a6ff77545 | ||
|
|
c4e0164479 | ||
|
|
f872f1c591 | ||
|
|
03e64da845 | ||
|
|
3150f64895 | ||
|
|
8b36e9c317 | ||
|
|
c5c5fc6c02 | ||
|
|
c7d9992a3d | ||
|
|
0d8f2c6b14 | ||
|
|
c1800f2a6f | ||
|
|
d41a115a07 | ||
|
|
2640a3b93f | ||
|
|
984c18cb11 | ||
|
|
23db15dfb9 | ||
|
|
9426f954b0 | ||
|
|
133b64778b | ||
|
|
a8a97fa38d | ||
|
|
da6061bbde | ||
|
|
dfad607697 | ||
|
|
5d7565bc59 | ||
|
|
ab962ca98f | ||
|
|
dbbf9858f8 | ||
|
|
51edb35e3f | ||
|
|
81c6ee6270 | ||
|
|
9ad37cc98f | ||
|
|
c76864dd4b | ||
|
|
e3889508c0 | ||
|
|
22d908b9a3 | ||
|
|
13d3e09f1a | ||
|
|
9ec15673d1 | ||
|
|
3a00a803e9 | ||
|
|
4a12a0db90 | ||
|
|
b4940e3a75 | ||
|
|
ffe07bbe3b | ||
|
|
7fdb006465 | ||
|
|
99da577c41 | ||
|
|
0f6fdd6c3b | ||
|
|
52ec58d67f | ||
|
|
c55fc59d18 | ||
|
|
b68b63e8c9 | ||
|
|
84bb05d504 | ||
|
|
f33a7ba870 | ||
|
|
93830c12ee | ||
|
|
b8b50f6651 | ||
|
|
8f331090f9 | ||
|
|
7ec1e8ddfa | ||
|
|
880dc1450d | ||
|
|
801e655c09 | ||
|
|
5e269dd089 | ||
|
|
476f81d5e8 | ||
|
|
66dfb5f6fd | ||
|
|
a2f2991192 | ||
|
|
cfedcd2180 | ||
|
|
cc06c62164 | ||
|
|
b4ca000402 | ||
|
|
b78a6f4418 | ||
|
|
d5693b7a08 | ||
|
|
cae0670065 | ||
|
|
f2d1188fdd | ||
|
|
70be81c92d | ||
|
|
5d5af93401 | ||
|
|
74cbdcce55 | ||
|
|
96d19a76cc |
+4
-16
@@ -536,10 +536,7 @@ before_script:
|
||||
- macos
|
||||
stage: build
|
||||
script:
|
||||
- eval $(/opt/homebrew/bin/brew shellenv)
|
||||
- qmake OpenRGB.pro
|
||||
- make -j16
|
||||
- macdeployqt OpenRGB.app -codesign=OpenRGB
|
||||
- ./scripts/build-macos.sh qt6 arm
|
||||
|
||||
artifacts:
|
||||
name: "${CI_PROJECT_NAME}_MacOS_ARM64_${CI_COMMIT_SHORT_SHA}"
|
||||
@@ -555,10 +552,7 @@ before_script:
|
||||
- macos
|
||||
stage: build
|
||||
script:
|
||||
- eval $(/opt/homebrew/bin/brew shellenv)
|
||||
- /opt/homebrew/opt/qt@5/bin/qmake OpenRGB.pro
|
||||
- make -j16
|
||||
- /opt/homebrew/opt/qt@5/bin/macdeployqt OpenRGB.app -codesign=OpenRGB
|
||||
- ./scripts/build-macos.sh qt5 arm
|
||||
|
||||
artifacts:
|
||||
name: "${CI_PROJECT_NAME}_MacOS_Qt5_ARM64_${CI_COMMIT_SHORT_SHA}"
|
||||
@@ -574,10 +568,7 @@ before_script:
|
||||
- macos
|
||||
stage: build
|
||||
script:
|
||||
- eval $(/usr/local/bin/brew shellenv)
|
||||
- arch -x86_64 /usr/local/bin/qmake OpenRGB.pro
|
||||
- arch -x86_64 make -j16
|
||||
- arch -x86_64 /usr/local/bin/macdeployqt OpenRGB.app -codesign=OpenRGB
|
||||
- ./scripts/build-macos.sh qt6 intel
|
||||
|
||||
artifacts:
|
||||
name: "${CI_PROJECT_NAME}_MacOS_Intel_${CI_COMMIT_SHORT_SHA}"
|
||||
@@ -593,10 +584,7 @@ before_script:
|
||||
- macos
|
||||
stage: build
|
||||
script:
|
||||
- eval $(/usr/local/bin/brew shellenv)
|
||||
- arch -x86_64 /usr/local/opt/qt@5/bin/qmake OpenRGB.pro
|
||||
- arch -x86_64 make -j16
|
||||
- arch -x86_64 /usr/local/opt/qt@5/bin/macdeployqt OpenRGB.app -codesign=OpenRGB
|
||||
- ./scripts/build-macos.sh qt5 intel
|
||||
|
||||
artifacts:
|
||||
name: "${CI_PROJECT_NAME}_MacOS_Intel_Qt5_${CI_COMMIT_SHORT_SHA}"
|
||||
|
||||
+1
-2
@@ -22,13 +22,12 @@ CODEOWNERS @Calcprogrammer1
|
||||
/Controllers/BlinkyTapeController/
|
||||
/Controllers/CoolerMasterController/ @Dr_No
|
||||
/Controllers/CorsairCommanderCoreController/
|
||||
/Controllers/CorsairDominatorPlatinumController/
|
||||
/Controllers/CorsairDRAMController/
|
||||
/Controllers/CorsairHydroController/
|
||||
/Controllers/CorsairHydroPlatinumController/
|
||||
/Controllers/CorsairLightingNodeController/
|
||||
/Controllers/CorsairPeripheralController/
|
||||
/Controllers/CorsairVengeanceController/
|
||||
/Controllers/CorsairVengeanceProController/
|
||||
/Controllers/CorsairWirelessController/
|
||||
/Controllers/CreativeController/
|
||||
/Controllers/CrucialController/
|
||||
|
||||
@@ -69,3 +69,7 @@ OpenRGB is written in C++, uses the Qt framework for UI, and uses the QMake buil
|
||||
|
||||
Translation files are located in [`OpenRGB/qt/i18n/`](https://gitlab.com/CalcProgrammer1/OpenRGB/-/tree/master/qt/i18n), where languages are formatted using ISO 639-1 format: `OpenRGB_xx_XX.ts` — `xx_XX` representing the language code.
|
||||
In order to translate a file, you need to [fork](https://gitlab.com/CalcProgrammer1/OpenRGB/-/forks/new) the project, create a new file for your language with `lupdate` (or edit an exisiting one), edit the file with `qtlinguist`, commit, push, and create a merge request.
|
||||
|
||||
## AI Guidelines
|
||||
|
||||
OpenRGB is an open source project developed by humans for humans. As a general rule, AI generated submissions are not permitted. The licensing behind AI generated code is problematic. If you choose to use AI for assistance in your development process, we can't stop you, but do not credit the AI in commits (no AI authorship/co-authorship). Ultimately, you as a human developer are responsible for the code you submit and it is expected that any code you submit you fully understand and have manually vetted before submission. Merge requests that appear to be straight from an AI output, commits with AI tool authorship or co-authorship tags, or otherwise AI generated submissions are subject to closure.
|
||||
|
||||
@@ -173,6 +173,8 @@ RGBController_BloodyB820R::RGBController_BloodyB820R(BloodyB820RController *cont
|
||||
|
||||
RGBController_BloodyB820R::~RGBController_BloodyB820R()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
@@ -89,6 +89,8 @@ RGBController_BloodyMouse::RGBController_BloodyMouse(BloodyMouseController *cont
|
||||
|
||||
RGBController_BloodyMouse::~RGBController_BloodyMouse()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,8 @@ RGBController_AMBX::RGBController_AMBX(AMBXController* controller_ptr)
|
||||
|
||||
RGBController_AMBX::~RGBController_AMBX()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
@@ -132,6 +132,8 @@ RGBController_AMDWraithPrism::RGBController_AMDWraithPrism(AMDWraithPrismControl
|
||||
|
||||
RGBController_AMDWraithPrism::~RGBController_AMDWraithPrism()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ AOCKeyboardController::~AOCKeyboardController()
|
||||
|
||||
std::string AOCKeyboardController::GetDeviceLocation()
|
||||
{
|
||||
return("HID " + location);
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string AOCKeyboardController::GetDeviceName()
|
||||
|
||||
@@ -257,6 +257,8 @@ RGBController_AOCKeyboard::RGBController_AOCKeyboard(AOCKeyboardController* cont
|
||||
|
||||
RGBController_AOCKeyboard::~RGBController_AOCKeyboard()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ AOCMouseController::~AOCMouseController()
|
||||
|
||||
std::string AOCMouseController::GetDeviceLocation()
|
||||
{
|
||||
return("HID " + location);
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string AOCMouseController::GetDeviceName()
|
||||
|
||||
@@ -123,6 +123,8 @@ RGBController_AOCMouse::RGBController_AOCMouse(AOCMouseController* controller_pt
|
||||
|
||||
RGBController_AOCMouse::~RGBController_AOCMouse()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ AOCMousematController::~AOCMousematController()
|
||||
|
||||
std::string AOCMousematController::GetDeviceLocation()
|
||||
{
|
||||
return("HID " + location);
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string AOCMousematController::GetDeviceName()
|
||||
|
||||
@@ -113,6 +113,8 @@ RGBController_AOCMousemat::RGBController_AOCMousemat(AOCMousematController* cont
|
||||
|
||||
RGBController_AOCMousemat::~RGBController_AOCMousemat()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ void PolychromeUSBController::SetDeviceInfo()
|
||||
WriteRGSwap(rgswap_final[0], rgswap_final[1], rgswap_final[2], rgswap_final[3], rgswap_final[4], rgswap_final[5], rgswap_final[6], rgswap_final[7]);
|
||||
}
|
||||
|
||||
void PolychromeUSBController::DeviceResizeZone(int zone, int new_size)
|
||||
void PolychromeUSBController::SetZoneSize(int zone, int new_size)
|
||||
{
|
||||
unsigned char zonecfg[POLYCHROME_USB_ZONE_MAX_NUM];
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ public:
|
||||
unsigned int configsize
|
||||
);
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void SetZoneSize(int zone, int new_size);
|
||||
void SetRGSwap(bool reset);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -185,8 +185,25 @@ RGBController_PolychromeUSB::RGBController_PolychromeUSB(PolychromeUSBController
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_PolychromeUSB::~RGBController_PolychromeUSB()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_PolychromeUSB::SetupZones()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
{
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
@@ -197,35 +214,62 @@ void RGBController_PolychromeUSB::SetupZones()
|
||||
/*-------------------------------------------------*\
|
||||
| Set zones and leds |
|
||||
\*-------------------------------------------------*/
|
||||
for(unsigned int channel_idx = 0; channel_idx < zones.size(); channel_idx++)
|
||||
for(std::size_t channel_idx = 0; channel_idx < zones.size(); channel_idx++)
|
||||
{
|
||||
PolychromeDeviceInfo device_info = controller->GetPolychromeDevices()[channel_idx];
|
||||
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
|
||||
if(device_info.device_type== PolychromeDeviceType::ADDRESSABLE)
|
||||
{
|
||||
zones[channel_idx].name = polychrome_USB_zone_names[device_info.zone_type];
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = ASROCK_ADDRESSABLE_MAX_LEDS;
|
||||
zones[channel_idx].leds_count = device_info.num_leds;
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = ASROCK_ADDRESSABLE_MAX_LEDS;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[channel_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_SEGMENTS;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[channel_idx].name = polychrome_USB_zone_names[device_info.zone_type];
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[channel_idx].leds_count = device_info.num_leds;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[channel_idx].matrix_map.width = 0;
|
||||
zones[channel_idx].matrix_map.height = 0;
|
||||
zones[channel_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
}
|
||||
else if(device_info.device_type==PolychromeDeviceType::FIXED)
|
||||
{
|
||||
zones[channel_idx].name = polychrome_USB_zone_names[device_info.zone_type];
|
||||
zones[channel_idx].leds_min = device_info.num_leds;
|
||||
zones[channel_idx].leds_max = device_info.num_leds;
|
||||
zones[channel_idx].leds_count = device_info.num_leds;
|
||||
zones[channel_idx].name = polychrome_USB_zone_names[device_info.zone_type];
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
zones[channel_idx].leds_min = device_info.num_leds;
|
||||
zones[channel_idx].leds_max = device_info.num_leds;
|
||||
zones[channel_idx].leds_count = device_info.num_leds;
|
||||
}
|
||||
|
||||
|
||||
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = zones[channel_idx].name;
|
||||
new_led.name.append(", LED ");
|
||||
new_led.name.append(std::to_string(led_ch_idx + 1));
|
||||
new_led.value = channel_idx;
|
||||
new_led.value = (unsigned int)channel_idx;
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
@@ -271,10 +315,14 @@ void RGBController_PolychromeUSB::SetupZones()
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_PolychromeUSB::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_PolychromeUSB::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
zones[zone].leds_count = (unsigned char) new_size;
|
||||
controller->DeviceResizeZone(zones_info[zone].zone, new_size);
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
controller->SetZoneSize(zones_info[zone_idx].zone, zones[zone_idx].leds_count);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_PolychromeUSB::DeviceUpdateLEDs()
|
||||
|
||||
@@ -19,10 +19,11 @@ class RGBController_PolychromeUSB : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_PolychromeUSB(PolychromeUSBController* controller_ptr);
|
||||
~RGBController_PolychromeUSB();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ ASRockASRRGBSMBusController::~ASRockASRRGBSMBusController()
|
||||
|
||||
std::string ASRockASRRGBSMBusController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
+2
-7
@@ -113,6 +113,8 @@ RGBController_ASRockASRRGBSMBus::RGBController_ASRockASRRGBSMBus(ASRockASRRGBSMB
|
||||
|
||||
RGBController_ASRockASRRGBSMBus::~RGBController_ASRockASRRGBSMBus()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
@@ -159,13 +161,6 @@ void RGBController_ASRockASRRGBSMBus::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_ASRockASRRGBSMBus::DeviceResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_ASRockASRRGBSMBus::DeviceUpdateLEDs()
|
||||
{
|
||||
for(unsigned int led = 0; led < colors.size(); led++)
|
||||
|
||||
-2
@@ -22,8 +22,6 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
void DeviceUpdateSingleLED(int led);
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ ASRockPolychromeV1SMBusController::~ASRockPolychromeV1SMBusController()
|
||||
|
||||
std::string ASRockPolychromeV1SMBusController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
+4
-3
@@ -230,6 +230,8 @@ RGBController_ASRockPolychromeV1SMBus::RGBController_ASRockPolychromeV1SMBus(ASR
|
||||
|
||||
RGBController_ASRockPolychromeV1SMBus::~RGBController_ASRockPolychromeV1SMBus()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
@@ -296,10 +298,9 @@ void RGBController_ASRockPolychromeV1SMBus::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_ASRockPolychromeV1SMBus::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_ASRockPolychromeV1SMBus::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
LOG_TRACE("[%s] DeviceResizeZone(%02X, %02X)", name.c_str(), zone, new_size);
|
||||
controller-> SetARGBSize(new_size & 0xFF);
|
||||
controller-> SetARGBSize(zones[zone_idx].leds_count & 0xFF);
|
||||
zones[POLYCHROME_V1_ZONE_ADDRESSABLE].leds_count = 1;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ ASRockPolychromeV2SMBusController::~ASRockPolychromeV2SMBusController()
|
||||
|
||||
std::string ASRockPolychromeV2SMBusController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
+3
-4
@@ -185,6 +185,8 @@ RGBController_ASRockPolychromeV2SMBus::RGBController_ASRockPolychromeV2SMBus(ASR
|
||||
|
||||
RGBController_ASRockPolychromeV2SMBus::~RGBController_ASRockPolychromeV2SMBus()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
@@ -236,7 +238,6 @@ void RGBController_ASRockPolychromeV2SMBus::SetupZones()
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int led_count = 0;
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up LEDs |
|
||||
\*---------------------------------------------------------*/
|
||||
@@ -266,8 +267,6 @@ void RGBController_ASRockPolychromeV2SMBus::SetupZones()
|
||||
\*---------------------------------------------------------*/
|
||||
leds.push_back(*new_led);
|
||||
|
||||
led_count++;
|
||||
|
||||
if(zone_idx == POLYCHROME_V2_ZONE_ADDRESSABLE)
|
||||
{
|
||||
break;
|
||||
@@ -279,7 +278,7 @@ void RGBController_ASRockPolychromeV2SMBus::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_ASRockPolychromeV2SMBus::DeviceResizeZone(int /*zone*/, int /*new_size*/)
|
||||
void RGBController_ASRockPolychromeV2SMBus::DeviceConfigureZone(int /*zone_idx*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -85,31 +85,31 @@ uint16_t GetFirmwareVersion(i2c_smbus_interface* bus, uint8_t address)
|
||||
}
|
||||
}
|
||||
|
||||
DetectedControllers DetectASRockSMBusControllers(std::vector<i2c_smbus_interface*>& busses)
|
||||
DetectedControllers DetectASRockSMBusControllers(std::vector<i2c_smbus_interface*>& buses)
|
||||
{
|
||||
DetectedControllers detected_controllers;
|
||||
|
||||
for(unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
for(unsigned int bus = 0; bus < buses.size(); bus++)
|
||||
{
|
||||
IF_MOBO_SMBUS(busses[bus]->pci_vendor, busses[bus]->pci_device)
|
||||
IF_MOBO_SMBUS(buses[bus]->info.pci_vendor, buses[bus]->info.pci_device)
|
||||
{
|
||||
if(busses[bus]->pci_subsystem_vendor == ASROCK_SUB_VEN)
|
||||
if(buses[bus]->info.pci_subsystem_vendor == ASROCK_SUB_VEN)
|
||||
{
|
||||
LOG_DEBUG(SMBUS_CHECK_DEVICE_MESSAGE_EN, ASROCK_DETECTOR_NAME, bus, VENDOR_NAME, SMBUS_ADDRESS);
|
||||
// Check for Polychrome controller at 0x6A
|
||||
if(TestForPolychromeSMBusController(busses[bus], SMBUS_ADDRESS))
|
||||
if(TestForPolychromeSMBusController(buses[bus], SMBUS_ADDRESS))
|
||||
{
|
||||
LOG_DEBUG("[%s] Detected a device at address 0x%02X, testing for a known controller", ASROCK_DETECTOR_NAME, SMBUS_ADDRESS);
|
||||
|
||||
u16_to_u8 version;
|
||||
version.u16 = GetFirmwareVersion(busses[bus], SMBUS_ADDRESS);
|
||||
version.u16 = GetFirmwareVersion(buses[bus], SMBUS_ADDRESS);
|
||||
|
||||
switch(version.msb)
|
||||
{
|
||||
case ASROCK_TYPE_ASRLED:
|
||||
{
|
||||
LOG_DEBUG("[%s] Found a ASR RGB LED Controller", ASROCK_DETECTOR_NAME);
|
||||
ASRockASRRGBSMBusController* controller = new ASRockASRRGBSMBusController(busses[bus], SMBUS_ADDRESS);
|
||||
ASRockASRRGBSMBusController* controller = new ASRockASRRGBSMBusController(buses[bus], SMBUS_ADDRESS);
|
||||
controller-> fw_version = version.u16;
|
||||
RGBController_ASRockASRRGBSMBus* rgb_controller = new RGBController_ASRockASRRGBSMBus(controller);
|
||||
detected_controllers.push_back(rgb_controller);
|
||||
@@ -119,7 +119,7 @@ DetectedControllers DetectASRockSMBusControllers(std::vector<i2c_smbus_interface
|
||||
case ASROCK_TYPE_POLYCHROME_V1:
|
||||
{
|
||||
LOG_DEBUG("[%s] Found a Polychrome v1 Controller", ASROCK_DETECTOR_NAME);
|
||||
ASRockPolychromeV1SMBusController* controller = new ASRockPolychromeV1SMBusController(busses[bus], SMBUS_ADDRESS);
|
||||
ASRockPolychromeV1SMBusController* controller = new ASRockPolychromeV1SMBusController(buses[bus], SMBUS_ADDRESS);
|
||||
controller-> fw_version = version.u16;
|
||||
RGBController_ASRockPolychromeV1SMBus* rgb_controller = new RGBController_ASRockPolychromeV1SMBus(controller);
|
||||
detected_controllers.push_back(rgb_controller);
|
||||
@@ -129,7 +129,7 @@ DetectedControllers DetectASRockSMBusControllers(std::vector<i2c_smbus_interface
|
||||
case ASROCK_TYPE_POLYCHROME_V2:
|
||||
{
|
||||
LOG_DEBUG("[%s] Found a Polychrome v2 Controller", ASROCK_DETECTOR_NAME);
|
||||
ASRockPolychromeV2SMBusController* controller = new ASRockPolychromeV2SMBusController(busses[bus], SMBUS_ADDRESS);
|
||||
ASRockPolychromeV2SMBusController* controller = new ASRockPolychromeV2SMBusController(buses[bus], SMBUS_ADDRESS);
|
||||
controller-> fw_version = version.u16;
|
||||
RGBController_ASRockPolychromeV2SMBus* rgb_controller = new RGBController_ASRockPolychromeV2SMBus(controller);
|
||||
detected_controllers.push_back(rgb_controller);
|
||||
|
||||
@@ -125,6 +125,13 @@ RGBController_Alienware::RGBController_Alienware(AlienwareController* controller
|
||||
controller->UpdateDim();
|
||||
}
|
||||
|
||||
RGBController_Alienware::~RGBController_Alienware()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_Alienware::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
|
||||
@@ -19,6 +19,7 @@ class RGBController_Alienware : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_Alienware(AlienwareController* controller_ptr);
|
||||
~RGBController_Alienware();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
|
||||
+2
@@ -278,6 +278,8 @@ RGBController_AlienwareAW410K::RGBController_AlienwareAW410K(AlienwareAW410KCont
|
||||
|
||||
RGBController_AlienwareAW410K::~RGBController_AlienwareAW410K()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -277,6 +277,8 @@ RGBController_AlienwareAW510K::RGBController_AlienwareAW510K(AlienwareAW510KCont
|
||||
|
||||
RGBController_AlienwareAW510K::~RGBController_AlienwareAW510K()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,8 @@ RGBController_AlienwareAW3423DWF::RGBController_AlienwareAW3423DWF(AlienwareAW34
|
||||
|
||||
RGBController_AlienwareAW3423DWF::~RGBController_AlienwareAW3423DWF()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,8 @@ RGBController_AlienwareMonitor::RGBController_AlienwareMonitor(AlienwareMonitorC
|
||||
|
||||
RGBController_AlienwareMonitor::~RGBController_AlienwareMonitor()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
@@ -144,6 +144,8 @@ RGBController_AnnePro2::RGBController_AnnePro2(AnnePro2Controller* controller_pt
|
||||
|
||||
RGBController_AnnePro2::~RGBController_AnnePro2()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,13 +21,13 @@
|
||||
DetectedControllers DetectArcticControllers()
|
||||
{
|
||||
DetectedControllers detected_controllers;
|
||||
std::vector<std::string *> ports;
|
||||
std::vector<std::string> ports;
|
||||
|
||||
ports = find_usb_serial_port(CH341_VID, CH341_PID);
|
||||
|
||||
for(unsigned int device = 0; device < ports.size(); device++)
|
||||
{
|
||||
ArcticController *controller = new ArcticController(*ports[device]);
|
||||
ArcticController *controller = new ArcticController(ports[device]);
|
||||
|
||||
if(controller->IsPresent())
|
||||
{
|
||||
@@ -38,8 +38,6 @@ DetectedControllers DetectArcticControllers()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
delete ports[device];
|
||||
}
|
||||
|
||||
return(detected_controllers);
|
||||
|
||||
@@ -55,6 +55,8 @@ RGBController_Arctic::RGBController_Arctic(ArcticController* controller_ptr)
|
||||
|
||||
RGBController_Arctic::~RGBController_Arctic()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
keepalive_thread_run = false;
|
||||
keepalive_thread.join();
|
||||
delete controller;
|
||||
|
||||
@@ -125,6 +125,8 @@ RGBController_Areson::RGBController_Areson(AresonController* controller_ptr)
|
||||
|
||||
RGBController_Areson::~RGBController_Areson()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
+7
-5
@@ -45,6 +45,13 @@ RGBController_AuraCore::RGBController_AuraCore(AuraCoreController* controller_pt
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_AuraCore::~RGBController_AuraCore()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_AuraCore::SetupKeyboard()
|
||||
{
|
||||
name = "ASUS Aura Keyboard";
|
||||
@@ -170,11 +177,6 @@ void RGBController_AuraCore::SetupGA15DH()
|
||||
modes.push_back(Static);
|
||||
}
|
||||
|
||||
RGBController_AuraCore::~RGBController_AuraCore()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_AuraCore::SetupZones()
|
||||
{
|
||||
zone auraZone;
|
||||
|
||||
+2
@@ -268,6 +268,8 @@ RGBController_AsusAuraCoreLaptop::RGBController_AsusAuraCoreLaptop(AsusAuraCoreL
|
||||
|
||||
RGBController_AsusAuraCoreLaptop::~RGBController_AsusAuraCoreLaptop()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ std::string AuraGPUController::GetDeviceName()
|
||||
|
||||
std::string AuraGPUController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
@@ -79,7 +79,7 @@ void AuraGPUController::AuraGPURegisterWrite(unsigned char reg, unsigned char va
|
||||
|
||||
bool AuraGPUController::SaveOnlyApplies()
|
||||
{
|
||||
switch (bus->pci_subsystem_device)
|
||||
switch (bus->info.pci_subsystem_device)
|
||||
{
|
||||
case ASUS_VEGA64_STRIX:
|
||||
return false;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
bool TestForAsusAuraGPUController(i2c_smbus_interface* bus, unsigned char address)
|
||||
{
|
||||
if(bus->pci_vendor == AMD_GPU_VEN && !is_amd_gpu_i2c_bus(bus))
|
||||
if(bus->info.pci_vendor == AMD_GPU_VEN && !is_amd_gpu_i2c_bus(bus))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -124,6 +124,8 @@ RGBController_AuraGPU::RGBController_AuraGPU(AuraGPUController * controller_ptr)
|
||||
|
||||
RGBController_AuraGPU::~RGBController_AuraGPU()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -112,6 +112,8 @@ RGBController_AuraHeadsetStand::RGBController_AuraHeadsetStand(AuraHeadsetStandC
|
||||
|
||||
RGBController_AuraHeadsetStand::~RGBController_AuraHeadsetStand()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -380,6 +380,8 @@ RGBController_AuraKeyboard::RGBController_AuraKeyboard(AuraKeyboardController* c
|
||||
|
||||
RGBController_AuraKeyboard::~RGBController_AuraKeyboard()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -45,6 +45,8 @@ RGBController_AuraMonitor::RGBController_AuraMonitor(AuraMonitorController* cont
|
||||
|
||||
RGBController_AuraMonitor::~RGBController_AuraMonitor()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#define AURA_ROG_GLADIUS_II_WIRELESS_1_PID 0x189E
|
||||
#define AURA_ROG_GLADIUS_II_WIRELESS_2_PID 0x18A0
|
||||
#define AURA_ROG_GLADIUS_III_PID 0x197B
|
||||
#define AURA_ROG_GLADIUS_III_CORE_PID 0x1C8D
|
||||
#define AURA_ROG_GLADIUS_III_WIRELESS_USB_PID 0x197D
|
||||
#define AURA_ROG_GLADIUS_III_WIRELESS_2_4_PID 0x197F
|
||||
#define AURA_ROG_GLADIUS_III_WIRELESS_BT_PID 0x1981
|
||||
@@ -217,6 +218,20 @@ static std::map<int,mouse_type> aura_mouse_devices =
|
||||
{ AURA_MOUSE_MODE_STATIC, AURA_MOUSE_MODE_BREATHING, AURA_MOUSE_MODE_SPECTRUM, AURA_MOUSE_MODE_WAVE, AURA_MOUSE_MODE_REACTIVE, AURA_MOUSE_MODE_COMET, AURA_MOUSE_MODE_BATTERY }
|
||||
}
|
||||
},
|
||||
{
|
||||
AURA_ROG_GLADIUS_III_CORE_PID, // ROG Gladius III Core
|
||||
{
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
100,
|
||||
false,
|
||||
1,
|
||||
false,
|
||||
{ AURA_MOUSE_ZONE_LOGO, AURA_MOUSE_ZONE_SCROLL },
|
||||
{ AURA_MOUSE_MODE_STATIC, AURA_MOUSE_MODE_BREATHING, AURA_MOUSE_MODE_SPECTRUM, AURA_MOUSE_MODE_NONE, AURA_MOUSE_MODE_REACTIVE }
|
||||
}
|
||||
},
|
||||
{
|
||||
AURA_ROG_GLADIUS_III_WIRELESS_USB_PID, // ROG Gladius III Wireless USB
|
||||
{
|
||||
|
||||
+2
@@ -185,6 +185,8 @@ RGBController_AuraMouse::RGBController_AuraMouse(AuraMouseController* controller
|
||||
|
||||
RGBController_AuraMouse::~RGBController_AuraMouse()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -116,6 +116,8 @@ RGBController_AsusROGSpatha::RGBController_AsusROGSpatha(AsusAuraMouseGen1Contro
|
||||
|
||||
RGBController_AsusROGSpatha::~RGBController_AsusROGSpatha()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -79,6 +79,8 @@ RGBController_AsusROGStrixEvolve::RGBController_AsusROGStrixEvolve(AsusAuraMouse
|
||||
|
||||
RGBController_AsusROGStrixEvolve::~RGBController_AsusROGStrixEvolve()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -182,6 +182,8 @@ RGBController_AuraMousemat::RGBController_AuraMousemat(AuraMousematController* c
|
||||
|
||||
RGBController_AuraMousemat::~RGBController_AuraMousemat()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -19,7 +19,10 @@ AsusAuraRyuoAIOController::AsusAuraRyuoAIOController(hid_device* dev_handle, con
|
||||
| Manually adding device info for now |
|
||||
| TODO: Implement config table accurately |
|
||||
\*-----------------------------------------------------*/
|
||||
device_info.push_back({0x00, 0x00, 12, 0, AuraDeviceType::FIXED});
|
||||
uint8_t leds = (dev_name.find("Ryujin") != std::string::npos) ? 5 : 12;
|
||||
|
||||
device_info.push_back({0x00, 0x00, leds, 0, AuraDeviceType::FIXED});
|
||||
|
||||
}
|
||||
|
||||
AsusAuraRyuoAIOController::~AsusAuraRyuoAIOController()
|
||||
|
||||
+2
@@ -128,6 +128,8 @@ RGBController_AsusAuraRyuoAIO::RGBController_AsusAuraRyuoAIO(AsusAuraRyuoAIOCont
|
||||
|
||||
RGBController_AsusAuraRyuoAIO::~RGBController_AsusAuraRyuoAIO()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -410,6 +410,8 @@ RGBController_AuraTUFKeyboard::RGBController_AuraTUFKeyboard(AuraTUFKeyboardCont
|
||||
|
||||
RGBController_AuraTUFKeyboard::~RGBController_AuraTUFKeyboard()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
+48
-25
@@ -119,6 +119,8 @@ RGBController_AuraUSB::RGBController_AuraUSB(AuraUSBController* controller_ptr)
|
||||
|
||||
RGBController_AuraUSB::~RGBController_AuraUSB()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
@@ -145,41 +147,68 @@ void RGBController_AuraUSB::SetupZones()
|
||||
| Set zones and leds |
|
||||
\*-------------------------------------------------*/
|
||||
int addressableCounter = 1;
|
||||
for (unsigned int channel_idx = 0; channel_idx < zones.size(); channel_idx++)
|
||||
|
||||
for(std::size_t channel_idx = 0; channel_idx < zones.size(); channel_idx++)
|
||||
{
|
||||
AuraDeviceInfo device_info = controller->GetAuraDevices()[channel_idx];
|
||||
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
|
||||
if(device_info.device_type == AuraDeviceType::FIXED)
|
||||
{
|
||||
zones[channel_idx].name = "Aura Mainboard";
|
||||
zones[channel_idx].leds_min = device_info.num_leds;
|
||||
zones[channel_idx].leds_max = device_info.num_leds;
|
||||
zones[channel_idx].leds_count = device_info.num_leds;
|
||||
zones[channel_idx].name = "Aura Mainboard";
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
zones[channel_idx].leds_min = device_info.num_leds;
|
||||
zones[channel_idx].leds_max = device_info.num_leds;
|
||||
zones[channel_idx].leds_count = device_info.num_leds;
|
||||
}
|
||||
else
|
||||
{
|
||||
zones[channel_idx].name = "Aura Addressable ";
|
||||
zones[channel_idx].name.append(std::to_string(addressableCounter));
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = AURA_ADDRESSABLE_MAX_LEDS;
|
||||
|
||||
addressableCounter++;
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = AURA_ADDRESSABLE_MAX_LEDS;
|
||||
|
||||
if(first_run)
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
zones[channel_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_SEGMENTS;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[channel_idx].name = "Addressable RGB Header ";
|
||||
zones[channel_idx].name.append(std::to_string(addressableCounter));
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[channel_idx].matrix_map.width = 0;
|
||||
zones[channel_idx].matrix_map.height = 0;
|
||||
zones[channel_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
addressableCounter++;
|
||||
}
|
||||
|
||||
unsigned int num_mainboard_leds = device_info.num_leds - device_info.num_headers;
|
||||
for (unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
|
||||
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
{
|
||||
unsigned led_idx = led_ch_idx + 1;
|
||||
led new_led;
|
||||
|
||||
new_led.name = zones[channel_idx].name;
|
||||
|
||||
if(device_info.device_type == AuraDeviceType::FIXED && led_ch_idx >= num_mainboard_leds)
|
||||
{
|
||||
new_led.name.append(", RGB Header ");
|
||||
@@ -189,9 +218,10 @@ void RGBController_AuraUSB::SetupZones()
|
||||
{
|
||||
new_led.name.append(", LED ");
|
||||
}
|
||||
|
||||
new_led.name.append(std::to_string(led_idx));
|
||||
|
||||
new_led.value = channel_idx;
|
||||
new_led.value = (unsigned int)channel_idx;
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
@@ -200,17 +230,10 @@ void RGBController_AuraUSB::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_AuraUSB::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_AuraUSB::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -120,6 +120,7 @@
|
||||
#define AURA_TERMINAL_PID 0x1889
|
||||
#define ROG_STRIX_LC120_PID 0x879E
|
||||
#define AURA_RYUO_AIO_PID 0x1887
|
||||
#define AURA_RYUJIN_AIO_PID 0x18AE
|
||||
#define ASUS_ROG_ALLY_PID 0x1ABE
|
||||
#define ASUS_ROG_ALLY_X_PID 0x1B4C
|
||||
|
||||
@@ -463,6 +464,7 @@ REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius II Origin COD",
|
||||
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius II Wireless", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_II_WIRELESS_1_PID, 1, 0xFF13);
|
||||
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius II Wireless", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_II_WIRELESS_2_PID, 2, 0xFF01);
|
||||
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius III", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_III_PID, 0, 0xFF01);
|
||||
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius III Core", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_III_CORE_PID, 0, 0xFF01);
|
||||
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius III Wireless USB", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_III_WIRELESS_USB_PID, 0, 0xFF01);
|
||||
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius III Wireless 2.4Ghz", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_III_WIRELESS_2_4_PID, 0, 0xFF01);
|
||||
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius III Wireless Bluetooth", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_III_WIRELESS_BT_PID, 0, 0xFF01);
|
||||
@@ -523,6 +525,7 @@ REGISTER_HID_DETECTOR_PU("ASUS ROG PG32UQ", DetectAs
|
||||
REGISTER_HID_DETECTOR ("ASUS ROG AURA Terminal", DetectAsusAuraUSBTerminal, AURA_USB_VID, AURA_TERMINAL_PID);
|
||||
REGISTER_HID_DETECTOR_PU ("ASUS ROG Strix LC", DetectAsusAuraUSBROGStrixLC, AURA_USB_VID, ROG_STRIX_LC120_PID, 0x00FF, 1);
|
||||
REGISTER_HID_DETECTOR_PU ("ASUS ROG Ryuo AIO", DetectAsusAuraUSBRyuoAIO, AURA_USB_VID, AURA_RYUO_AIO_PID, 0xFF72, 0x00A1);
|
||||
REGISTER_HID_DETECTOR_PU ("ASUS ROG Ryujin AIO", DetectAsusAuraUSBRyuoAIO, AURA_USB_VID, AURA_RYUJIN_AIO_PID, 0xFF72, 0x00A1);
|
||||
REGISTER_HID_DETECTOR_I ("ASUS ROG Throne", DetectAsusAuraUSBHeadsetStand, AURA_USB_VID, AURA_ROG_THRONE_PID, 0);
|
||||
REGISTER_HID_DETECTOR_I ("ASUS ROG Throne QI", DetectAsusAuraUSBHeadsetStand, AURA_USB_VID, AURA_ROG_THRONE_QI_PID, 0);
|
||||
REGISTER_HID_DETECTOR_I ("ASUS ROG Throne QI GUNDAM", DetectAsusAuraUSBHeadsetStand, AURA_USB_VID, AURA_ROG_THRONE_QI_GUNDAM_PID, 0);
|
||||
|
||||
@@ -117,6 +117,8 @@ RGBController_AsusROGAlly::RGBController_AsusROGAlly(ROGAllyController* controll
|
||||
|
||||
RGBController_AsusROGAlly::~RGBController_AsusROGAlly()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -129,6 +129,8 @@ RGBController_AsusROGStrixLC::RGBController_AsusROGStrixLC(AsusROGStrixLCControl
|
||||
|
||||
RGBController_AsusROGStrixLC::~RGBController_AsusROGStrixLC()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -283,6 +283,8 @@ RGBController_AsusCerberusKeyboard::RGBController_AsusCerberusKeyboard(AsusCerbe
|
||||
|
||||
RGBController_AsusCerberusKeyboard::~RGBController_AsusCerberusKeyboard()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -165,6 +165,8 @@ RGBController_AsusSagarisKeyboard::RGBController_AsusSagarisKeyboard(AsusSagaris
|
||||
|
||||
RGBController_AsusSagarisKeyboard::~RGBController_AsusSagarisKeyboard()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ void AsusMonitorController::SetDirect(std::vector<RGBColor> colors)
|
||||
usb_buf[0x00] = 0xEC;
|
||||
usb_buf[0x01] = 0x40;
|
||||
usb_buf[0x02] = 0x84;
|
||||
usb_buf[0x04] = colors.size();
|
||||
usb_buf[0x04] = (uint8_t)colors.size();
|
||||
|
||||
for(size_t i = 0; i < colors.size(); i++)
|
||||
{
|
||||
|
||||
@@ -46,6 +46,8 @@ RGBController_AsusMonitor::RGBController_AsusMonitor(AsusMonitorController* cont
|
||||
|
||||
RGBController_AsusMonitor::~RGBController_AsusMonitor()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +92,13 @@ RGBController_AsusTUFLaptopLinux::RGBController_AsusTUFLaptopLinux(AsusTUFLaptop
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_AsusTUFLaptopLinux::~RGBController_AsusTUFLaptopLinux()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_AsusTUFLaptopLinux::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
|
||||
@@ -16,6 +16,7 @@ class RGBController_AsusTUFLaptopLinux : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_AsusTUFLaptopLinux(AsusTUFLaptopLinuxController* controller_ptr);
|
||||
~RGBController_AsusTUFLaptopLinux();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
|
||||
@@ -85,6 +85,8 @@ RGBController_AsusTUFLaptopWMI::RGBController_AsusTUFLaptopWMI(AsusTUFLaptopCont
|
||||
|
||||
RGBController_AsusTUFLaptopWMI::~RGBController_AsusTUFLaptopWMI()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
DetectedControllers DetectBlinkyTapeControllers()
|
||||
{
|
||||
DetectedControllers detected_controllers;
|
||||
std::vector<std::string *> device_locations = find_usb_serial_port(BLINKINLABS_VID, BLINKYTAPE_PID);
|
||||
std::vector<std::string> device_locations = find_usb_serial_port(BLINKINLABS_VID, BLINKYTAPE_PID);
|
||||
|
||||
for(unsigned int device_idx = 0; device_idx < device_locations.size(); device_idx++)
|
||||
{
|
||||
BlinkyTapeController* controller = new BlinkyTapeController();
|
||||
controller->Initialize(*device_locations[device_idx]);
|
||||
controller->Initialize(device_locations[device_idx]);
|
||||
|
||||
RGBController_BlinkyTape* rgb_controller = new RGBController_BlinkyTape(controller);
|
||||
|
||||
|
||||
@@ -44,86 +44,90 @@ RGBController_BlinkyTape::RGBController_BlinkyTape(BlinkyTapeController* control
|
||||
|
||||
RGBController_BlinkyTape::~RGBController_BlinkyTape()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_BlinkyTape::SetupZones()
|
||||
{
|
||||
zones.clear();
|
||||
/*-------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
{
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(1);
|
||||
|
||||
zone led_zone;
|
||||
led_zone.name = "LED Strip";
|
||||
led_zone.type = ZONE_TYPE_LINEAR;
|
||||
led_zone.leds_min = 0;
|
||||
led_zone.leds_max = 512;
|
||||
led_zone.leds_count = 0;
|
||||
zones.push_back(led_zone);
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up zones |
|
||||
\*-----------------------------------------------------*/
|
||||
zones[0].leds_min = 0;
|
||||
zones[0].leds_max = 512;
|
||||
|
||||
DeviceResizeZone(0, led_zone.leds_count);
|
||||
}
|
||||
|
||||
void RGBController_BlinkyTape::DeviceResizeZone(int zone, int new_size)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Explicitly cast these to avoid compiler warnings |
|
||||
\*-------------------------------------------------*/
|
||||
const unsigned int zone_u = static_cast<unsigned int>(zone);
|
||||
const unsigned int new_size_u = static_cast<unsigned int>(new_size);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Check that the zone is in bounds |
|
||||
\*-------------------------------------------------*/
|
||||
if((zone_u > zones.size()) || (zone < 0))
|
||||
if(first_run)
|
||||
{
|
||||
return;
|
||||
zones[0].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_SEGMENTS;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| And that the new size is in bounds |
|
||||
\*-------------------------------------------------*/
|
||||
if((new_size_u > zones.at(zone).leds_max) || (new_size_u < zones.at(zone).leds_min))
|
||||
if(!(zones[0].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
return;
|
||||
zones[0].name = "Addressable RGB Header";
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| And that there's actually a change |
|
||||
\*-------------------------------------------------*/
|
||||
if(zones.at(zone).leds_count == new_size_u)
|
||||
if(!(zones[0].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
return;
|
||||
zones[0].leds_count = 0;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| If the new size is less than the current size, |
|
||||
| just chop off the end |
|
||||
\*-------------------------------------------------*/
|
||||
if(leds.size() > new_size_u)
|
||||
if(!(zones[0].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
leds.resize(new_size);
|
||||
zones[0].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Otherwise, add new LEDs to the end |
|
||||
\*-------------------------------------------------*/
|
||||
if(leds.size() < new_size_u)
|
||||
if(!(zones[0].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
for(size_t led_idx = leds.size(); led_idx < new_size_u; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = "LED ";
|
||||
new_led.name.append(std::to_string(led_idx));
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
zones[0].matrix_map.width = 0;
|
||||
zones[0].matrix_map.height = 0;
|
||||
zones[0].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
zones.at(zone).leds_count = new_size;
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up LEDs |
|
||||
\*-----------------------------------------------------*/
|
||||
for(size_t led_idx = leds.size(); led_idx < zones[0].leds_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = zones[0].name + ", LED ";
|
||||
new_led.name.append(std::to_string(led_idx));
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_BlinkyTape::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_BlinkyTape::DeviceUpdateLEDs()
|
||||
{
|
||||
controller->SetLEDs(colors);
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
@@ -312,6 +312,8 @@ RGBController_CherryKeyboard::RGBController_CherryKeyboard(CherryKeyboardControl
|
||||
|
||||
RGBController_CherryKeyboard::~RGBController_CherryKeyboard()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,9 @@
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "ClevoKeyboardController.h"
|
||||
#include <cstring>
|
||||
#include "ClevoKeyboardController.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
ClevoKeyboardController::ClevoKeyboardController(hid_device* dev_handle, const hid_device_info& info)
|
||||
{
|
||||
@@ -40,10 +41,7 @@ std::string ClevoKeyboardController::GetSerialString()
|
||||
return("");
|
||||
}
|
||||
|
||||
std::wstring return_wstring = serial_string;
|
||||
std::string return_string(return_wstring.begin(), return_wstring.end());
|
||||
|
||||
return(return_string);
|
||||
return(StringUtils::wstring_to_string(serial_string));
|
||||
}
|
||||
|
||||
std::string ClevoKeyboardController::GetFirmwareVersion()
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "DetectionManager.h"
|
||||
#include "ClevoKeyboardController.h"
|
||||
#include "DetectionManager.h"
|
||||
#include "RGBController_ClevoKeyboard.h"
|
||||
#include "RGBController.h"
|
||||
#include <hidapi.h>
|
||||
@@ -26,7 +26,7 @@
|
||||
\*---------------------------------------------------------*/
|
||||
#define CLEVO_KEYBOARD_PID_600B 0x600B
|
||||
|
||||
DetectedControllers DetectClevoKeyboardControllers(hid_device_info* info, const std::string& name)
|
||||
DetectedControllers DetectClevoKeyboardControllers(hid_device_info* info, const std::string& /*name*/)
|
||||
{
|
||||
DetectedControllers detected_controllers;
|
||||
hid_device* dev;
|
||||
|
||||
@@ -199,6 +199,8 @@ RGBController_ClevoKeyboard::RGBController_ClevoKeyboard(ClevoKeyboardController
|
||||
|
||||
RGBController_ClevoKeyboard::~RGBController_ClevoKeyboard()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,9 @@
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "ClevoLightbarController.h"
|
||||
#include <cstring>
|
||||
#include "ClevoLightbarController.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
ClevoLightbarController::ClevoLightbarController(hid_device* dev_handle, const hid_device_info& info)
|
||||
{
|
||||
@@ -40,10 +41,7 @@ std::string ClevoLightbarController::GetSerialString()
|
||||
return("");
|
||||
}
|
||||
|
||||
std::wstring return_wstring = serial_string;
|
||||
std::string return_string(return_wstring.begin(), return_wstring.end());
|
||||
|
||||
return(return_string);
|
||||
return(StringUtils::wstring_to_string(serial_string));
|
||||
}
|
||||
|
||||
std::string ClevoLightbarController::GetFirmwareVersion()
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "DetectionManager.h"
|
||||
#include "ClevoLightbarController.h"
|
||||
#include "DetectionManager.h"
|
||||
#include "RGBController_ClevoLightbar.h"
|
||||
#include "RGBController.h"
|
||||
#include <hidapi.h>
|
||||
@@ -25,7 +25,7 @@
|
||||
\*---------------------------------------------------------*/
|
||||
#define CLEVO_LIGHTBAR_PID 0x7001
|
||||
|
||||
DetectedControllers DetectClevoLightbarControllers(hid_device_info* info, const std::string& name)
|
||||
DetectedControllers DetectClevoLightbarControllers(hid_device_info* info, const std::string& /*name*/)
|
||||
{
|
||||
DetectedControllers detected_controllers;
|
||||
hid_device* dev;
|
||||
|
||||
@@ -121,6 +121,8 @@ RGBController_ClevoLightbar::RGBController_ClevoLightbar(ClevoLightbarController
|
||||
|
||||
RGBController_ClevoLightbar::~RGBController_ClevoLightbar()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ ColorfulGPUController::~ColorfulGPUController()
|
||||
|
||||
std::string ColorfulGPUController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
@@ -45,7 +45,7 @@ void ColorfulGPUController::SetDirect(RGBColor color)
|
||||
uint8_t g = RGBGetGValue(color);
|
||||
uint8_t b = RGBGetBValue(color);
|
||||
|
||||
if(this->bus->pci_subsystem_device == COLORFUL_IGAME_RTX_4070_VULCAN_OCV)
|
||||
if(this->bus->info.pci_subsystem_device == COLORFUL_IGAME_RTX_4070_VULCAN_OCV)
|
||||
{
|
||||
uint8_t data_pkt[COLORFUL_PACKET_LENGTH_V2] = { 0xAA, 0xEF, 0x01, 0x04, 0x88, 0x26 };
|
||||
for(int i=6; i < COLORFUL_PACKET_LENGTH_V2 -2; i = i + 3)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*---------------------------------------------------------*\
|
||||
/*---------------------------------------------------------*\
|
||||
| ColorfulGPUControllerDetect.cpp |
|
||||
| |
|
||||
| Detector for Colorful GPU |
|
||||
@@ -52,7 +52,7 @@ REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Advanced OC 12G L-V", Detec
|
||||
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Ultra W OC 12G L-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX3060_LHR_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_3060_ULTRAW_OC_12G, 0x61);
|
||||
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Ultra W OC 12G L-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX3060_GA106_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_3060_ULTRAW_OC_12G, 0x61);
|
||||
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Ultra W OC 12G L-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX3060_LHR_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_3060_ULTRAW_OC_12G_2, 0x61);
|
||||
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Ti Ultra W OC LHR-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX3060TI_LHR_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_3060_ULTRAW_OC_12G, 0x61);
|
||||
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Ti Ultra W OC LHR-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX3060TI_LHR_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_3060_ULTRAW_OC_12G, 0x61);
|
||||
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Ti Ultra W OC LHR-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX3060TI_LHR_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_3060_ULTRAW_OC_12G_2, 0x61);
|
||||
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Ti Advanced OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX3060TI_LHR_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_3070_ADVANCED_OCV, 0x61);
|
||||
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Ti Advanced OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX3060TI_LHR_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_3060TI_ADVANCED_OC, 0x61);
|
||||
@@ -76,3 +76,9 @@ REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 4080 Ultra W OC-V", Detec
|
||||
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 4080 Ultra W OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX4080_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_4080_ULTRAW_OCV2, 0x61);
|
||||
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 4090 Advanced OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX4090_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_4090_ADVANCED_OCV, 0x61);
|
||||
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 4090 Advanced OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX4090_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_4090_ADVANCED_OCV2, 0x61);
|
||||
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 5060 Ultra W OC", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX5060_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_5060_ULTRAW_OC, 0x61);
|
||||
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 5060 Ultra W OC", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX5060_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_5060_ULTRAW_OC_2, 0x61);
|
||||
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 5060 Ti Ultra W DUO OC", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX5060TI_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_5060TI_ULTRAW_DUO_OC, 0x61);
|
||||
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 5060 Ti Ultra W DUO OC", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX5060TI_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_5060TI_ULTRAW_DUO_OC_2, 0x61);
|
||||
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 5070 Ultra W OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX5070_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_5070_ULTRAW_OCV, 0x61);
|
||||
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 5070 Ultra W OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX5070_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_5070_ULTRAW_OCV2, 0x61);
|
||||
@@ -44,6 +44,8 @@ RGBController_ColorfulGPU::RGBController_ColorfulGPU(ColorfulGPUController * col
|
||||
|
||||
RGBController_ColorfulGPU::~RGBController_ColorfulGPU()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ ColorfulTuringGPUController::~ColorfulTuringGPUController()
|
||||
|
||||
std::string ColorfulTuringGPUController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
std::string return_string(bus->info.device_name);
|
||||
char addr[5];
|
||||
snprintf(addr, 5, "0x%02X", dev);
|
||||
return_string.append(", address ");
|
||||
|
||||
@@ -17,7 +17,7 @@ DetectedControllers DetectColorfulTuringGPUControllers(i2c_smbus_interface* bus,
|
||||
{
|
||||
DetectedControllers detected_controllers;
|
||||
|
||||
if(bus->port_id == 1)
|
||||
if(bus->info.port_id == 1)
|
||||
{
|
||||
ColorfulTuringGPUController* controller = new ColorfulTuringGPUController(bus, i2c_addr, name);
|
||||
RGBController_ColorfulTuringGPU* rgb_controller = new RGBController_ColorfulTuringGPU(controller);
|
||||
|
||||
@@ -75,6 +75,8 @@ RGBController_ColorfulTuringGPU::RGBController_ColorfulTuringGPU(ColorfulTuringG
|
||||
|
||||
RGBController_ColorfulTuringGPU::~RGBController_ColorfulTuringGPU()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,16 +12,27 @@
|
||||
#include "CMARGBController.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
CMARGBController::CMARGBController(hid_device* dev_handle, char *_path, unsigned char _zone_idx, std::shared_ptr<std::mutex> cm_mutex)
|
||||
/*---------------------------------------------------------*\
|
||||
| Map to convert port index to port ID used in protocol |
|
||||
\*---------------------------------------------------------*/
|
||||
static unsigned char cm_argb_port_index_to_id[5] =
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = _path;
|
||||
zone_index = _zone_idx;
|
||||
mutex_ptr = cm_mutex;
|
||||
CM_ARGB_PORT_ARGB_1,
|
||||
CM_ARGB_PORT_ARGB_2,
|
||||
CM_ARGB_PORT_ARGB_3,
|
||||
CM_ARGB_PORT_ARGB_4,
|
||||
CM_ARGB_PORT_RGB
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Get device name from HID manufacturer and product strings |
|
||||
\*---------------------------------------------------------*/
|
||||
CMARGBController::CMARGBController(hid_device* dev_handle, char *path)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Get device name from HID manufacturer and product |
|
||||
| strings |
|
||||
\*-----------------------------------------------------*/
|
||||
wchar_t name_string[HID_MAX_STR];
|
||||
|
||||
hid_get_manufacturer_string(dev, name_string, HID_MAX_STR);
|
||||
@@ -29,57 +40,11 @@ CMARGBController::CMARGBController(hid_device* dev_handle, char *_path, unsigned
|
||||
|
||||
hid_get_product_string(dev, name_string, HID_MAX_STR);
|
||||
device_name.append(" ").append(StringUtils::wstring_to_string(name_string));
|
||||
|
||||
GetStatus();
|
||||
}
|
||||
|
||||
CMARGBController::~CMARGBController()
|
||||
{
|
||||
if(mutex_ptr.use_count() <= 1)
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
}
|
||||
|
||||
void CMARGBController::GetStatus()
|
||||
{
|
||||
unsigned char buffer[CM_ARGB_PACKET_SIZE] = { 0x00, 0x80, 0x0B, 0x01 };
|
||||
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
|
||||
int rgb_offset = 0;
|
||||
int zone;
|
||||
|
||||
if (argb_header_data[zone_index].digital)
|
||||
{
|
||||
zone = argb_header_data[zone_index].header;
|
||||
buffer[CM_ARGB_COMMAND_BYTE] = 0x0B;
|
||||
}
|
||||
else
|
||||
{
|
||||
zone = 0x00;
|
||||
buffer[CM_ARGB_COMMAND_BYTE] = 0x0A;
|
||||
rgb_offset = 1;
|
||||
}
|
||||
|
||||
/*---------------------------------------------*\
|
||||
| Guard the writes to the controller until the |
|
||||
| for loop has completed to avoid collisons |
|
||||
\*---------------------------------------------*/
|
||||
std::lock_guard<std::mutex> guard(*mutex_ptr);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| If this is the group then just return the first status |
|
||||
\*---------------------------------------------------------*/
|
||||
buffer[CM_ARGB_ZONE_BYTE] = ( zone > 0x08 ) ? 0x01 : zone;
|
||||
hid_write(dev, buffer, buffer_size);
|
||||
hid_read_timeout(dev, buffer, buffer_size, CM_ARGB_INTERRUPT_TIMEOUT);
|
||||
|
||||
current_mode = buffer[4 - rgb_offset];
|
||||
bool_random = ( buffer[5 - rgb_offset] == 0x00 );
|
||||
current_speed = buffer[6 - rgb_offset];
|
||||
current_brightness = buffer[7 - rgb_offset];
|
||||
current_red = buffer[8 - rgb_offset];
|
||||
current_green = buffer[9 - rgb_offset];
|
||||
current_blue = buffer[10 - rgb_offset];
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string CMARGBController::GetDeviceName()
|
||||
@@ -87,6 +52,33 @@ std::string CMARGBController::GetDeviceName()
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
std::string CMARGBController::GetLocation()
|
||||
{
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string CMARGBController::GetVersion()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| This device uses the serial value to determine the |
|
||||
| version. It does not report a proper unique serial. |
|
||||
\*-----------------------------------------------------*/
|
||||
std::string serial_string = GetSerial();
|
||||
|
||||
if(serial_string == CM_ARGB_FW0023)
|
||||
{
|
||||
return("0023");
|
||||
}
|
||||
else if(serial_string == CM_ARGB_FW0028)
|
||||
{
|
||||
return("0028");
|
||||
}
|
||||
else
|
||||
{
|
||||
return("Unsupported");
|
||||
}
|
||||
}
|
||||
|
||||
std::string CMARGBController::GetSerial()
|
||||
{
|
||||
wchar_t serial_string[HID_MAX_STR];
|
||||
@@ -100,118 +92,187 @@ std::string CMARGBController::GetSerial()
|
||||
return(StringUtils::wstring_to_string(serial_string));
|
||||
}
|
||||
|
||||
std::string CMARGBController::GetLocation()
|
||||
void CMARGBController::GetPortStatus
|
||||
(
|
||||
unsigned char port_idx,
|
||||
unsigned char* port_mode,
|
||||
unsigned char* port_speed,
|
||||
unsigned char* port_brightness,
|
||||
bool* port_random,
|
||||
unsigned char* port_red,
|
||||
unsigned char* port_green,
|
||||
unsigned char* port_blue
|
||||
)
|
||||
{
|
||||
return("HID: " + location);
|
||||
unsigned char buffer[CM_ARGB_PACKET_SIZE] = {0x00, 0x80, 0x0B, 0x01};
|
||||
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
|
||||
int rgb_offset = 0;
|
||||
int zone;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| RGB port is handled differently from ARGB ports |
|
||||
\*-----------------------------------------------------*/
|
||||
if(cm_argb_port_index_to_id[port_idx] != CM_ARGB_PORT_RGB)
|
||||
{
|
||||
zone = cm_argb_port_index_to_id[port_idx];
|
||||
buffer[CM_ARGB_COMMAND_BYTE] = 0x0B;
|
||||
}
|
||||
else
|
||||
{
|
||||
zone = 0x00;
|
||||
buffer[CM_ARGB_COMMAND_BYTE] = 0x0A;
|
||||
rgb_offset = 1;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| If this is the group then just return the first |
|
||||
| status |
|
||||
\*-----------------------------------------------------*/
|
||||
buffer[CM_ARGB_ZONE_BYTE] = ( zone > 0x08 ) ? 0x01 : zone;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send the command and read the response |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, buffer, buffer_size);
|
||||
hid_read_timeout(dev, buffer, buffer_size, CM_ARGB_INTERRUPT_TIMEOUT);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Read data out of response |
|
||||
\*-----------------------------------------------------*/
|
||||
*port_mode = buffer[4 - rgb_offset];
|
||||
*port_random = (buffer[5 - rgb_offset] == 0x00);
|
||||
*port_speed = buffer[6 - rgb_offset];
|
||||
*port_brightness = buffer[7 - rgb_offset];
|
||||
*port_red = buffer[8 - rgb_offset];
|
||||
*port_green = buffer[9 - rgb_offset];
|
||||
*port_blue = buffer[10 - rgb_offset];
|
||||
}
|
||||
|
||||
unsigned char CMARGBController::GetZoneIndex()
|
||||
void CMARGBController::SetPortLEDCount(unsigned char port_idx, unsigned char led_count)
|
||||
{
|
||||
return(zone_index);
|
||||
}
|
||||
|
||||
unsigned char CMARGBController::GetMode()
|
||||
{
|
||||
return(current_mode);
|
||||
}
|
||||
|
||||
unsigned char CMARGBController::GetLedRed()
|
||||
{
|
||||
return(current_red);
|
||||
}
|
||||
|
||||
unsigned char CMARGBController::GetLedGreen()
|
||||
{
|
||||
return(current_green);
|
||||
}
|
||||
|
||||
unsigned char CMARGBController::GetLedBlue()
|
||||
{
|
||||
return(current_blue);
|
||||
}
|
||||
|
||||
unsigned char CMARGBController::GetLedSpeed()
|
||||
{
|
||||
return(current_speed);
|
||||
}
|
||||
|
||||
bool CMARGBController::GetRandomColours()
|
||||
{
|
||||
return(bool_random);
|
||||
}
|
||||
|
||||
void CMARGBController::SetLedCount(int zone, int led_count)
|
||||
{
|
||||
unsigned char buffer[CM_ARGB_PACKET_SIZE] = { 0x00, 0x80, 0x0D, 0x02 };
|
||||
unsigned char buffer[CM_ARGB_PACKET_SIZE] = {0x00, 0x80, 0x0D, 0x02};
|
||||
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
|
||||
|
||||
buffer[CM_ARGB_ZONE_BYTE] = zone;
|
||||
buffer[CM_ARGB_ZONE_BYTE] = cm_argb_port_index_to_id[port_idx];
|
||||
buffer[CM_ARGB_MODE_BYTE] = led_count;
|
||||
buffer[CM_ARGB_COLOUR_INDEX_BYTE] = (0x0F - led_count > 0) ? 0x0F - led_count : 0x01;
|
||||
|
||||
/*---------------------------------------------*\
|
||||
| Guard the writes to the controller until the |
|
||||
| for loop has completed to avoid collisons |
|
||||
\*---------------------------------------------*/
|
||||
std::lock_guard<std::mutex> guard(*mutex_ptr);
|
||||
buffer[CM_ARGB_COLOUR_INDEX_BYTE] = 1;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send the command |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, buffer, buffer_size);
|
||||
}
|
||||
|
||||
void CMARGBController::SetMode(uint8_t mode, uint8_t speed, uint8_t brightness, RGBColor colour, bool random_colours)
|
||||
void CMARGBController::SetPortMode
|
||||
(
|
||||
unsigned char port_idx,
|
||||
unsigned char port_mode,
|
||||
unsigned char port_speed,
|
||||
unsigned char port_brightness,
|
||||
bool port_random,
|
||||
unsigned char port_red,
|
||||
unsigned char port_green,
|
||||
unsigned char port_blue
|
||||
)
|
||||
{
|
||||
bool needs_update = !( (current_mode == mode) && (current_speed == speed) && (current_brightness == brightness) && (ToRGBColor(current_red, current_green, current_blue) == colour));
|
||||
unsigned char buffer[CM_ARGB_PACKET_SIZE] = {0x00};
|
||||
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
|
||||
bool boolARGB_header = (cm_argb_port_index_to_id[port_idx] != CM_ARGB_PORT_RGB);
|
||||
bool boolPassthru = (port_mode == CM_ARGB_MODE_PASSTHRU) || (port_mode == CM_RGB_MODE_PASSTHRU);
|
||||
bool boolDirect = (port_mode == CM_ARGB_MODE_DIRECT);
|
||||
unsigned char function = boolPassthru ? (boolARGB_header ? 0x02 : 0x04) : (boolARGB_header ? 0x01 : 0x03);
|
||||
buffer[CM_ARGB_REPORT_BYTE] = 0x80;
|
||||
buffer[CM_ARGB_COMMAND_BYTE] = 0x01;
|
||||
|
||||
if (needs_update)
|
||||
if(boolDirect)
|
||||
{
|
||||
current_mode = mode;
|
||||
current_speed = speed;
|
||||
current_brightness = brightness;
|
||||
current_red = RGBGetRValue(colour);
|
||||
current_green = RGBGetGValue(colour);
|
||||
current_blue = RGBGetBValue(colour);
|
||||
bool_random = random_colours;
|
||||
buffer[CM_ARGB_FUNCTION_BYTE] = 0x01;
|
||||
buffer[CM_ARGB_ZONE_BYTE] = 0x02;
|
||||
|
||||
SendUpdate();
|
||||
/*-------------------------------------------------*\
|
||||
| Send the command |
|
||||
\*-------------------------------------------------*/
|
||||
hid_write(dev, buffer, buffer_size);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Direct mode is now set up and no other mode |
|
||||
| packet is required |
|
||||
\*-------------------------------------------------*/
|
||||
return;
|
||||
}
|
||||
|
||||
buffer[CM_ARGB_FUNCTION_BYTE] = function;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send the command |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, buffer, buffer_size);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| ARGB ports send command 0x0B, RGB port sends 0x04 |
|
||||
\*-----------------------------------------------------*/
|
||||
if(boolARGB_header)
|
||||
{
|
||||
buffer[CM_ARGB_COMMAND_BYTE] = 0x0B;
|
||||
buffer[CM_ARGB_FUNCTION_BYTE] = (false) ? 0x01 : 0x02;
|
||||
buffer[CM_ARGB_ZONE_BYTE] = cm_argb_port_index_to_id[port_idx];
|
||||
buffer[CM_ARGB_MODE_BYTE] = port_mode;
|
||||
buffer[CM_ARGB_COLOUR_INDEX_BYTE] = port_random ? 0x00 : 0x10;
|
||||
buffer[CM_ARGB_SPEED_BYTE] = port_speed;
|
||||
buffer[CM_ARGB_BRIGHTNESS_BYTE] = port_brightness;
|
||||
buffer[CM_ARGB_RED_BYTE] = port_red;
|
||||
buffer[CM_ARGB_GREEN_BYTE] = port_green;
|
||||
buffer[CM_ARGB_BLUE_BYTE] = port_blue;
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer[CM_ARGB_COMMAND_BYTE] = boolPassthru ? 0x01 : 0x04;
|
||||
buffer[CM_ARGB_MODE_BYTE + CM_RGB_OFFSET] = port_mode;
|
||||
buffer[CM_ARGB_COLOUR_INDEX_BYTE + CM_RGB_OFFSET] = port_random ? 0x00 : 0x10;
|
||||
buffer[CM_ARGB_SPEED_BYTE + CM_RGB_OFFSET] = port_speed;
|
||||
buffer[CM_ARGB_BRIGHTNESS_BYTE + CM_RGB_OFFSET] = port_brightness;
|
||||
buffer[CM_ARGB_RED_BYTE + CM_RGB_OFFSET] = port_red;
|
||||
buffer[CM_ARGB_GREEN_BYTE + CM_RGB_OFFSET] = port_green;
|
||||
buffer[CM_ARGB_BLUE_BYTE + CM_RGB_OFFSET] = port_blue;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send the command and wait for response |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, buffer, buffer_size);
|
||||
}
|
||||
|
||||
void CMARGBController::SetLedsDirect(RGBColor *led_colours, unsigned int led_count)
|
||||
void CMARGBController::SetPortLEDsDirect(unsigned char port_idx, RGBColor *led_colours, unsigned int led_count)
|
||||
{
|
||||
const unsigned char buffer_size = CM_ARGB_PACKET_SIZE;
|
||||
unsigned char buffer[buffer_size] = { 0x00, 0x00, 0x07, 0x02 };
|
||||
unsigned char packet_count = 0;
|
||||
std::vector<uint8_t> colours;
|
||||
|
||||
/*---------------------------------------------*\
|
||||
| Set up the RGB triplets to send |
|
||||
\*---------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up the RGB triplets to send |
|
||||
\*-----------------------------------------------------*/
|
||||
for(unsigned int i = 0; i < led_count; i++)
|
||||
{
|
||||
RGBColor colour = led_colours[i];
|
||||
|
||||
colours.push_back( RGBGetRValue(colour) );
|
||||
colours.push_back( RGBGetGValue(colour) );
|
||||
colours.push_back( RGBGetBValue(colour) );
|
||||
colours.push_back(RGBGetRValue(colour));
|
||||
colours.push_back(RGBGetGValue(colour));
|
||||
colours.push_back(RGBGetBValue(colour));
|
||||
}
|
||||
|
||||
buffer[CM_ARGB_FUNCTION_BYTE] = zone_index - 1;
|
||||
buffer[CM_ARGB_FUNCTION_BYTE] = port_idx;
|
||||
buffer[CM_ARGB_ZONE_BYTE] = led_count;
|
||||
unsigned char buffer_idx = CM_ARGB_MODE_BYTE;
|
||||
|
||||
/*---------------------------------------------*\
|
||||
| Guard the writes to the controller until the |
|
||||
| for loop has completed to avoid collisons |
|
||||
\*---------------------------------------------*/
|
||||
std::lock_guard<std::mutex> guard(*mutex_ptr);
|
||||
|
||||
for(std::vector<unsigned char>::iterator it = colours.begin(); it != colours.end(); buffer_idx = CM_ARGB_COMMAND_BYTE)
|
||||
{
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Fill the write buffer till its full or the colour buffer is empty |
|
||||
\*-----------------------------------------------------------------*/
|
||||
/*-------------------------------------------------*\
|
||||
| Fill the write buffer till its full or the |
|
||||
| colour buffer is empty |
|
||||
\*-------------------------------------------------*/
|
||||
buffer[CM_ARGB_REPORT_BYTE] = packet_count;
|
||||
while (( buffer_idx < buffer_size) && ( it != colours.end() ))
|
||||
while((buffer_idx < buffer_size) && (it != colours.end()))
|
||||
{
|
||||
buffer[buffer_idx] = *it;
|
||||
buffer_idx++;
|
||||
@@ -223,76 +284,15 @@ void CMARGBController::SetLedsDirect(RGBColor *led_colours, unsigned int led_cou
|
||||
buffer[CM_ARGB_REPORT_BYTE] += 0x80;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Send the buffer |
|
||||
\*-------------------------------------------------*/
|
||||
hid_write(dev, buffer, buffer_size);
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Reset the write buffer |
|
||||
\*-----------------------------------------------------------------*/
|
||||
/*-------------------------------------------------*\
|
||||
| Reset the write buffer |
|
||||
\*-------------------------------------------------*/
|
||||
memset(buffer, 0x00, buffer_size );
|
||||
packet_count++;
|
||||
}
|
||||
}
|
||||
|
||||
void CMARGBController::SendUpdate()
|
||||
{
|
||||
/*---------------------------------------------*\
|
||||
| Guard the writes to the controller |
|
||||
\*---------------------------------------------*/
|
||||
std::lock_guard<std::mutex> guard(*mutex_ptr);
|
||||
|
||||
unsigned char buffer[CM_ARGB_PACKET_SIZE] = { 0x00 };
|
||||
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
|
||||
bool boolARGB_header = argb_header_data[zone_index].digital;
|
||||
bool boolPassthru = ( current_mode == CM_ARGB_MODE_PASSTHRU ) || ( current_mode == CM_RGB_MODE_PASSTHRU );
|
||||
bool boolDirect = ( current_mode == CM_ARGB_MODE_DIRECT );
|
||||
unsigned char function = boolPassthru ? (boolARGB_header ? 0x02 : 0x04) : (boolARGB_header ? 0x01 : 0x03);
|
||||
buffer[CM_ARGB_REPORT_BYTE] = 0x80;
|
||||
buffer[CM_ARGB_COMMAND_BYTE] = 0x01;
|
||||
|
||||
if(boolDirect)
|
||||
{
|
||||
buffer[CM_ARGB_FUNCTION_BYTE] = 0x01;
|
||||
buffer[CM_ARGB_ZONE_BYTE] = 0x02;
|
||||
|
||||
hid_write(dev, buffer, buffer_size);
|
||||
hid_read_timeout(dev, buffer, buffer_size, CM_ARGB_INTERRUPT_TIMEOUT);
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Direct mode is now set up and no other mode packet is required |
|
||||
\*-----------------------------------------------------------------*/
|
||||
return;
|
||||
}
|
||||
|
||||
buffer[CM_ARGB_FUNCTION_BYTE] = function;
|
||||
|
||||
hid_write(dev, buffer, buffer_size);
|
||||
hid_read_timeout(dev, buffer, buffer_size, CM_ARGB_INTERRUPT_TIMEOUT);
|
||||
|
||||
if(boolARGB_header)
|
||||
{
|
||||
buffer[CM_ARGB_COMMAND_BYTE] = 0x0B; //ARGB sends 0x0B (1011) RGB sends 0x04 (0100)
|
||||
buffer[CM_ARGB_FUNCTION_BYTE] = (false) ? 0x01 : 0x02; //This controls direct mode TODO
|
||||
buffer[CM_ARGB_ZONE_BYTE] = argb_header_data[zone_index].header;
|
||||
buffer[CM_ARGB_MODE_BYTE] = current_mode;
|
||||
buffer[CM_ARGB_COLOUR_INDEX_BYTE] = bool_random ? 0x00 : 0x10;
|
||||
buffer[CM_ARGB_SPEED_BYTE] = current_speed;
|
||||
buffer[CM_ARGB_BRIGHTNESS_BYTE] = current_brightness;
|
||||
buffer[CM_ARGB_RED_BYTE] = current_red;
|
||||
buffer[CM_ARGB_GREEN_BYTE] = current_green;
|
||||
buffer[CM_ARGB_BLUE_BYTE] = current_blue;
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer[CM_ARGB_COMMAND_BYTE] = boolPassthru ? 0x01 : 0x04; //ARGB sends 0x0b (1011) RGB sends 0x04 (0100)
|
||||
buffer[CM_ARGB_MODE_BYTE + CM_RGB_OFFSET] = current_mode;
|
||||
buffer[CM_ARGB_COLOUR_INDEX_BYTE + CM_RGB_OFFSET] = bool_random ? 0x00 : 0x10;
|
||||
buffer[CM_ARGB_SPEED_BYTE + CM_RGB_OFFSET] = current_speed;
|
||||
buffer[CM_ARGB_BRIGHTNESS_BYTE + CM_RGB_OFFSET] = current_brightness;
|
||||
buffer[CM_ARGB_RED_BYTE + CM_RGB_OFFSET] = current_red;
|
||||
buffer[CM_ARGB_GREEN_BYTE + CM_RGB_OFFSET] = current_green;
|
||||
buffer[CM_ARGB_BLUE_BYTE + CM_RGB_OFFSET] = current_blue;
|
||||
}
|
||||
|
||||
hid_write(dev, buffer, buffer_size);
|
||||
hid_read_timeout(dev, buffer, buffer_size, CM_ARGB_INTERRUPT_TIMEOUT);
|
||||
}
|
||||
|
||||
@@ -16,19 +16,20 @@
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <hidapi.h>
|
||||
#include "RGBController.h" //Needed to set the direct mode
|
||||
#include "RGBController.h"
|
||||
|
||||
#define CM_ARGB_COLOUR_MODE_DATA_SIZE (sizeof(colour_mode_data[0]) / sizeof(colour_mode_data[0][0]))
|
||||
#define CM_ARGB_HEADER_DATA_SIZE (sizeof(argb_header_data) / sizeof(argb_headers) )
|
||||
#define CM_ARGB_INTERRUPT_TIMEOUT 250
|
||||
#define CM_ARGB_PACKET_SIZE 65
|
||||
#define CM_ARGB_DEVICE_NAME_SIZE (sizeof(device_name) / sizeof(device_name[ 0 ]))
|
||||
#define CM_RGB_OFFSET -2
|
||||
#define HID_MAX_STR 255
|
||||
#define CM_ARGB_COLOUR_MODE_DATA_SIZE (sizeof(colour_mode_data[0]) / sizeof(colour_mode_data[0][0]))
|
||||
#define CM_ARGB_HEADER_DATA_SIZE (sizeof(argb_header_data) / sizeof(argb_headers) )
|
||||
#define CM_ARGB_INTERRUPT_TIMEOUT 250
|
||||
#define CM_ARGB_PACKET_SIZE 65
|
||||
#define CM_ARGB_DEVICE_NAME_SIZE (sizeof(device_name) / sizeof(device_name[ 0 ]))
|
||||
#define CM_RGB_OFFSET -2
|
||||
#define HID_MAX_STR 255
|
||||
|
||||
#define CM_ARGB_BRIGHTNESS_MAX 255
|
||||
#define CM_ARGB_FW0023 std::string("A202011171238")
|
||||
#define CM_ARGB_FW0028 std::string("A202105291658")
|
||||
#define CM_ARGB_BRIGHTNESS_MAX 255
|
||||
#define CM_ARGB_FW0000 std::string("A201804091608")
|
||||
#define CM_ARGB_FW0023 std::string("A202011171238")
|
||||
#define CM_ARGB_FW0028 std::string("A202105291658")
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -45,22 +46,13 @@ enum
|
||||
CM_ARGB_BLUE_BYTE = 11
|
||||
};
|
||||
|
||||
struct argb_headers
|
||||
enum
|
||||
{
|
||||
const char* name;
|
||||
unsigned char header;
|
||||
bool digital;
|
||||
unsigned int count;
|
||||
};
|
||||
|
||||
static argb_headers argb_header_data[] =
|
||||
{
|
||||
{ "RGB Header", 0xFE, false, 1 },
|
||||
{ "Digital ARGB1", 0x01, true, 12 },
|
||||
{ "Digital ARGB2", 0x02, true, 12 },
|
||||
{ "Digital ARGB3", 0x04, true, 12 },
|
||||
{ "Digital ARGB4", 0x08, true, 12 },
|
||||
//{ "All Digital ARGB", 0xFF, true, 12 }
|
||||
CM_ARGB_PORT_ARGB_1 = 0x01,
|
||||
CM_ARGB_PORT_ARGB_2 = 0x02,
|
||||
CM_ARGB_PORT_ARGB_3 = 0x04,
|
||||
CM_ARGB_PORT_ARGB_4 = 0x08,
|
||||
CM_ARGB_PORT_RGB = 0xFE,
|
||||
};
|
||||
|
||||
enum
|
||||
@@ -101,40 +93,44 @@ enum
|
||||
class CMARGBController
|
||||
{
|
||||
public:
|
||||
CMARGBController(hid_device* dev_handle, char *_path, unsigned char _zone_idx, std::shared_ptr<std::mutex> cm_mutex);
|
||||
CMARGBController(hid_device* dev_handle, char* path);
|
||||
~CMARGBController();
|
||||
|
||||
std::string GetDeviceName();
|
||||
std::string GetSerial();
|
||||
std::string GetLocation();
|
||||
std::string GetVersion();
|
||||
|
||||
unsigned char GetZoneIndex();
|
||||
unsigned char GetMode();
|
||||
unsigned char GetLedRed();
|
||||
unsigned char GetLedGreen();
|
||||
unsigned char GetLedBlue();
|
||||
unsigned char GetLedSpeed();
|
||||
bool GetRandomColours();
|
||||
void SetLedCount(int zone, int led_count);
|
||||
void SetMode(uint8_t mode, uint8_t speed, uint8_t brightness, RGBColor colour, bool random_colours);
|
||||
void SetLedsDirect(RGBColor * led_colours, unsigned int led_count);
|
||||
void GetPortStatus
|
||||
(
|
||||
unsigned char port_idx,
|
||||
unsigned char* port_mode,
|
||||
unsigned char* port_speed,
|
||||
unsigned char* port_brightness,
|
||||
bool* port_random,
|
||||
unsigned char* port_red,
|
||||
unsigned char* port_green,
|
||||
unsigned char* port_blue
|
||||
);
|
||||
|
||||
void SetPortLEDCount(unsigned char port_idx, unsigned char led_count);
|
||||
|
||||
void SetPortMode
|
||||
(
|
||||
unsigned char port_idx,
|
||||
unsigned char port_mode,
|
||||
unsigned char port_speed,
|
||||
unsigned char port_brightness,
|
||||
bool port_random,
|
||||
unsigned char port_red,
|
||||
unsigned char port_green,
|
||||
unsigned char port_blue
|
||||
);
|
||||
|
||||
void SetPortLEDsDirect(unsigned char port_idx, RGBColor *led_colours, unsigned int led_count);
|
||||
|
||||
private:
|
||||
std::string device_name;
|
||||
std::string location;
|
||||
hid_device* dev;
|
||||
std::shared_ptr<std::mutex> mutex_ptr;
|
||||
|
||||
unsigned char zone_index;
|
||||
unsigned char current_mode;
|
||||
unsigned char current_speed;
|
||||
|
||||
unsigned char current_red;
|
||||
unsigned char current_green;
|
||||
unsigned char current_blue;
|
||||
unsigned char current_brightness;
|
||||
bool bool_random;
|
||||
|
||||
void GetStatus();
|
||||
void SendUpdate();
|
||||
hid_device* dev;
|
||||
std::string device_name;
|
||||
std::string location;
|
||||
};
|
||||
|
||||
+515
-322
@@ -27,401 +27,594 @@
|
||||
RGBController_CMARGBController::RGBController_CMARGBController(CMARGBController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
unsigned char speed = controller->GetLedSpeed();
|
||||
|
||||
name = argb_header_data[controller->GetZoneIndex()].name;
|
||||
name = controller->GetDeviceName();
|
||||
vendor = "Cooler Master";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
description = controller->GetDeviceName();
|
||||
version = "3.0 for FW0028";
|
||||
description = "Cooler Master ARGB Controller Device";
|
||||
version = controller->GetVersion();
|
||||
serial = controller->GetSerial();
|
||||
location = controller->GetLocation();
|
||||
|
||||
if(argb_header_data[controller->GetZoneIndex()].digital)
|
||||
{
|
||||
mode Off;
|
||||
Off.name = "Turn Off";
|
||||
Off.value = CM_ARGB_MODE_OFF;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Reload;
|
||||
Reload.name = "Reload";
|
||||
Reload.value = CM_ARGB_MODE_RELOAD;
|
||||
Reload.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Reload.colors_min = 1;
|
||||
Reload.colors_max = 1;
|
||||
Reload.colors.resize(Reload.colors_max);
|
||||
Reload.brightness_min = 0;
|
||||
Reload.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Reload.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Reload.speed_min = CM_ARGB_SPEED_SLOWEST;
|
||||
Reload.speed_max = CM_ARGB_SPEED_FASTEST;
|
||||
Reload.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Reload.speed = speed;
|
||||
modes.push_back(Reload);
|
||||
|
||||
mode Recoil;
|
||||
Recoil.name = "Recoil";
|
||||
Recoil.value = CM_ARGB_MODE_RECOIL;
|
||||
Recoil.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Recoil.colors_min = 1;
|
||||
Recoil.colors_max = 1;
|
||||
Recoil.colors.resize(Recoil.colors_max);
|
||||
Recoil.brightness_min = 0;
|
||||
Recoil.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Recoil.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Recoil.speed_min = CM_ARGB_SPEED_SLOWEST;
|
||||
Recoil.speed_max = CM_ARGB_SPEED_FASTEST;
|
||||
Recoil.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Recoil.speed = speed;
|
||||
modes.push_back(Recoil);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = CM_ARGB_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Breathing.colors_min = 1;
|
||||
Breathing.colors_max = 1;
|
||||
Breathing.colors.resize(Breathing.colors_max);
|
||||
Breathing.brightness_min = 0;
|
||||
Breathing.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Breathing.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Breathing.speed_min = CM_ARGB_SPEED_SLOWEST;
|
||||
Breathing.speed_max = CM_ARGB_SPEED_FASTEST;
|
||||
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Breathing.speed = speed;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Refill;
|
||||
Refill.name = "Refill";
|
||||
Refill.value = CM_ARGB_MODE_REFILL;
|
||||
Refill.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Refill.colors_min = 1;
|
||||
Refill.colors_max = 1;
|
||||
Refill.colors.resize(Refill.colors_max);
|
||||
Refill.brightness_min = 0;
|
||||
Refill.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Refill.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Refill.speed_min = CM_ARGB_SPEED_SLOWEST;
|
||||
Refill.speed_max = CM_ARGB_SPEED_FASTEST;
|
||||
Refill.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Refill.speed = speed;
|
||||
modes.push_back(Refill);
|
||||
|
||||
mode Demo;
|
||||
Demo.name = "Demo";
|
||||
Demo.value = CM_ARGB_MODE_DEMO;
|
||||
Demo.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Demo.brightness_min = 0;
|
||||
Demo.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Demo.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Demo.speed_min = CM_ARGB_SPEED_SLOWEST;
|
||||
Demo.speed_max = CM_ARGB_SPEED_FASTEST;
|
||||
Demo.color_mode = MODE_COLORS_NONE;
|
||||
Demo.speed = speed;
|
||||
modes.push_back(Demo);
|
||||
|
||||
mode Spectrum;
|
||||
Spectrum.name = "Spectrum";
|
||||
Spectrum.value = CM_ARGB_MODE_SPECTRUM;
|
||||
Spectrum.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Spectrum.brightness_min = 0;
|
||||
Spectrum.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Spectrum.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Spectrum.speed_min = CM_ARGB_SPEED_SLOWEST;
|
||||
Spectrum.speed_max = CM_ARGB_SPEED_FASTEST;
|
||||
Spectrum.color_mode = MODE_COLORS_NONE;
|
||||
Spectrum.speed = speed;
|
||||
modes.push_back(Spectrum);
|
||||
|
||||
mode FillFlow;
|
||||
FillFlow.name = "Fill Flow";
|
||||
FillFlow.value = CM_ARGB_MODE_FILLFLOW;
|
||||
FillFlow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
FillFlow.brightness_min = 0;
|
||||
FillFlow.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
FillFlow.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
FillFlow.speed_min = CM_ARGB_SPEED_SLOWEST;
|
||||
FillFlow.speed_max = CM_ARGB_SPEED_FASTEST;
|
||||
FillFlow.color_mode = MODE_COLORS_NONE;
|
||||
FillFlow.speed = speed;
|
||||
modes.push_back(FillFlow);
|
||||
|
||||
mode Rainbow;
|
||||
Rainbow.name = "Rainbow";
|
||||
Rainbow.value = CM_ARGB_MODE_RAINBOW;
|
||||
Rainbow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Rainbow.brightness_min = 0;
|
||||
Rainbow.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Rainbow.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Rainbow.speed_min = CM_ARGB_SPEED_SLOWEST;
|
||||
Rainbow.speed_max = CM_ARGB_SPEED_FASTEST;
|
||||
Rainbow.color_mode = MODE_COLORS_NONE;
|
||||
Rainbow.speed = speed;
|
||||
modes.push_back(Rainbow);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = CM_ARGB_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Static.colors_min = 1;
|
||||
Static.colors_max = 1;
|
||||
Static.colors.resize(Static.colors_max);
|
||||
Static.brightness_min = 0;
|
||||
Static.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Static.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Static.speed_min = CM_ARGB_SPEED_SLOWEST;
|
||||
Static.speed_max = CM_ARGB_SPEED_FASTEST;
|
||||
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Static.speed = speed;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Direct;
|
||||
Direct.name = (serial >= CM_ARGB_FW0028) ? "Direct" : "Custom";
|
||||
Direct.value = CM_ARGB_MODE_DIRECT;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode PassThru;
|
||||
PassThru.name = "Pass Thru";
|
||||
PassThru.value = CM_ARGB_MODE_PASSTHRU;
|
||||
PassThru.flags = 0;
|
||||
PassThru.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(PassThru);
|
||||
}
|
||||
else
|
||||
{
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = CM_RGB_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Static.colors_min = 1;
|
||||
Static.colors_max = 1;
|
||||
Static.colors.resize(Static.colors_max);
|
||||
Static.brightness_min = 0;
|
||||
Static.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Static.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Static.speed = 0;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = CM_RGB_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Breathing.colors_min = 1;
|
||||
Breathing.colors_max = 1;
|
||||
Breathing.colors.resize(Breathing.colors_max);
|
||||
Breathing.brightness_min = 0;
|
||||
Breathing.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Breathing.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Breathing.speed_min = CM_ARGB_SPEED_SLOWEST;
|
||||
Breathing.speed_max = CM_ARGB_SPEED_FASTEST;
|
||||
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Breathing.speed = CM_ARGB_SPEED_NORMAL;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Flash;
|
||||
Flash.name = "Flash";
|
||||
Flash.value = CM_RGB_MODE_FLASH;
|
||||
Flash.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Flash.colors_min = 1;
|
||||
Flash.colors_max = 1;
|
||||
Flash.colors.resize(Flash.colors_max);
|
||||
Flash.brightness_min = 0;
|
||||
Flash.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Flash.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Flash.speed_min = CM_ARGB_SPEED_SLOWEST;
|
||||
Flash.speed_max = CM_ARGB_SPEED_FASTEST;
|
||||
Flash.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Flash.speed = CM_ARGB_SPEED_NORMAL;
|
||||
modes.push_back(Flash);
|
||||
|
||||
mode Mirage;
|
||||
Mirage.name = "Mirage";
|
||||
Mirage.value = CM_RGB_MODE_MIRAGE;
|
||||
Mirage.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Mirage.colors_min = 1;
|
||||
Mirage.colors_max = 1;
|
||||
Mirage.colors.resize(Mirage.colors_max);
|
||||
Mirage.brightness_min = 0;
|
||||
Mirage.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Mirage.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Mirage.speed_min = CM_ARGB_SPEED_SLOWEST;
|
||||
Mirage.speed_max = CM_ARGB_SPEED_FASTEST;
|
||||
Mirage.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Mirage.speed = CM_ARGB_SPEED_NORMAL;
|
||||
modes.push_back(Mirage);
|
||||
|
||||
mode PassThru;
|
||||
PassThru.name = "Pass Thru";
|
||||
PassThru.value = CM_RGB_MODE_PASSTHRU;
|
||||
PassThru.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(PassThru);
|
||||
|
||||
mode Off;
|
||||
Off.name = "Turn Off";
|
||||
Off.value = CM_RGB_MODE_OFF;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
}
|
||||
|
||||
Init_Controller();
|
||||
SetupZones();
|
||||
SetupModes();
|
||||
|
||||
int temp_mode = controller->GetMode();
|
||||
for(int mode_idx = 0; mode_idx < (int)modes.size() ; mode_idx++)
|
||||
/*-----------------------------------------------------*\
|
||||
| Initialize the active mode to port 0 |
|
||||
\*-----------------------------------------------------*/
|
||||
unsigned char port_mode;
|
||||
unsigned char port_speed;
|
||||
unsigned char port_brightness;
|
||||
bool port_random;
|
||||
unsigned char port_red;
|
||||
unsigned char port_green;
|
||||
unsigned char port_blue;
|
||||
|
||||
controller->GetPortStatus(0, &port_mode, &port_speed, &port_brightness, &port_random, &port_red, &port_green, &port_blue);
|
||||
|
||||
for(std::size_t mode_idx = 0; mode_idx < modes.size(); mode_idx++)
|
||||
{
|
||||
if (temp_mode == modes[mode_idx].value)
|
||||
if(modes[mode_idx].value == port_mode)
|
||||
{
|
||||
active_mode = mode_idx;
|
||||
active_mode = (int)mode_idx;
|
||||
|
||||
if((modes[mode_idx].flags & MODE_FLAG_HAS_MODE_SPECIFIC_COLOR) && (modes[mode_idx].colors.size() > 0))
|
||||
{
|
||||
modes[mode_idx].colors[0] = ToRGBColor(port_red, port_green, port_blue);
|
||||
}
|
||||
|
||||
if(modes[mode_idx].flags & MODE_FLAG_HAS_SPEED)
|
||||
{
|
||||
modes[mode_idx].speed = port_speed;
|
||||
}
|
||||
|
||||
if(modes[mode_idx].flags & MODE_FLAG_HAS_BRIGHTNESS)
|
||||
{
|
||||
modes[mode_idx].brightness = port_brightness;
|
||||
}
|
||||
|
||||
if(modes[mode_idx].flags & MODE_FLAG_HAS_RANDOM_COLOR)
|
||||
{
|
||||
if(port_random)
|
||||
{
|
||||
modes[mode_idx].color_mode = MODE_COLORS_RANDOM;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (modes[active_mode].flags & MODE_FLAG_HAS_MODE_SPECIFIC_COLOR)
|
||||
{
|
||||
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 = controller->GetLedSpeed();
|
||||
}
|
||||
}
|
||||
|
||||
RGBController_CMARGBController::~RGBController_CMARGBController()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CMARGBController::Init_Controller()
|
||||
void RGBController_CMARGBController::SetupModes()
|
||||
{
|
||||
int zone_idx = controller->GetZoneIndex();
|
||||
int zone_led_count = argb_header_data[zone_idx].count;
|
||||
/*-----------------------------------------------------*\
|
||||
| Define Direct and Passthrough modes as require entire |
|
||||
| device, these are not available as per-zone modes |
|
||||
\*-----------------------------------------------------*/
|
||||
mode Direct;
|
||||
Direct.name = (serial >= CM_ARGB_FW0028) ? "Direct" : "Custom";
|
||||
Direct.value = CM_ARGB_MODE_DIRECT;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_REQUIRES_ENTIRE_DEVICE;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| If argb_header_data[zone_idx].count == 1 then the |
|
||||
| zone is ZONE_TYPE_SINGLE |
|
||||
\*-------------------------------------------------*/
|
||||
bool boolSingleLED = ( zone_led_count == 1 );
|
||||
mode PassThru;
|
||||
PassThru.name = "Passthrough";
|
||||
PassThru.value = CM_ARGB_MODE_PASSTHRU | MODE_FLAG_REQUIRES_ENTIRE_DEVICE;
|
||||
PassThru.flags = 0;
|
||||
PassThru.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(PassThru);
|
||||
|
||||
zone ARGB_zone;
|
||||
ARGB_zone.name = std::to_string(zone_idx);
|
||||
ARGB_zone.type = (boolSingleLED) ? ZONE_TYPE_SINGLE : ZONE_TYPE_LINEAR;
|
||||
ARGB_zone.leds_min = 4;
|
||||
ARGB_zone.leds_max = 48;
|
||||
ARGB_zone.leds_count = zone_led_count;
|
||||
zones.push_back(ARGB_zone);
|
||||
/*-----------------------------------------------------*\
|
||||
| The ARGB ports support more modes than the RGB port. |
|
||||
| Define all of the modes the ARGB ports support and |
|
||||
| map RGB modes to them as best as we can. |
|
||||
\*-----------------------------------------------------*/
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = CM_ARGB_MODE_OFF;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
|
||||
{
|
||||
zones[zone_idx].modes.push_back(Off);
|
||||
}
|
||||
|
||||
mode Reload;
|
||||
Reload.name = "Reload";
|
||||
Reload.value = CM_ARGB_MODE_RELOAD;
|
||||
Reload.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Reload.speed_min = CM_ARGB_SPEED_SLOWEST;
|
||||
Reload.speed_max = CM_ARGB_SPEED_FASTEST;
|
||||
Reload.speed = CM_ARGB_SPEED_NORMAL;
|
||||
Reload.brightness_min = 0;
|
||||
Reload.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Reload.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Reload.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Reload.colors_min = 1;
|
||||
Reload.colors_max = 1;
|
||||
Reload.colors.resize(Reload.colors_max);
|
||||
modes.push_back(Reload);
|
||||
|
||||
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
|
||||
{
|
||||
zones[zone_idx].modes.push_back(Reload);
|
||||
}
|
||||
|
||||
mode Recoil;
|
||||
Recoil.name = "Recoil";
|
||||
Recoil.value = CM_ARGB_MODE_RECOIL;
|
||||
Recoil.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Recoil.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Recoil.speed_min = CM_ARGB_SPEED_SLOWEST;
|
||||
Recoil.speed_max = CM_ARGB_SPEED_FASTEST;
|
||||
Recoil.speed = CM_ARGB_SPEED_NORMAL;
|
||||
Recoil.brightness_min = 0;
|
||||
Recoil.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Recoil.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Recoil.colors_min = 1;
|
||||
Recoil.colors_max = 1;
|
||||
Recoil.colors.resize(Recoil.colors_max);
|
||||
modes.push_back(Recoil);
|
||||
|
||||
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
|
||||
{
|
||||
zones[zone_idx].modes.push_back(Recoil);
|
||||
}
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = CM_ARGB_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Breathing.speed_min = CM_ARGB_SPEED_SLOWEST;
|
||||
Breathing.speed_max = CM_ARGB_SPEED_FASTEST;
|
||||
Breathing.speed = CM_ARGB_SPEED_NORMAL;
|
||||
Breathing.brightness_min = 0;
|
||||
Breathing.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Breathing.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Breathing.colors_min = 1;
|
||||
Breathing.colors_max = 1;
|
||||
Breathing.colors.resize(Breathing.colors_max);
|
||||
modes.push_back(Breathing);
|
||||
|
||||
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
|
||||
{
|
||||
zones[zone_idx].modes.push_back(Breathing);
|
||||
}
|
||||
|
||||
mode Refill;
|
||||
Refill.name = "Refill";
|
||||
Refill.value = CM_ARGB_MODE_REFILL;
|
||||
Refill.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Refill.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Refill.speed_min = CM_ARGB_SPEED_SLOWEST;
|
||||
Refill.speed_max = CM_ARGB_SPEED_FASTEST;
|
||||
Refill.speed = CM_ARGB_SPEED_NORMAL;
|
||||
Refill.brightness_min = 0;
|
||||
Refill.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Refill.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Refill.colors_min = 1;
|
||||
Refill.colors_max = 1;
|
||||
Refill.colors.resize(Refill.colors_max);
|
||||
modes.push_back(Refill);
|
||||
|
||||
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
|
||||
{
|
||||
zones[zone_idx].modes.push_back(Refill);
|
||||
}
|
||||
|
||||
mode Demo;
|
||||
Demo.name = "Demo";
|
||||
Demo.value = CM_ARGB_MODE_DEMO;
|
||||
Demo.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Demo.color_mode = MODE_COLORS_NONE;
|
||||
Demo.speed_min = CM_ARGB_SPEED_SLOWEST;
|
||||
Demo.speed_max = CM_ARGB_SPEED_FASTEST;
|
||||
Demo.speed = CM_ARGB_SPEED_NORMAL;
|
||||
Demo.brightness_min = 0;
|
||||
Demo.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Demo.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
modes.push_back(Demo);
|
||||
|
||||
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
|
||||
{
|
||||
zones[zone_idx].modes.push_back(Demo);
|
||||
}
|
||||
|
||||
mode Spectrum;
|
||||
Spectrum.name = "Rainbow Wave";
|
||||
Spectrum.value = CM_ARGB_MODE_SPECTRUM;
|
||||
Spectrum.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Spectrum.color_mode = MODE_COLORS_NONE;
|
||||
Spectrum.speed_min = CM_ARGB_SPEED_SLOWEST;
|
||||
Spectrum.speed_max = CM_ARGB_SPEED_FASTEST;
|
||||
Spectrum.speed = CM_ARGB_SPEED_NORMAL;
|
||||
Spectrum.brightness_min = 0;
|
||||
Spectrum.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Spectrum.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
modes.push_back(Spectrum);
|
||||
|
||||
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
|
||||
{
|
||||
zones[zone_idx].modes.push_back(Spectrum);
|
||||
}
|
||||
|
||||
mode FillFlow;
|
||||
FillFlow.name = "Fill Flow";
|
||||
FillFlow.value = CM_ARGB_MODE_FILLFLOW;
|
||||
FillFlow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
FillFlow.color_mode = MODE_COLORS_NONE;
|
||||
FillFlow.speed_min = CM_ARGB_SPEED_SLOWEST;
|
||||
FillFlow.speed_max = CM_ARGB_SPEED_FASTEST;
|
||||
FillFlow.speed = CM_ARGB_SPEED_NORMAL;
|
||||
FillFlow.brightness_min = 0;
|
||||
FillFlow.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
FillFlow.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
modes.push_back(FillFlow);
|
||||
|
||||
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
|
||||
{
|
||||
zones[zone_idx].modes.push_back(FillFlow);
|
||||
}
|
||||
|
||||
mode Rainbow;
|
||||
Rainbow.name = "Rainbow";
|
||||
Rainbow.value = CM_ARGB_MODE_RAINBOW;
|
||||
Rainbow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Rainbow.color_mode = MODE_COLORS_NONE;
|
||||
Rainbow.speed_min = CM_ARGB_SPEED_SLOWEST;
|
||||
Rainbow.speed_max = CM_ARGB_SPEED_FASTEST;
|
||||
Rainbow.speed = CM_ARGB_SPEED_NORMAL;
|
||||
Rainbow.brightness_min = 0;
|
||||
Rainbow.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Rainbow.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
modes.push_back(Rainbow);
|
||||
|
||||
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
|
||||
{
|
||||
zones[zone_idx].modes.push_back(Rainbow);
|
||||
}
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = CM_ARGB_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Static.brightness_min = 0;
|
||||
Static.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Static.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
Static.colors_min = 1;
|
||||
Static.colors_max = 1;
|
||||
Static.colors.resize(Static.colors_max);
|
||||
modes.push_back(Static);
|
||||
|
||||
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
|
||||
{
|
||||
zones[zone_idx].modes.push_back(Static);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Define zone-specific modes for the RGB port |
|
||||
\*-----------------------------------------------------*/
|
||||
mode RGBOff;
|
||||
RGBOff.name = "Off";
|
||||
RGBOff.value = CM_RGB_MODE_OFF;
|
||||
RGBOff.color_mode = MODE_COLORS_NONE;
|
||||
zones[4].modes.push_back(RGBOff);
|
||||
|
||||
mode RGBMirage;
|
||||
RGBMirage.name = "Mirage";
|
||||
RGBMirage.value = CM_RGB_MODE_MIRAGE;
|
||||
RGBMirage.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
RGBMirage.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
RGBMirage.speed_min = CM_ARGB_SPEED_SLOWEST;
|
||||
RGBMirage.speed_max = CM_ARGB_SPEED_FASTEST;
|
||||
RGBMirage.speed = CM_ARGB_SPEED_NORMAL;
|
||||
RGBMirage.brightness_min = 0;
|
||||
RGBMirage.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
RGBMirage.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
RGBMirage.colors_min = 1;
|
||||
RGBMirage.colors_max = 1;
|
||||
RGBMirage.colors.resize(RGBMirage.colors_max);
|
||||
zones[4].modes.push_back(RGBMirage);
|
||||
|
||||
mode RGBFlash;
|
||||
RGBFlash.name = "Flash";
|
||||
RGBFlash.value = CM_RGB_MODE_FLASH;
|
||||
RGBFlash.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
RGBFlash.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
RGBFlash.speed_min = CM_ARGB_SPEED_SLOWEST;
|
||||
RGBFlash.speed_max = CM_ARGB_SPEED_FASTEST;
|
||||
RGBFlash.speed = CM_ARGB_SPEED_NORMAL;
|
||||
RGBFlash.brightness_min = 0;
|
||||
RGBFlash.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
RGBFlash.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
RGBFlash.colors_min = 1;
|
||||
RGBFlash.colors_max = 1;
|
||||
RGBFlash.colors.resize(RGBFlash.colors_max);
|
||||
zones[4].modes.push_back(RGBFlash);
|
||||
|
||||
mode RGBBreathing;
|
||||
RGBBreathing.name = "Breathing";
|
||||
RGBBreathing.value = CM_RGB_MODE_BREATHING;
|
||||
RGBBreathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
RGBBreathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
RGBBreathing.speed_min = CM_ARGB_SPEED_SLOWEST;
|
||||
RGBBreathing.speed_max = CM_ARGB_SPEED_FASTEST;
|
||||
RGBBreathing.speed = CM_ARGB_SPEED_NORMAL;
|
||||
RGBBreathing.brightness_min = 0;
|
||||
RGBBreathing.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
RGBBreathing.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
RGBBreathing.colors_min = 1;
|
||||
RGBBreathing.colors_max = 1;
|
||||
RGBBreathing.colors.resize(RGBBreathing.colors_max);
|
||||
zones[4].modes.push_back(RGBBreathing);
|
||||
|
||||
mode RGBStatic;
|
||||
RGBStatic.name = "Static";
|
||||
RGBStatic.value = CM_RGB_MODE_STATIC;
|
||||
RGBStatic.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
RGBStatic.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
RGBStatic.brightness_min = 0;
|
||||
RGBStatic.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
|
||||
RGBStatic.brightness = CM_ARGB_BRIGHTNESS_MAX;
|
||||
RGBStatic.colors_min = 1;
|
||||
RGBStatic.colors_max = 1;
|
||||
RGBStatic.colors.resize(RGBStatic.colors_max);
|
||||
zones[4].modes.push_back(RGBStatic);
|
||||
}
|
||||
|
||||
void RGBController_CMARGBController::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
{
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-----------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(5);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zones |
|
||||
\*---------------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up addressable zones |
|
||||
\*-----------------------------------------------------*/
|
||||
for(unsigned int channel_idx = 0; channel_idx < 4; channel_idx++)
|
||||
{
|
||||
bool boolSingleLED = (zones[zone_idx].type == ZONE_TYPE_SINGLE);
|
||||
zones[channel_idx].leds_min = 0;
|
||||
zones[channel_idx].leds_max = 48;
|
||||
|
||||
if (!boolSingleLED)
|
||||
if(first_run)
|
||||
{
|
||||
controller->SetLedCount( std::stoi(zones[zone_idx].name), zones[zone_idx].leds_count);
|
||||
zones[channel_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_SEGMENTS;
|
||||
}
|
||||
|
||||
for(unsigned int lp_idx = 0; lp_idx < zones[zone_idx].leds_count; lp_idx++)
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
led new_led;
|
||||
unsigned int i = std::stoi(zones[zone_idx].name);
|
||||
zones[channel_idx].name = "Addressable RGB Header ";
|
||||
zones[channel_idx].name.append(std::to_string(channel_idx + 1));
|
||||
}
|
||||
|
||||
if(boolSingleLED)
|
||||
{
|
||||
new_led.name = i;
|
||||
new_led.value = argb_header_data[i].header;
|
||||
}
|
||||
else
|
||||
{
|
||||
new_led.name = i;
|
||||
new_led.name.append(" LED " + std::to_string(lp_idx));
|
||||
new_led.value = argb_header_data[i].header;
|
||||
}
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[channel_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[channel_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[channel_idx].matrix_map.width = 0;
|
||||
zones[channel_idx].matrix_map.height = 0;
|
||||
zones[channel_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = zones[channel_idx].name;
|
||||
new_led.name.append(", LED ");
|
||||
new_led.name.append(std::to_string(led_ch_idx + 1));
|
||||
new_led.value = channel_idx;
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up RGB zone |
|
||||
\*-----------------------------------------------------*/
|
||||
zones[4].name = "RGB Header";
|
||||
zones[4].type = ZONE_TYPE_SINGLE;
|
||||
zones[4].leds_min = 1;
|
||||
zones[4].leds_max = 1;
|
||||
zones[4].leds_count = 1;
|
||||
|
||||
led new_led;
|
||||
new_led.name = "RGB Header";
|
||||
new_led.value = 4;
|
||||
leds.push_back(new_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CMARGBController::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_CMARGBController::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
uint8_t end_zone = last_zone(zone);
|
||||
controller->SetPortLEDCount(zone_idx, zones[zone_idx].leds_count);
|
||||
|
||||
for(std::size_t zone_idx = first_zone(zone); zone_idx < end_zone; zone_idx++)
|
||||
{
|
||||
if(((unsigned int)new_size >= zones[zone_idx].leds_min) && ((unsigned int)new_size <= zones[zone_idx].leds_max))
|
||||
{
|
||||
zones[zone_idx].leds_count = new_size;
|
||||
}
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
void RGBController_CMARGBController::DeviceUpdateLEDs()
|
||||
{
|
||||
uint8_t end_zone = last_zone(cmargb->GetZoneIndex());
|
||||
|
||||
for(int zone_idx = first_zone(cmargb->GetZoneIndex()); zone_idx < end_zone; zone_idx++)
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
DeviceUpdateZoneLEDs(zone_idx);
|
||||
DeviceUpdateZoneLEDs((int)zone_idx);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_CMARGBController::DeviceUpdateZoneLEDs(int zone)
|
||||
{
|
||||
controller->SetLedsDirect( zones[zone].colors, zones[zone].leds_count );
|
||||
if(modes[active_mode].value != CM_ARGB_MODE_DIRECT)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| The RGB zone doesn't have a separate Direct mode, so |
|
||||
| use static mode with the per-LED color for it |
|
||||
\*-----------------------------------------------------*/
|
||||
if(zone < 4)
|
||||
{
|
||||
controller->SetPortLEDsDirect(zone, zones[zone].colors, zones[zone].leds_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
controller->SetPortMode(zone, CM_RGB_MODE_STATIC, 0, 255, false, RGBGetRValue(zones[zone].colors[0]), RGBGetGValue(zones[zone].colors[0]), RGBGetBValue(zones[zone].colors[0]));
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_CMARGBController::DeviceUpdateSingleLED(int led)
|
||||
{
|
||||
DeviceUpdateZoneLEDs(GetLED_Zone(led));
|
||||
unsigned int zone_idx = leds[led].value;
|
||||
|
||||
UpdateZoneLEDs(zone_idx);
|
||||
}
|
||||
|
||||
void RGBController_CMARGBController::DeviceUpdateMode()
|
||||
{
|
||||
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;
|
||||
|
||||
controller->SetMode( modes[active_mode].value, modes[active_mode].speed, modes[active_mode].brightness, colour, random_colours );
|
||||
/*-----------------------------------------------------*\
|
||||
| Apply mode to all zones |
|
||||
\*-----------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
DeviceUpdateZoneMode((int)zone_idx);
|
||||
}
|
||||
}
|
||||
|
||||
int RGBController_CMARGBController::GetLED_Zone(int led_idx)
|
||||
void RGBController_CMARGBController::DeviceUpdateZoneMode(int zone)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This may be more useful in the abstract RGBController.cpp |
|
||||
\*---------------------------------------------------------*/
|
||||
for(int zone_idx = 0; zone_idx < (int)zones.size(); zone_idx++)
|
||||
{
|
||||
int zone_start = zones[zone_idx].start_idx;
|
||||
int zone_end = zone_start + zones[zone_idx].leds_count - 1;
|
||||
/*-----------------------------------------------------*\
|
||||
| Determine the active mode for this zone |
|
||||
\*-----------------------------------------------------*/
|
||||
bool use_zone_mode = false;
|
||||
int zone_active_mode = active_mode;
|
||||
int zone_mode_value = modes[active_mode].value;
|
||||
|
||||
if(zone_start <= led_idx && zone_end >= led_idx)
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up mode parameters |
|
||||
\*-----------------------------------------------------*/
|
||||
bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
|
||||
RGBColor color = 0;
|
||||
unsigned int brightness = modes[active_mode].brightness;
|
||||
unsigned int speed = modes[active_mode].speed;
|
||||
|
||||
if(modes[active_mode].colors.size() > 0)
|
||||
{
|
||||
color = modes[active_mode].colors[0];
|
||||
}
|
||||
|
||||
if(!(modes[active_mode].flags & MODE_FLAG_REQUIRES_ENTIRE_DEVICE))
|
||||
{
|
||||
if(zones[zone].active_mode >= 0)
|
||||
{
|
||||
return(zone_idx);
|
||||
use_zone_mode = true;
|
||||
zone_active_mode = zones[zone].active_mode;
|
||||
zone_mode_value = zones[zone].modes[zone_active_mode].value;
|
||||
|
||||
random = (zones[zone].modes[zone_active_mode].color_mode == MODE_COLORS_RANDOM);
|
||||
|
||||
if(zones[zone].modes[zone_active_mode].colors.size() > 0)
|
||||
{
|
||||
color = zones[zone].modes[zone_active_mode].colors[0];
|
||||
}
|
||||
|
||||
brightness = zones[zone].modes[zone_active_mode].brightness;
|
||||
speed = zones[zone].modes[zone_active_mode].speed;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
if((zone == 4) && !use_zone_mode)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Map entire-device ARGB modes with the equivalent |
|
||||
| RGB modes for the RGB zone |
|
||||
\*-------------------------------------------------*/
|
||||
switch(modes[active_mode].value)
|
||||
{
|
||||
case CM_ARGB_MODE_SPECTRUM:
|
||||
case CM_ARGB_MODE_FILLFLOW:
|
||||
case CM_ARGB_MODE_RAINBOW:
|
||||
zone_mode_value = CM_RGB_MODE_MIRAGE;
|
||||
random = true;
|
||||
break;
|
||||
|
||||
case CM_ARGB_MODE_RELOAD:
|
||||
case CM_ARGB_MODE_RECOIL:
|
||||
zone_mode_value = CM_RGB_MODE_FLASH;
|
||||
break;
|
||||
|
||||
case CM_ARGB_MODE_BREATHING:
|
||||
zone_mode_value = CM_RGB_MODE_BREATHING;
|
||||
break;
|
||||
|
||||
case CM_ARGB_MODE_REFILL:
|
||||
case CM_ARGB_MODE_STATIC:
|
||||
zone_mode_value = CM_RGB_MODE_STATIC;
|
||||
break;
|
||||
|
||||
case CM_ARGB_MODE_DEMO:
|
||||
zone_mode_value = CM_RGB_MODE_FLASH;
|
||||
random = true;
|
||||
break;
|
||||
|
||||
case CM_ARGB_MODE_OFF:
|
||||
default:
|
||||
zone_mode_value = CM_RGB_MODE_OFF;
|
||||
break;
|
||||
|
||||
case CM_ARGB_MODE_PASSTHRU:
|
||||
zone_mode_value = CM_RGB_MODE_PASSTHRU;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
controller->SetPortMode
|
||||
(
|
||||
zone,
|
||||
zone_mode_value,
|
||||
speed,
|
||||
brightness,
|
||||
random,
|
||||
RGBGetRValue(color),
|
||||
RGBGetGValue(color),
|
||||
RGBGetBValue(color)
|
||||
);
|
||||
}
|
||||
|
||||
+7
-10
@@ -12,11 +12,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "RGBController.h"
|
||||
#include "CMARGBController.h"
|
||||
|
||||
#define first_zone(zn) ((zones.size() > 1) ? 1 : 0)
|
||||
#define last_zone(zn) ((zones.size() > 1) ? 4 : 1)
|
||||
#include "RGBController.h"
|
||||
|
||||
class RGBController_CMARGBController : public RGBController
|
||||
{
|
||||
@@ -24,19 +21,19 @@ public:
|
||||
RGBController_CMARGBController(CMARGBController* controller_ptr);
|
||||
~RGBController_CMARGBController();
|
||||
|
||||
void SetupModes();
|
||||
void SetupZones();
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
void DeviceUpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
void DeviceUpdateZoneMode(int zone);
|
||||
|
||||
private:
|
||||
void Init_Controller();
|
||||
int GetDeviceMode();
|
||||
int GetLED_Zone(int led_idx);
|
||||
|
||||
CMARGBController* controller;
|
||||
CMARGBController* controller;
|
||||
std::vector<unsigned int> leds_channel;
|
||||
};
|
||||
|
||||
+4
-4
@@ -186,6 +186,8 @@ RGBController_CMARGBGen2A1Controller::RGBController_CMARGBGen2A1Controller(CMARG
|
||||
|
||||
RGBController_CMARGBGen2A1Controller::~RGBController_CMARGBGen2A1Controller()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
@@ -218,10 +220,8 @@ void RGBController_CMARGBGen2A1Controller::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CMARGBGen2A1Controller::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_CMARGBGen2A1Controller::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
|
||||
unsigned int total_leds = 0;
|
||||
|
||||
for(unsigned int channel = 0; channel < CM_ARGB_GEN2_A1_CHANNEL_COUNT; channel++)
|
||||
@@ -236,7 +236,7 @@ void RGBController_CMARGBGen2A1Controller::DeviceResizeZone(int zone, int new_si
|
||||
leds[i].name = "LED " + std::to_string(i + 1);
|
||||
}
|
||||
|
||||
controller->SetupZoneSize(zone, new_size);
|
||||
controller->SetupZoneSize(zone_idx, zones[zone_idx].leds_count);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ public:
|
||||
~RGBController_CMARGBGen2A1Controller();
|
||||
|
||||
void SetupZones();
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
void UpdateSegmentLEDs(int zone, int subchannel);
|
||||
|
||||
+2
@@ -140,6 +140,8 @@ RGBController_CMGD160Controller::RGBController_CMGD160Controller(CMGD160Controll
|
||||
|
||||
RGBController_CMGD160Controller::~RGBController_CMGD160Controller()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -49,6 +49,8 @@ RGBController_CMKeyboardController::RGBController_CMKeyboardController(CMKeyboar
|
||||
|
||||
RGBController_CMKeyboardController::~RGBController_CMKeyboardController()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
if(m_pController)
|
||||
{
|
||||
delete m_pController;
|
||||
|
||||
+2
@@ -129,6 +129,8 @@ RGBController_CMMM711Controller::RGBController_CMMM711Controller(CMMM711Controll
|
||||
|
||||
RGBController_CMMM711Controller::~RGBController_CMMM711Controller()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -122,6 +122,8 @@ RGBController_CMMM712Controller::RGBController_CMMM712Controller(CMMM712Controll
|
||||
|
||||
RGBController_CMMM712Controller::~RGBController_CMMM712Controller()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
@@ -168,6 +168,8 @@ RGBController_CMMMController::RGBController_CMMMController(CMMMController* contr
|
||||
|
||||
RGBController_CMMMController::~RGBController_CMMMController()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -93,6 +93,8 @@ RGBController_CMMP750Controller::RGBController_CMMP750Controller(CMMP750Controll
|
||||
|
||||
RGBController_CMMP750Controller::~RGBController_CMMP750Controller()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -141,6 +141,8 @@ RGBController_CMMonitorController::RGBController_CMMonitorController(CMMonitorCo
|
||||
|
||||
RGBController_CMMonitorController::~RGBController_CMMonitorController()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -152,6 +152,8 @@ RGBController_CMR6000Controller::RGBController_CMR6000Controller(CMR6000Controll
|
||||
|
||||
RGBController_CMR6000Controller::~RGBController_CMR6000Controller()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
@@ -153,6 +153,8 @@ RGBController_CMRGBController::RGBController_CMRGBController(CMRGBController* co
|
||||
|
||||
RGBController_CMRGBController::~RGBController_CMRGBController()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,11 +18,10 @@ cm_small_argb_headers cm_small_argb_header_data[1] =
|
||||
{ "CM Small ARGB", 0x01, true, 12 }
|
||||
};
|
||||
|
||||
CMSmallARGBController::CMSmallARGBController(hid_device* dev_handle, char *_path, unsigned char _zone_idx)
|
||||
CMSmallARGBController::CMSmallARGBController(hid_device* dev_handle, char *_path)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = _path;
|
||||
zone_index = _zone_idx;
|
||||
current_speed = CM_SMALL_ARGB_SPEED_NORMAL;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
@@ -51,7 +50,7 @@ void CMSmallARGBController::GetStatus()
|
||||
{
|
||||
unsigned char buffer[CM_SMALL_ARGB_PACKET_SIZE] = { 0x00, 0x80, 0x01, 0x01 };
|
||||
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
|
||||
int header = zone_index - 1;
|
||||
int header = 0 - 1;
|
||||
|
||||
buffer[CM_SMALL_ARGB_ZONE_BYTE] = header;
|
||||
buffer[CM_SMALL_ARGB_MODE_BYTE] = 0x01;
|
||||
@@ -98,11 +97,6 @@ std::string CMSmallARGBController::GetLocation()
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
unsigned char CMSmallARGBController::GetZoneIndex()
|
||||
{
|
||||
return(zone_index);
|
||||
}
|
||||
|
||||
unsigned char CMSmallARGBController::GetMode()
|
||||
{
|
||||
return(current_mode);
|
||||
@@ -177,7 +171,7 @@ void CMSmallARGBController::SetLedsDirect(RGBColor* led_colours, unsigned int le
|
||||
colours.push_back( RGBGetBValue(colour) );
|
||||
}
|
||||
|
||||
buffer[CM_SMALL_ARGB_ZONE_BYTE] = zone_index - 1; //argb_header_data[zone_index].header;
|
||||
buffer[CM_SMALL_ARGB_ZONE_BYTE] = 0 - 1; //argb_header_data[zone_index].header;
|
||||
buffer[CM_SMALL_ARGB_MODE_BYTE] = led_count;
|
||||
unsigned char buffer_idx = CM_SMALL_ARGB_MODE_BYTE + 1;
|
||||
|
||||
@@ -225,7 +219,7 @@ void CMSmallARGBController::SendUpdate()
|
||||
|
||||
buffer[CM_SMALL_ARGB_COMMAND_BYTE] = 0x0b;
|
||||
buffer[CM_SMALL_ARGB_FUNCTION_BYTE] = (false) ? 0x01 : 0x02; //This controls custom mode TODO
|
||||
buffer[CM_SMALL_ARGB_ZONE_BYTE] = cm_small_argb_header_data[zone_index].header;
|
||||
buffer[CM_SMALL_ARGB_ZONE_BYTE] = cm_small_argb_header_data[0].header;
|
||||
buffer[CM_SMALL_ARGB_MODE_BYTE] = current_mode;
|
||||
buffer[CM_SMALL_ARGB_SPEED_BYTE] = current_speed;
|
||||
buffer[CM_SMALL_ARGB_COLOUR_INDEX_BYTE] = (bool_random) ? 0x00 : 0x10; //This looks to still be the colour index and controls random colours
|
||||
|
||||
@@ -74,14 +74,13 @@ enum
|
||||
class CMSmallARGBController
|
||||
{
|
||||
public:
|
||||
CMSmallARGBController(hid_device* dev_handle, char *_path, unsigned char _zone_idx);
|
||||
CMSmallARGBController(hid_device* dev_handle, char *_path);
|
||||
~CMSmallARGBController();
|
||||
|
||||
std::string GetDeviceName();
|
||||
std::string GetSerial();
|
||||
std::string GetLocation();
|
||||
|
||||
unsigned char GetZoneIndex();
|
||||
unsigned char GetMode();
|
||||
unsigned char GetLedRed();
|
||||
unsigned char GetLedGreen();
|
||||
@@ -97,7 +96,6 @@ private:
|
||||
std::string location;
|
||||
hid_device* dev;
|
||||
|
||||
unsigned char zone_index;
|
||||
unsigned char current_mode;
|
||||
unsigned char current_speed;
|
||||
|
||||
|
||||
+57
-48
@@ -29,7 +29,7 @@ RGBController_CMSmallARGBController::RGBController_CMSmallARGBController(CMSmall
|
||||
controller = controller_ptr;
|
||||
unsigned char speed = controller->GetLedSpeed();
|
||||
|
||||
name = cm_small_argb_header_data[controller->GetZoneIndex()].name;
|
||||
name = cm_small_argb_header_data[0].name;
|
||||
vendor = "Cooler Master";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
description = controller->GetDeviceName();
|
||||
@@ -152,7 +152,6 @@ RGBController_CMSmallARGBController::RGBController_CMSmallARGBController(CMSmall
|
||||
PassThru.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(PassThru);
|
||||
|
||||
Init_Controller(); //Only processed on first run
|
||||
SetupZones();
|
||||
|
||||
int temp_mode = controller->GetMode();
|
||||
@@ -181,60 +180,75 @@ RGBController_CMSmallARGBController::RGBController_CMSmallARGBController(CMSmall
|
||||
|
||||
RGBController_CMSmallARGBController::~RGBController_CMSmallARGBController()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CMSmallARGBController::Init_Controller()
|
||||
{
|
||||
int zone_idx = controller->GetZoneIndex();
|
||||
int zone_led_count = cm_small_argb_header_data[zone_idx].count;
|
||||
bool boolSingleLED = ( zone_led_count == 1 ); //If argb_header_data[zone_idx].count == 1 then the zone is ZONE_TYPE_SINGLE
|
||||
|
||||
zone ARGB_zone;
|
||||
ARGB_zone.name = std::to_string(zone_idx);
|
||||
ARGB_zone.type = (boolSingleLED) ? ZONE_TYPE_SINGLE : ZONE_TYPE_LINEAR;
|
||||
ARGB_zone.leds_min = CM_SMALL_ARGB_MIN_LEDS;
|
||||
ARGB_zone.leds_max = CM_SMALL_ARGB_MAX_LEDS;
|
||||
ARGB_zone.leds_count = zone_led_count;
|
||||
zones.push_back(ARGB_zone);
|
||||
}
|
||||
|
||||
void RGBController_CMSmallARGBController::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
\*-----------------------------------------------------*/
|
||||
bool first_run = false;
|
||||
|
||||
if(zones.size() == 0)
|
||||
{
|
||||
first_run = true;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Clear any existing color/LED configuration |
|
||||
\*-----------------------------------------------------*/
|
||||
leds.clear();
|
||||
colors.clear();
|
||||
zones.resize(1);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zones |
|
||||
\*---------------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up zones and LEDs |
|
||||
\*-----------------------------------------------------*/
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
bool boolSingleLED = (zones[zone_idx].type == ZONE_TYPE_SINGLE); //Calculated for later use
|
||||
zones[zone_idx].leds_min = 0;
|
||||
zones[zone_idx].leds_max = CM_SMALL_ARGB_MAX_LEDS;
|
||||
|
||||
if (!boolSingleLED)
|
||||
if(first_run)
|
||||
{
|
||||
controller->SetLedCount(cm_small_argb_header_data[zone_idx].header, zones[zone_idx].leds_count);
|
||||
zones[zone_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP
|
||||
| ZONE_FLAG_MANUALLY_CONFIGURABLE_SEGMENTS;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
|
||||
{
|
||||
zones[zone_idx].name = "Addressable RGB Header";
|
||||
zones[zone_idx].name.append(std::to_string(zone_idx + 1));
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
|
||||
{
|
||||
zones[zone_idx].leds_count = 0;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
|
||||
{
|
||||
zones[zone_idx].type = ZONE_TYPE_LINEAR;
|
||||
}
|
||||
|
||||
if(!(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
|
||||
{
|
||||
zones[zone_idx].matrix_map.width = 0;
|
||||
zones[zone_idx].matrix_map.height = 0;
|
||||
zones[zone_idx].matrix_map.map.resize(0);
|
||||
}
|
||||
|
||||
for(unsigned int lp_idx = 0; lp_idx < zones[zone_idx].leds_count; lp_idx++)
|
||||
{
|
||||
led new_led;
|
||||
unsigned int i = std::stoi(zones[zone_idx].name);
|
||||
|
||||
if(boolSingleLED)
|
||||
{
|
||||
new_led.name = i;
|
||||
new_led.value = cm_small_argb_header_data[i].header;
|
||||
}
|
||||
else
|
||||
{
|
||||
new_led.name = i;
|
||||
new_led.name.append(" LED " + std::to_string(lp_idx));
|
||||
new_led.value = cm_small_argb_header_data[i].header;
|
||||
}
|
||||
led new_led;
|
||||
new_led.name = zones[zone_idx].name;
|
||||
new_led.name.append(", LED " + std::to_string(lp_idx));
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
@@ -243,16 +257,11 @@ void RGBController_CMSmallARGBController::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CMSmallARGBController::DeviceResizeZone(int zone, int new_size)
|
||||
void RGBController_CMSmallARGBController::DeviceConfigureZone(int zone_idx)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
if((size_t)zone_idx < zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
controller->SetLedCount(cm_small_argb_header_data[zone_idx].header, zones[zone_idx].leds_count);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public:
|
||||
~RGBController_CMSmallARGBController();
|
||||
|
||||
void SetupZones();
|
||||
void DeviceResizeZone(int zone, int new_size);
|
||||
void DeviceConfigureZone(int zone_idx);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user