mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Removed rate limiting from code. Setting framegrabbing frequency of 10 Hz / number of lights is sufficient.
Former-commit-id: 0686a8d18c780038eb017fdf26b5faf4b8053f3a
This commit is contained in:
parent
88c523518a
commit
ebb22cdc87
@ -18,11 +18,6 @@ LedDevicePhilipsHue::~LedDevicePhilipsHue() {
|
||||
}
|
||||
|
||||
int LedDevicePhilipsHue::write(const std::vector<ColorRgb> & ledValues) {
|
||||
// Due to rate limiting (max. 30 request per seconds), discard new values if
|
||||
// the previous request have not been completed yet.
|
||||
if (http->hasPendingRequests()) {
|
||||
return -1;
|
||||
}
|
||||
unsigned int lightId = 1;
|
||||
for (const ColorRgb& color : ledValues) {
|
||||
float x, y, b;
|
||||
@ -50,8 +45,6 @@ void LedDevicePhilipsHue::put(QString route, QString content) {
|
||||
header.setValue("Content-Length", QString("%1").arg(content.size()));
|
||||
http->setHost(host);
|
||||
http->request(header, content.toAscii());
|
||||
// std::cout << "LedDevicePhilipsHue::put(): " << header.toString().toUtf8().constData() << std::endl;
|
||||
// std::cout << "LedDevicePhilipsHue::put(): " << content.toUtf8().constData() << std::endl;
|
||||
}
|
||||
|
||||
QString LedDevicePhilipsHue::getRoute(unsigned int lightId) {
|
||||
@ -71,11 +64,11 @@ void LedDevicePhilipsHue::rgbToXYBrightness(float red, float green, float blue,
|
||||
x = X / (X + Y + Z);
|
||||
y = Y / (X + Y + Z);
|
||||
if (isnan(x)) {
|
||||
x = 0.0f;
|
||||
}
|
||||
if (isnan(y)) {
|
||||
y = 0.0f;
|
||||
}
|
||||
// Brightness is simply Y in the XYZ space.
|
||||
x = 0.0f;
|
||||
}
|
||||
if (isnan(y)) {
|
||||
y = 0.0f;
|
||||
}
|
||||
// Brightness is simply Y in the XYZ space.
|
||||
brightness = Y;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* To use set the device to "philipshue".
|
||||
* Uses the official Philips Hue API (http://developers.meethue.com).
|
||||
* Framegrabber should be limited to 30 Hz / numer of lights to avoid rate limitation by the hue bridge.
|
||||
* Framegrabber must be limited to 10 Hz / numer of lights to avoid rate limitation by the hue bridge.
|
||||
* Create a new API user name "newdeveloper" on the bridge (http://developers.meethue.com/gettingstarted.html)
|
||||
*/
|
||||
class LedDevicePhilipsHue : public LedDevice
|
||||
|
Loading…
Reference in New Issue
Block a user