mirror of
https://github.com/MatMoul/g810-led.git
synced 2024-12-23 09:16:11 +00:00
Add multiple logo support
This commit is contained in:
parent
946056c6a6
commit
b040e1b5c0
@ -588,20 +588,30 @@ bool Keyboard::setKeysInternal(KeyAddressGroup addressGroup, KeyValue keyValues[
|
|||||||
bool retval = false;
|
bool retval = false;
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
int data_size;
|
int data_size;
|
||||||
|
int maxKeyValueCount = 0;
|
||||||
if (addressGroup == KeyAddressGroup::logo) {
|
if (addressGroup == KeyAddressGroup::logo) {
|
||||||
data_size = 20;
|
data_size = 20;
|
||||||
data = new unsigned char[data_size];
|
data = new unsigned char[data_size];
|
||||||
populateAddressGroupInternal(addressGroup, data);
|
populateAddressGroupInternal(addressGroup, data);
|
||||||
data[8] = keyValues[0].key.id;
|
maxKeyValueCount = (data_size - 8) / 4;
|
||||||
data[9] = keyValues[0].colors.red;
|
for(int i = 0; i < maxKeyValueCount; i++) {
|
||||||
data[10] = keyValues[0].colors.green;
|
if (i < keyValueCount) {
|
||||||
data[11] = keyValues[0].colors.blue;
|
data[8 + i * 4 + 0] = keyValues[i].key.id;
|
||||||
for(int i = 12; i < data_size; i++) data[i] = 0x00;
|
data[8 + i * 4 + 1] = keyValues[i].colors.red;
|
||||||
|
data[8 + i * 4 + 2] = keyValues[i].colors.green;
|
||||||
|
data[8 + i * 4 + 3] = keyValues[i].colors.blue;
|
||||||
|
} else {
|
||||||
|
data[8 + i * 4 + 0] = 0x00;
|
||||||
|
data[8 + i * 4 + 1] = 0x00;
|
||||||
|
data[8 + i * 4 + 2] = 0x00;
|
||||||
|
data[8 + i * 4 + 3] = 0x00;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
data_size = 64;
|
data_size = 64;
|
||||||
data = new unsigned char[data_size];
|
data = new unsigned char[data_size];
|
||||||
populateAddressGroupInternal(addressGroup, data);
|
populateAddressGroupInternal(addressGroup, data);
|
||||||
int maxKeyValueCount = (data_size - 8) / 4;
|
maxKeyValueCount = (data_size - 8) / 4;
|
||||||
if (keyValueCount > maxKeyValueCount) keyValueCount = maxKeyValueCount;
|
if (keyValueCount > maxKeyValueCount) keyValueCount = maxKeyValueCount;
|
||||||
for(int i = 0; i < maxKeyValueCount; i++) {
|
for(int i = 0; i < maxKeyValueCount; i++) {
|
||||||
if (i < keyValueCount) {
|
if (i < keyValueCount) {
|
||||||
|
Loading…
Reference in New Issue
Block a user