1
0
mirror of https://github.com/MatMoul/g810-led.git synced 2024-12-23 09:16:11 +00:00

Bug correction

This commit is contained in:
MatMoul 2016-11-11 23:40:46 +01:00
parent 2fd1d15777
commit 4a9268d878

View File

@ -454,7 +454,7 @@ bool Keyboard::setKeysInternal(KeyAddressGroup addressGroup, KeyValue keyValues[
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 / 4; int 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) {
@ -562,7 +562,7 @@ bool Keyboard::setKeys(KeyValue keyValue[], int keyValueCount) {
if (multimediaCount > 0) setKeysInternal(KeyAddressGroup::multimedia, multimedia, multimediaCount); if (multimediaCount > 0) setKeysInternal(KeyAddressGroup::multimedia, multimedia, multimediaCount);
if (keysCount > 0) { if (keysCount > 0) {
int maxKeyValueCount = 12; // Normally max 16 but dont work int maxKeyValueCount = 12; // Normally max 14 but dont work
for (int i = 0; i < keysCount; i = i + maxKeyValueCount) { for (int i = 0; i < keysCount; i = i + maxKeyValueCount) {
KeyValue keysBlock[maxKeyValueCount]; KeyValue keysBlock[maxKeyValueCount];
int keysBlockCount = 0; int keysBlockCount = 0;