Get the light id from the lamp object.

Former-commit-id: 7120af8551c185979c94b2a186f09c883784a882
This commit is contained in:
Tim Niggemann 2014-07-15 09:59:01 +02:00
parent 4af2b11d8f
commit d2542142be

View File

@ -31,10 +31,10 @@ int LedDevicePhilipsHue::write(const std::vector<ColorRgb> & ledValues) {
switchOn((unsigned int) ledValues.size());
}
// Iterate through colors and set light states.
unsigned int lightId = 0;
unsigned int idx = 0;
for (const ColorRgb& color : ledValues) {
// Get lamp.
HueLamp& lamp = lamps.at(lightId);
HueLamp& lamp = lamps.at(idx);
// Scale colors from [0, 255] to [0, 1] and convert to xy space.
ColorPoint xy;
rgbToXYBrightness(color.red / 255.0f, color.green / 255.0f, color.blue / 255.0f, lamp, xy);
@ -48,7 +48,7 @@ int LedDevicePhilipsHue::write(const std::vector<ColorRgb> & ledValues) {
lamp.color = xy;
}
// Next light id.
lightId++;
idx++;
}
timer.start();
return 0;