Skip to content
This repository was archived by the owner on May 6, 2021. It is now read-only.

Commit 0686a8d

Browse files
committed
Removed rate limiting from code. Setting framegrabbing frequency of 10 Hz / number of lights is sufficient.
1 parent 5b7d802 commit 0686a8d

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

libsrc/leddevice/LedDevicePhilipsHue.cpp

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ LedDevicePhilipsHue::~LedDevicePhilipsHue() {
1818
}
1919

2020
int LedDevicePhilipsHue::write(const std::vector<ColorRgb> & ledValues) {
21-
// Due to rate limiting (max. 30 request per seconds), discard new values if
22-
// the previous request have not been completed yet.
23-
if (http->hasPendingRequests()) {
24-
return -1;
25-
}
2621
unsigned int lightId = 1;
2722
for (const ColorRgb& color : ledValues) {
2823
float x, y, b;
@@ -50,8 +45,6 @@ void LedDevicePhilipsHue::put(QString route, QString content) {
5045
header.setValue("Content-Length", QString("%1").arg(content.size()));
5146
http->setHost(host);
5247
http->request(header, content.toAscii());
53-
// std::cout << "LedDevicePhilipsHue::put(): " << header.toString().toUtf8().constData() << std::endl;
54-
// std::cout << "LedDevicePhilipsHue::put(): " << content.toUtf8().constData() << std::endl;
5548
}
5649

5750
QString LedDevicePhilipsHue::getRoute(unsigned int lightId) {
@@ -71,11 +64,11 @@ void LedDevicePhilipsHue::rgbToXYBrightness(float red, float green, float blue,
7164
x = X / (X + Y + Z);
7265
y = Y / (X + Y + Z);
7366
if (isnan(x)) {
74-
x = 0.0f;
75-
}
76-
if (isnan(y)) {
77-
y = 0.0f;
78-
}
79-
// Brightness is simply Y in the XYZ space.
67+
x = 0.0f;
68+
}
69+
if (isnan(y)) {
70+
y = 0.0f;
71+
}
72+
// Brightness is simply Y in the XYZ space.
8073
brightness = Y;
8174
}

libsrc/leddevice/LedDevicePhilipsHue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* To use set the device to "philipshue".
1717
* Uses the official Philips Hue API (http://developers.meethue.com).
18-
* Framegrabber should be limited to 30 Hz / numer of lights to avoid rate limitation by the hue bridge.
18+
* Framegrabber must be limited to 10 Hz / numer of lights to avoid rate limitation by the hue bridge.
1919
* Create a new API user name "newdeveloper" on the bridge (http://developers.meethue.com/gettingstarted.html)
2020
*/
2121
class LedDevicePhilipsHue : public LedDevice

0 commit comments

Comments
 (0)