AtmoOrb smoothing additions

* Updated smoothing options for AtmoOrb, can now choose between Orb external or Hyperion's internal smoothing.
With skipSmoothingDif you can set the maximum allowed color difference before overriding / clearing Orb smoothing during faster color change like for instance color <-> black.

* Updated inline documentation.

* Fixed command type typo in AtmoOrb device.

* Corrected variable spelling in AtmoOrb device.

* Make smoothing also match equal values for AtmoOrb smoothing differential


Former-commit-id: 3eede43c2f76fa324f0144aeac0526b8125ad149
This commit is contained in:
Rick164
2016-04-02 00:07:28 +02:00
committed by brindosch
parent b37cbd26d5
commit 02fef83bb8
3 changed files with 54 additions and 40 deletions

View File

@@ -246,35 +246,36 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
}
device = new LedDevicePhilipsHue(output, username, switchOffOnBlack, transitiontime, lightIds);
}
else if (type == "atmoorb")
{
else if (type == "atmoorb")
{
const std::string output = deviceConfig["output"].asString();
const bool switchOffOnBlack = deviceConfig.get("switchOffOnBlack", true).asBool();
const bool useOrbSmoothing = deviceConfig.get("useOrbSmoothing", false).asBool();
const int transitiontime = deviceConfig.get("transitiontime", 1).asInt();
const int skipSmoothingDiff = deviceConfig.get("skipSmoothingDiff", 0).asInt();
const int port = deviceConfig.get("port", 1).asInt();
const int numLeds = deviceConfig.get("numLeds", 1).asInt();
const std::string orbId = deviceConfig["orbIds"].asString();
const std::string orbId = deviceConfig["orbIds"].asString();
std::vector<unsigned int> orbIds;
// If we find multiple Orb ids separate them and add to list
const std::string separator (",");
if (orbId.find(separator) != std::string::npos) {
std::stringstream ss(orbId);
std::vector<int> output;
unsigned int i;
while (ss >> i) {
orbIds.push_back(i);
if (ss.peek() == ',' || ss.peek() == ' ')
ss.ignore();
}
std::stringstream ss(orbId);
std::vector<int> output;
unsigned int i;
while (ss >> i) {
orbIds.push_back(i);
if (ss.peek() == ',' || ss.peek() == ' ')
ss.ignore();
}
}
else
{
orbIds.push_back(atoi(orbId.c_str()));
orbIds.push_back(atoi(orbId.c_str()));
}
device = new LedDeviceAtmoOrb(output, switchOffOnBlack, transitiontime, port, numLeds, orbIds);
}
device = new LedDeviceAtmoOrb(output, useOrbSmoothing, transitiontime, skipSmoothingDiff, port, numLeds, orbIds);
}
else if (type == "file")
{
const std::string output = deviceConfig.get("output", "/dev/null").asString();