Update LedDeviceAPA102.cpp

End frame fixed

Former-commit-id: 44107997d92d729f84adee368d12e35f1b5be6f1
This commit is contained in:
AEtHeLsYn 2015-08-05 10:07:31 +02:00
parent e65ee859ec
commit c9636aaa6b

View File

@ -20,7 +20,9 @@ LedDeviceAPA102::LedDeviceAPA102(const std::string& outputDevice, const unsigned
int LedDeviceAPA102::write(const std::vector<ColorRgb> &ledValues)
{
const unsigned int mLedCount = (ledValues.size() * 4) + 8;
const unsigned int startFrameSize = 4;
const unsigned int endFrameSize = (ledValues.size() + 63) / 64 * 4;
const unsigned int mLedCount = (ledValues.size() * 4) + startFrameSize + endFrameSize;
if(_ledBuffer.size() != mLedCount){
_ledBuffer.resize(mLedCount, 0x00);
}