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
b040e1b5c0
commit
c941052edb
@ -589,8 +589,8 @@ bool Keyboard::setKeysInternal(KeyAddressGroup addressGroup, KeyValue keyValues[
|
||||
unsigned char *data;
|
||||
int data_size;
|
||||
int maxKeyValueCount = 0;
|
||||
if (addressGroup == KeyAddressGroup::logo) {
|
||||
data_size = 20;
|
||||
if (addressGroup == KeyAddressGroup::logo) data_size = 20;
|
||||
else data_size = 64;
|
||||
data = new unsigned char[data_size];
|
||||
populateAddressGroupInternal(addressGroup, data);
|
||||
maxKeyValueCount = (data_size - 8) / 4;
|
||||
@ -607,26 +607,6 @@ bool Keyboard::setKeysInternal(KeyAddressGroup addressGroup, KeyValue keyValues[
|
||||
data[8 + i * 4 + 3] = 0x00;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
data_size = 64;
|
||||
data = new unsigned char[data_size];
|
||||
populateAddressGroupInternal(addressGroup, data);
|
||||
maxKeyValueCount = (data_size - 8) / 4;
|
||||
if (keyValueCount > maxKeyValueCount) keyValueCount = maxKeyValueCount;
|
||||
for(int i = 0; i < maxKeyValueCount; i++) {
|
||||
if (i < keyValueCount) {
|
||||
data[8 + i * 4 + 0] = keyValues[i].key.id;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
retval = sendDataInternal(data, data_size);
|
||||
delete[] data;
|
||||
return retval;
|
||||
|
Loading…
Reference in New Issue
Block a user