mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Updated constructor of ws2811 to contain chip configuration
Former-commit-id: 330056ce83edb3e7fa4d36961a52f8d413e289bb
This commit is contained in:
@@ -49,10 +49,17 @@ LedDevice* Hyperion::createDevice(const Json::Value& deviceConfig)
|
||||
}
|
||||
else if (type == "ws2811")
|
||||
{
|
||||
const std::string type = deviceConfig["type"].asString();
|
||||
const std::string output = deviceConfig["output"].asString();
|
||||
const std::string output = deviceConfig["output"].asString();
|
||||
const std::string outputSpeed = deviceConfig["output"].asString();
|
||||
const std::string timingOption = deviceConfig["timingOption"].asString();
|
||||
|
||||
LedDeviceWs2811 * deviceWs2811 = new LedDeviceWs2811(output);
|
||||
ws2811::SpeedMode speedMode = (outputSpeed == "high")? ws2811::highspeed : ws2811::lowspeed;
|
||||
if (outputSpeed != "high" && outputSpeed != "low")
|
||||
{
|
||||
std::cerr << "Incorrect speed-mode selected for WS2811: " << outputSpeed << " != {'high', 'low'}" << std::endl;
|
||||
}
|
||||
|
||||
LedDeviceWs2811 * deviceWs2811 = new LedDeviceWs2811(output, ws2811::fromString(timingOption, ws2811::option_2855), speedMode);
|
||||
deviceWs2811->open();
|
||||
|
||||
device = deviceWs2811;
|
||||
|
Reference in New Issue
Block a user