diff --git a/libsrc/leddevice/LedDeviceAPA102.cpp b/libsrc/leddevice/LedDeviceAPA102.cpp index 2a2f5e8c..2af01acf 100644 --- a/libsrc/leddevice/LedDeviceAPA102.cpp +++ b/libsrc/leddevice/LedDeviceAPA102.cpp @@ -20,7 +20,9 @@ LedDeviceAPA102::LedDeviceAPA102(const std::string& outputDevice, const unsigned int LedDeviceAPA102::write(const std::vector &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); }