Correctly set buffer size based on number of leds so that it works with non-standard AtmoOrb setups.

Former-commit-id: 6aec2410d6e870c8489e565269f2990e3a9e1b85
This commit is contained in:
RickDB 2016-03-14 21:19:47 +01:00
parent bd1a45216a
commit 0d8c4ac5fb

View File

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