Added additional zeroes after LPD6803 device message

Former-commit-id: ba15d222339736e5281e667270ddb37b50d1319f
This commit is contained in:
johan 2014-02-21 22:35:13 +01:00
parent fe6bfb0ad2
commit 1a92e6ccd2
2 changed files with 4 additions and 3 deletions

View File

@ -1 +1 @@
f3afa39f64294a9ce71af8e424e4bab72d2b29cb
8f880f994b0855ace23e27818896fc34ba1677a8

View File

@ -19,11 +19,12 @@ LedDeviceLpd6803::LedDeviceLpd6803(const std::string& outputDevice, const unsign
int LedDeviceLpd6803::write(const std::vector<ColorRgb> &ledValues)
{
unsigned messageLength = 4 + 2*ledValues.size() + ledValues.size()/8 + 1;
// Reconfigure if the current connfiguration does not match the required configuration
if (4 + 2*ledValues.size() != _ledBuffer.size())
if (messageLength != _ledBuffer.size())
{
// Initialise the buffer
_ledBuffer.resize(4 + 2*ledValues.size(), 0x00);
_ledBuffer.resize(messageLength, 0x00);
}
// Copy the colors from the ColorRgb vector to the Ldp6803 data vector