Fix for sk9822 frame sufix (#1042)

This commit is contained in:
Awawa 2020-11-01 19:12:25 +01:00 committed by GitHub
parent 0cddc06844
commit 9e4c7af5e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,14 +34,15 @@ bool LedDeviceSK9822::init(const QJsonObject &deviceConfig)
Info(_log, "[SK9822] Using global brightness control with threshold of %d and max level of %d", _globalBrightnessControlThreshold, _globalBrightnessControlMaxLevel);
const unsigned int startFrameSize = 4;
const unsigned int endFrameSize = qMax<unsigned int>(((_ledCount + 15) / 16), 4);
const unsigned int endFrameSize = ((_ledCount/32) + 1)*4;
const unsigned int bufferSize = (_ledCount * 4) + startFrameSize + endFrameSize;
_ledBuffer.resize(bufferSize, 0xFF);
_ledBuffer[0] = 0x00;
_ledBuffer[1] = 0x00;
_ledBuffer[2] = 0x00;
_ledBuffer[3] = 0x00;
_ledBuffer.resize(0, 0x00);
_ledBuffer.resize(bufferSize, 0x00);
//_ledBuffer[0] = 0x00;
//_ledBuffer[1] = 0x00;
//_ledBuffer[2] = 0x00;
//_ledBuffer[3] = 0x00;
isInitOK = true;
}