logging migration for ws281x and LedUdpDevice (#45)

This commit is contained in:
penfold42 2016-06-25 01:46:23 +10:00 committed by brindosch
parent 33ebdcaffc
commit b6a0b7261d
4 changed files with 6 additions and 6 deletions

View File

@ -6,13 +6,13 @@
LedDeviceWS281x::LedDeviceWS281x(const int gpio, const int leds, const uint32_t freq, const int dmanum, const int pwmchannel, const int invert, const int rgbw, const std::string& whiteAlgorithm)
{
_whiteAlgorithm = whiteAlgorithm;
std::cout << "whiteAlgorithm :" << whiteAlgorithm << ":\n";
Debug( Logger::getInstance("LedDevice"), "whiteAlgorithm : %s", whiteAlgorithm.c_str());
initialized = false;
led_string.freq = freq;
led_string.dmanum = dmanum;
if (pwmchannel != 0 && pwmchannel != 1) {
std::cout << "WS281x: invalid PWM channel; must be 0 or 1." << std::endl;
Error( Logger::getInstance("LedDevice"), "WS281x: invalid PWM channel; must be 0 or 1.");
throw -1;
}
chan = pwmchannel;
@ -32,7 +32,7 @@ std::cout << "whiteAlgorithm :" << whiteAlgorithm << ":\n";
led_string.channel[!chan].brightness = 0;
led_string.channel[!chan].strip_type = WS2811_STRIP_RGB;
if (ws2811_init(&led_string) < 0) {
std::cout << "Unable to initialize ws281x library." << std::endl;
Error( Logger::getInstance("LedDevice"), "Unable to initialize ws281x library.");
throw -1;
}
initialized = true;
@ -95,7 +95,6 @@ LedDeviceWS281x::~LedDeviceWS281x()
{
if (initialized)
{
std::cout << "Shutdown WS281x PWM and DMA channel" << std::endl;
ws2811_fini(&led_string);
}
initialized = false;

View File

@ -5,6 +5,7 @@
#include <leddevice/LedDevice.h>
#include <ws2811.h>
#include <utils/Logger.h>
class LedDeviceWS281x : public LedDevice
{

View File

@ -15,7 +15,6 @@
// Local Hyperion includes
#include "LedUdpDevice.h"
LedUdpDevice::LedUdpDevice(const std::string& outputDevice, const unsigned baudrate, const int latchTime_ns) :
mDeviceName(outputDevice),
mBaudRate_Hz(baudrate),
@ -26,7 +25,7 @@ LedUdpDevice::LedUdpDevice(const std::string& outputDevice, const unsigned baudr
QString str = QString::fromStdString(mDeviceName);
QStringList _list = str.split(":");
if (_list.size() != 2) {
printf ("ERROR: LedUdpDevice: Error parsing hostname:port\n");
Error( Logger::getInstance("LedDevice"), "LedUdpDevice: Error parsing hostname:port");
exit (-1);
}
QHostInfo info = QHostInfo::fromName(_list.at(0));

View File

@ -7,6 +7,7 @@
// Hyperion includes
#include <leddevice/LedDevice.h>
#include <utils/Logger.h>
///
/// The LedUdpDevice implements an abstract base-class for LedDevices using the SPI-device.