Make sure the byte array is empty before filling it.

Former-commit-id: 64f76fa358234e131377ecfabf196f3c7324e79f
This commit is contained in:
RickDB 2016-03-15 11:45:25 +01:00
parent 5be072be24
commit dcc6a9b449
1 changed files with 4 additions and 2 deletions

View File

@ -77,6 +77,7 @@ int LedDeviceAtmoOrb::write(const std::vector<ColorRgb> & ledValues) {
void LedDeviceAtmoOrb::setColor(unsigned int orbId, const ColorRgb& color, int commandType) {
QByteArray bytes;
bytes.resize(5 + numLeds * 3);
bytes.fill('\0');
// Command identifier: C0FFEE
bytes[0] = 0xC0;
@ -107,6 +108,7 @@ int LedDeviceAtmoOrb::switchOff() {
for (unsigned int i = 0; i < orbIds.size(); i++) {
QByteArray bytes;
bytes.resize(5 + numLeds * 3);
bytes.fill('\0');
// Command identifier: C0FFEE
bytes[0] = 0xC0;