mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Logging leds (#50)
* switch to new logger for folowing led devices: LedDeviceAtmo LedDeviceFactory LedDeviceFadeCandy LedDeviceHyperionUsbasp LedDeviceLightpack-hidapi LedDevicePiBlaster LedDeviceWS281x LedRs232Device leddevice base class defines logger already as protected member _log * migrate to new logger for led devices. still todo: LedDeviceWS2812b LedDeviceWs2812SPI LedDeviceTinkerforge LedDeviceLightpack LedDeviceMultiLightpack
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
// Leddevice includes
|
||||
#include <leddevice/LedDeviceFactory.h>
|
||||
#include <utils/Logger.h>
|
||||
|
||||
// Local Leddevice includes
|
||||
#ifdef ENABLE_SPIDEV
|
||||
@@ -51,7 +52,10 @@
|
||||
|
||||
LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
|
||||
{
|
||||
std::cout << "LEDDEVICE INFO: configuration: " << deviceConfig << std::endl;
|
||||
Logger * log = Logger::getInstance("LedDevice");
|
||||
std::stringstream ss;
|
||||
ss << deviceConfig;
|
||||
Info(log, "configuration: %s ", ss.str().c_str());
|
||||
|
||||
std::string type = deviceConfig.get("type", "UNSPECIFIED").asString();
|
||||
std::transform(type.begin(), type.end(), type.begin(), ::tolower);
|
||||
@@ -288,11 +292,6 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
|
||||
|
||||
device = new LedDeviceAtmoOrb(output, useOrbSmoothing, transitiontime, skipSmoothingDiff, port, numLeds, orbIds);
|
||||
}
|
||||
else if (type == "file")
|
||||
{
|
||||
const std::string output = deviceConfig.get("output", "/dev/null").asString();
|
||||
device = new LedDeviceFile(output);
|
||||
}
|
||||
else if (type == "fadecandy")
|
||||
{
|
||||
const std::string host = deviceConfig.get("output", "127.0.0.1").asString();
|
||||
@@ -362,9 +361,13 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
|
||||
#endif
|
||||
else
|
||||
{
|
||||
std::cout << "LEDDEVICE ERROR: Unknown/Unimplemented device " << type << std::endl;
|
||||
// Unknown / Unimplemented device
|
||||
exit(1);
|
||||
if (type != "file")
|
||||
{
|
||||
Error(log, "Dummy device used, because unknown device %s set.", type.c_str());
|
||||
}
|
||||
const std::string output = deviceConfig.get("output", "/dev/null").asString();
|
||||
device = new LedDeviceFile(output);
|
||||
}
|
||||
|
||||
return device;
|
||||
}
|
||||
|
Reference in New Issue
Block a user