Merge pull request #364 from AEtHeLsYn/master

End Frame fixed (Issue #361)

Former-commit-id: b5be5f6b8325a990f50cab434f067617f9733ae0
This commit is contained in:
tvdzwan 2015-08-07 10:54:36 +02:00
commit cc5b57e4c0
1 changed files with 3 additions and 1 deletions

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);
}